From 80fc0f8c63659ee4226f6bf685c64ac8ca9e5389 Mon Sep 17 00:00:00 2001 From: Peter Wu <162184229+weirongw23-msft@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:01:43 -0400 Subject: [PATCH 01/13] [Storage] Bumped changelogs, serialize, version, and setup for STG 94 (#35043) --- sdk/storage/azure-storage-blob/CHANGELOG.md | 2 ++ sdk/storage/azure-storage-blob/assets.json | 2 +- sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py | 1 + sdk/storage/azure-storage-blob/azure/storage/blob/_version.py | 2 +- sdk/storage/azure-storage-file-datalake/CHANGELOG.md | 2 ++ sdk/storage/azure-storage-file-datalake/assets.json | 2 +- .../azure/storage/filedatalake/_serialize.py | 1 + .../azure/storage/filedatalake/_version.py | 2 +- sdk/storage/azure-storage-file-datalake/setup.py | 2 +- sdk/storage/azure-storage-file-share/CHANGELOG.md | 2 ++ sdk/storage/azure-storage-file-share/assets.json | 2 +- .../azure/storage/fileshare/_serialize.py | 1 + .../azure/storage/fileshare/_version.py | 2 +- sdk/storage/azure-storage-queue/CHANGELOG.md | 2 ++ sdk/storage/azure-storage-queue/assets.json | 2 +- .../azure-storage-queue/azure/storage/queue/_serialize.py | 1 + sdk/storage/azure-storage-queue/azure/storage/queue/_version.py | 2 +- 17 files changed, 21 insertions(+), 9 deletions(-) diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index d6131c3e84c6..3206d2d1e3df 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 12.21.0b1 (Unreleased) + ## 12.20.0b1 (Unreleased) This version and all future versions will require Python 3.8+. Python 3.7 is no longer supported. diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index cb4645baa063..ee6a76c7d8df 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-blob", - "Tag": "python/storage/azure-storage-blob_fa839739c1" + "Tag": "python/storage/azure-storage-blob_2ebf88fe05" } diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py index bc12873508b1..94514328cb09 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_serialize.py @@ -58,6 +58,7 @@ '2023-08-03', '2023-11-03', '2024-05-04', + '2024-08-04', ] diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py index 7e6aa9c53729..e9621bd9ee67 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.20.0b1" +VERSION = "12.21.0b1" diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index 2963d25bd901..5c7415c8b94c 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 12.16.0b1 (Unreleased) + ## 12.15.0b1 (Unreleased) This version and all future versions will require Python 3.8+. Python 3.7 is no longer supported. diff --git a/sdk/storage/azure-storage-file-datalake/assets.json b/sdk/storage/azure-storage-file-datalake/assets.json index 8e43670b783d..b1078bd0bfba 100644 --- a/sdk/storage/azure-storage-file-datalake/assets.json +++ b/sdk/storage/azure-storage-file-datalake/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-datalake", - "Tag": "python/storage/azure-storage-file-datalake_433f2e076b" + "Tag": "python/storage/azure-storage-file-datalake_26175fa0e0" } diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py index 7fc93985e8e1..42ca982d8838 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py @@ -33,6 +33,7 @@ '2023-08-03', '2023-11-03', '2024-05-04', + '2024-08-04', ] # This list must be in chronological order! diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py index 21a4d316ca7a..d8db1c9721a3 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.15.0b1" +VERSION = "12.16.0b1" diff --git a/sdk/storage/azure-storage-file-datalake/setup.py b/sdk/storage/azure-storage-file-datalake/setup.py index cfd219335616..87db1d04e5a4 100644 --- a/sdk/storage/azure-storage-file-datalake/setup.py +++ b/sdk/storage/azure-storage-file-datalake/setup.py @@ -78,7 +78,7 @@ python_requires=">=3.8", install_requires=[ "azure-core>=1.28.0", - "azure-storage-blob>=12.20.0b1", + "azure-storage-blob>=12.21.0b1", "typing-extensions>=4.6.0", "isodate>=0.6.1" ], diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index 2f075647f6c8..e39968775d9e 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 12.17.0b1 (Unreleased) + ## 12.16.0b1 (Unreleased) This version and all future versions will require Python 3.8+. Python 3.7 is no longer supported. diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index 3dc4c88c2848..50f039a2bbe9 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-share", - "Tag": "python/storage/azure-storage-file-share_0ac9c475db" + "Tag": "python/storage/azure-storage-file-share_52c1f9ced5" } diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py index 97a294e062f7..8d03f6fff821 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py @@ -41,6 +41,7 @@ '2023-08-03', '2023-11-03', '2024-05-04', + '2024-08-04', ] diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py index d8db1c9721a3..75c4fa39d53f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.16.0b1" +VERSION = "12.17.0b1" diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index 9492d9f87104..e60013f7a6f7 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,5 +1,7 @@ # Release History +## 12.11.0b1 (Unreleased) + ## 12.10.0b1 (Unreleased) This version and all future versions will require Python 3.8+. Python 3.7 is no longer supported. diff --git a/sdk/storage/azure-storage-queue/assets.json b/sdk/storage/azure-storage-queue/assets.json index f85eb9693992..ba267a54fa0c 100644 --- a/sdk/storage/azure-storage-queue/assets.json +++ b/sdk/storage/azure-storage-queue/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-queue", - "Tag": "python/storage/azure-storage-queue_f34fa582aa" + "Tag": "python/storage/azure-storage-queue_cb6f8d2b58" } diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py index 15e6582c4aea..6279cd9228f2 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py @@ -16,6 +16,7 @@ '2020-08-04', '2020-10-02', '2021-02-12', + '2024-08-04', ] diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py index 0026680b9f8c..05a6791ed231 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_version.py @@ -4,4 +4,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "12.10.0b1" +VERSION = "12.11.0b1" From 68ca894d6e5d00fb07c30d517448bad4cb189d59 Mon Sep 17 00:00:00 2001 From: Peter Wu <162184229+weirongw23-msft@users.noreply.github.com> Date: Wed, 10 Apr 2024 20:47:22 -0400 Subject: [PATCH 02/13] [Storage] added tests for get_account_information across container client and blob client (#35067) --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../blob/_generated/_azure_blob_storage.py | 2 +- .../storage/blob/_generated/_configuration.py | 4 +- .../_generated/aio/_azure_blob_storage.py | 2 +- .../blob/_generated/aio/_configuration.py | 4 +- .../aio/operations/_blob_operations.py | 16 +++- .../aio/operations/_container_operations.py | 16 +++- .../aio/operations/_service_operations.py | 15 +++- .../operations/_append_blob_operations.py | 8 +- .../_generated/operations/_blob_operations.py | 72 +++++++++++------ .../operations/_block_blob_operations.py | 12 +-- .../operations/_container_operations.py | 60 +++++++++----- .../operations/_page_blob_operations.py | 18 ++--- .../operations/_service_operations.py | 39 ++++++--- .../tests/test_common_blob.py | 80 ++++++++++++++++++- .../tests/test_common_blob_async.py | 80 ++++++++++++++++++- 16 files changed, 339 insertions(+), 91 deletions(-) diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index ee6a76c7d8df..5a63d8af02a2 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-blob", - "Tag": "python/storage/azure-storage-blob_2ebf88fe05" + "Tag": "python/storage/azure-storage-blob_72aa299e55" } diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py index 45ff7faa36e4..ab930440b987 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py @@ -47,7 +47,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword :param base_url: Service URL. Required. Default value is "". :type base_url: str :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py index 7a4dcb114716..4de4871f14b6 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py @@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib desired operation. Required. :type url: str :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ def __init__(self, url: str, **kwargs: Any) -> None: - version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02") + version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04") if url is None: raise ValueError("Parameter 'url' must not be None.") diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py index 179833c01f13..ef97d289d0c9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py @@ -47,7 +47,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword :param base_url: Service URL. Required. Default value is "". :type base_url: str :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py index 3a1e9b4ae201..5960c22f03f2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py @@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib desired operation. Required. :type url: str :keyword version: Specifies the version of the operation to use for this request. Default value - is "2021-12-02". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ def __init__(self, url: str, **kwargs: Any) -> None: - version: Literal["2021-12-02"] = kwargs.pop("version", "2021-12-02") + version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04") if url is None: raise ValueError("Parameter 'url' must not be None.") diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 483d4f1b6369..910ebcb2358e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -2602,9 +2602,20 @@ async def set_tier( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async - async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + async def get_account_info( # pylint: disable=inconsistent-return-statements + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + ) -> None: """Returns the sku name and account kind. + :param timeout: The timeout parameter is expressed in seconds. For more information, see + :code:`Setting + Timeouts for Blob Service Operations.`. Default value is None. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. + :type request_id_parameter: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -2626,6 +2637,8 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco _request = build_get_account_info_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, @@ -2656,6 +2669,7 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date")) response_headers["x-ms-sku-name"] = self._deserialize("str", response.headers.get("x-ms-sku-name")) response_headers["x-ms-account-kind"] = self._deserialize("str", response.headers.get("x-ms-account-kind")) + response_headers["x-ms-is-hns-enabled"] = self._deserialize("bool", response.headers.get("x-ms-is-hns-enabled")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py index 7f603c21b594..8772e786345a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py @@ -1732,9 +1732,20 @@ async def list_blob_hierarchy_segment( return deserialized # type: ignore @distributed_trace_async - async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + async def get_account_info( # pylint: disable=inconsistent-return-statements + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + ) -> None: """Returns the sku name and account kind. + :param timeout: The timeout parameter is expressed in seconds. For more information, see + :code:`Setting + Timeouts for Blob Service Operations.`. Default value is None. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. + :type request_id_parameter: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -1756,6 +1767,8 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco _request = build_get_account_info_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, @@ -1786,6 +1799,7 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date")) response_headers["x-ms-sku-name"] = self._deserialize("str", response.headers.get("x-ms-sku-name")) response_headers["x-ms-account-kind"] = self._deserialize("str", response.headers.get("x-ms-account-kind")) + response_headers["x-ms-is-hns-enabled"] = self._deserialize("bool", response.headers.get("x-ms-is-hns-enabled")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index b60dcf0a0337..eeb45644cdf2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -479,9 +479,20 @@ async def get_user_delegation_key( return deserialized # type: ignore @distributed_trace_async - async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + async def get_account_info( # pylint: disable=inconsistent-return-statements + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + ) -> None: """Returns the sku name and account kind. + :param timeout: The timeout parameter is expressed in seconds. For more information, see + :code:`Setting + Timeouts for Blob Service Operations.`. Default value is None. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. + :type request_id_parameter: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -503,6 +514,8 @@ async def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inco _request = build_get_account_info_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index 3d9374f41030..c412a42591ea 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -67,7 +67,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) blob_type: Literal["AppendBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "AppendBlob")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -175,7 +175,7 @@ def build_append_block_request( comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -271,7 +271,7 @@ def build_append_block_from_url_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["appendblock"] = kwargs.pop("comp", _params.pop("comp", "appendblock")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -369,7 +369,7 @@ def build_seal_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["seal"] = kwargs.pop("comp", _params.pop("comp", "seal")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index 00f174331846..b3eba6f4a8c1 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -58,7 +58,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -137,7 +137,7 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -205,7 +205,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -256,7 +256,7 @@ def build_undelete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -294,7 +294,7 @@ def build_set_expiry_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["expiry"] = kwargs.pop("comp", _params.pop("comp", "expiry")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -345,7 +345,7 @@ def build_set_http_headers_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -414,7 +414,7 @@ def build_set_immutability_policy_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -456,7 +456,7 @@ def build_delete_immutability_policy_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["immutabilityPolicies"] = kwargs.pop("comp", _params.pop("comp", "immutabilityPolicies")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -493,7 +493,7 @@ def build_set_legal_hold_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["legalhold"] = kwargs.pop("comp", _params.pop("comp", "legalhold")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -541,7 +541,7 @@ def build_set_metadata_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -609,7 +609,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -667,7 +667,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -722,7 +722,7 @@ def build_renew_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -778,7 +778,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -834,7 +834,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -894,7 +894,7 @@ def build_create_snapshot_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -973,7 +973,7 @@ def build_start_copy_from_url_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1076,7 +1076,7 @@ def build_copy_from_url_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) x_ms_requires_sync: Literal["true"] = kwargs.pop("x_ms_requires_sync", _headers.pop("x-ms-requires-sync", "true")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1168,7 +1168,7 @@ def build_abort_copy_from_url_request( copy_action_abort_constant: Literal["abort"] = kwargs.pop( "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") ) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1214,7 +1214,7 @@ def build_set_tier_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["tier"] = kwargs.pop("comp", _params.pop("comp", "tier")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1250,13 +1250,15 @@ def build_set_tier_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: +def build_get_account_info_request( + url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1270,9 +1272,13 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") _params["comp"] = _SERIALIZER.query("comp", comp, "str") + if timeout is not None: + _params["timeout"] = _SERIALIZER.query("timeout", timeout, "int", minimum=0) # Construct headers _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") + if request_id_parameter is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -1301,7 +1307,7 @@ def build_query_request( comp: Literal["query"] = kwargs.pop("comp", _params.pop("comp", "query")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1365,7 +1371,7 @@ def build_get_tags_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1416,7 +1422,7 @@ def build_set_tags_request( comp: Literal["tags"] = kwargs.pop("comp", _params.pop("comp", "tags")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -4003,9 +4009,20 @@ def set_tier( # pylint: disable=inconsistent-return-statements return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace - def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def get_account_info( # pylint: disable=inconsistent-return-statements + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + ) -> None: """Returns the sku name and account kind. + :param timeout: The timeout parameter is expressed in seconds. For more information, see + :code:`Setting + Timeouts for Blob Service Operations.`. Default value is None. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. + :type request_id_parameter: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -4027,6 +4044,8 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste _request = build_get_account_info_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, @@ -4057,6 +4076,7 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date")) response_headers["x-ms-sku-name"] = self._deserialize("str", response.headers.get("x-ms-sku-name")) response_headers["x-ms-account-kind"] = self._deserialize("str", response.headers.get("x-ms-account-kind")) + response_headers["x-ms-is-hns-enabled"] = self._deserialize("bool", response.headers.get("x-ms-is-hns-enabled")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index e0c427ea8fc3..35164fd08cb6 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -72,7 +72,7 @@ def build_upload_request( blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -206,7 +206,7 @@ def build_put_blob_from_url_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) blob_type: Literal["BlockBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "BlockBlob")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -331,7 +331,7 @@ def build_stage_block_request( comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -407,7 +407,7 @@ def build_stage_block_from_url_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["block"] = kwargs.pop("comp", _params.pop("comp", "block")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -508,7 +508,7 @@ def build_commit_block_list_request( comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -614,7 +614,7 @@ def build_get_block_list_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["blocklist"] = kwargs.pop("comp", _params.pop("comp", "blocklist")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py index f715fc59ce3e..b14eabb97e42 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py @@ -49,7 +49,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -98,7 +98,7 @@ def build_get_properties_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -139,7 +139,7 @@ def build_delete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -185,7 +185,7 @@ def build_set_metadata_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -230,7 +230,7 @@ def build_get_access_policy_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -276,7 +276,7 @@ def build_set_access_policy_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -326,7 +326,7 @@ def build_restore_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -374,7 +374,7 @@ def build_rename_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -418,7 +418,7 @@ def build_submit_batch_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -463,7 +463,7 @@ def build_filter_blobs_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -514,7 +514,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -565,7 +565,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -613,7 +613,7 @@ def build_renew_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -661,7 +661,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -711,7 +711,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -760,7 +760,7 @@ def build_list_blob_flat_segment_request( restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -811,7 +811,7 @@ def build_list_blob_hierarchy_segment_request( # pylint: disable=name-too-long restype: Literal["container"] = kwargs.pop("restype", _params.pop("restype", "container")) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -846,13 +846,15 @@ def build_list_blob_hierarchy_segment_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: +def build_get_account_info_request( + url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -866,9 +868,13 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") _params["comp"] = _SERIALIZER.query("comp", comp, "str") + if timeout is not None: + _params["timeout"] = _SERIALIZER.query("timeout", timeout, "int", minimum=0) # Construct headers _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") + if request_id_parameter is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -2557,9 +2563,20 @@ def list_blob_hierarchy_segment( return deserialized # type: ignore @distributed_trace - def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def get_account_info( # pylint: disable=inconsistent-return-statements + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + ) -> None: """Returns the sku name and account kind. + :param timeout: The timeout parameter is expressed in seconds. For more information, see + :code:`Setting + Timeouts for Blob Service Operations.`. Default value is None. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. + :type request_id_parameter: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -2581,6 +2598,8 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste _request = build_get_account_info_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, @@ -2611,6 +2630,7 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date")) response_headers["x-ms-sku-name"] = self._deserialize("str", response.headers.get("x-ms-sku-name")) response_headers["x-ms-account-kind"] = self._deserialize("str", response.headers.get("x-ms-account-kind")) + response_headers["x-ms-is-hns-enabled"] = self._deserialize("bool", response.headers.get("x-ms-is-hns-enabled")) if cls: return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index 8ff281ca5e1c..63d50d3331a3 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -70,7 +70,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -186,7 +186,7 @@ def build_upload_pages_request( comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -286,7 +286,7 @@ def build_clear_pages_request( comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -385,7 +385,7 @@ def build_upload_pages_from_url_request( comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page")) page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -492,7 +492,7 @@ def build_get_page_ranges_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -560,7 +560,7 @@ def build_get_page_ranges_diff_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -631,7 +631,7 @@ def build_resize_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -698,7 +698,7 @@ def build_update_sequence_number_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -757,7 +757,7 @@ def build_copy_incremental_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index aa830c3fb769..9f2529836450 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -42,7 +42,7 @@ def build_set_properties_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -78,7 +78,7 @@ def build_get_properties_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -112,7 +112,7 @@ def build_get_statistics_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -153,7 +153,7 @@ def build_list_containers_segment_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -195,7 +195,7 @@ def build_get_user_delegation_key_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -223,13 +223,15 @@ def build_get_user_delegation_key_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, content=content, **kwargs) -def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: +def build_get_account_info_request( + url: str, *, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -243,9 +245,13 @@ def build_get_account_info_request(url: str, **kwargs: Any) -> HttpRequest: # Construct parameters _params["restype"] = _SERIALIZER.query("restype", restype, "str") _params["comp"] = _SERIALIZER.query("comp", comp, "str") + if timeout is not None: + _params["timeout"] = _SERIALIZER.query("timeout", timeout, "int", minimum=0) # Construct headers _headers["x-ms-version"] = _SERIALIZER.header("version", version, "str") + if request_id_parameter is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("request_id_parameter", request_id_parameter, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) @@ -265,7 +271,7 @@ def build_submit_batch_request( comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch")) multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None)) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -308,7 +314,7 @@ def build_filter_blobs_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs")) - version: Literal["2021-12-02"] = kwargs.pop("version", _headers.pop("x-ms-version", "2021-12-02")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -781,9 +787,20 @@ def get_user_delegation_key( return deserialized # type: ignore @distributed_trace - def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + def get_account_info( # pylint: disable=inconsistent-return-statements + self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, **kwargs: Any + ) -> None: """Returns the sku name and account kind. + :param timeout: The timeout parameter is expressed in seconds. For more information, see + :code:`Setting + Timeouts for Blob Service Operations.`. Default value is None. + :type timeout: int + :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. + :type request_id_parameter: str :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -805,6 +822,8 @@ def get_account_info(self, **kwargs: Any) -> None: # pylint: disable=inconsiste _request = build_get_account_info_request( url=self._config.url, + timeout=timeout, + request_id_parameter=request_id_parameter, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py index fb220012a954..a19f8b003b78 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -2601,11 +2601,85 @@ def test_get_account_information(self, **kwargs): # Act self._setup(storage_account_name, storage_account_key) - info = self.bsc.get_account_information() + bsc_info = self.bsc.get_account_information() + container_client = self.bsc.get_container_client(self.container_name) + cc_info = container_client.get_account_information() + blob_client = self._create_blob() + bc_info = blob_client.get_account_information() # Assert - assert info.get('sku_name') is not None - assert info.get('account_kind') is not None + assert bsc_info.get('sku_name') is not None + assert bsc_info.get('account_kind') is not None + assert not bsc_info.get('is_hns_enabled') + assert cc_info.get('sku_name') is not None + assert cc_info.get('account_kind') is not None + assert not cc_info.get('is_hns_enabled') + assert bc_info.get('sku_name') is not None + assert bc_info.get('account_kind') is not None + assert not bc_info.get('is_hns_enabled') + + @BlobPreparer() + @recorded_by_proxy + def test_get_account_information_sas(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + self._setup(storage_account_name, storage_account_key) + + account_token = self.generate_sas( + generate_account_sas, + account_name=storage_account_name, + account_key=storage_account_key, + resource_types=ResourceTypes(service=True), + permission=AccountSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + container_token = self.generate_sas( + generate_container_sas, + account_name=storage_account_name, + container_name=self.container_name, + account_key=storage_account_key, + permission=ContainerSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + blob_token = self.generate_sas( + generate_blob_sas, + account_name=storage_account_name, + container_name=self.container_name, + blob_name=self._get_blob_reference(), + account_key=storage_account_key, + permission=BlobSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + # Act + bsc = BlobServiceClient( + self.account_url(storage_account_name, "blob"), + credential=account_token) + bsc_info = bsc.get_account_information() + container_client = ContainerClient( + self.account_url(storage_account_name, "blob"), + self.container_name, + credential=container_token) + cc_info = container_client.get_account_information() + blob_client = BlobClient( + self.account_url(storage_account_name, "blob"), + self.container_name, + self._get_blob_reference(), + credential=blob_token) + bc_info = blob_client.get_account_information() + + # Assert + assert bsc_info.get('sku_name') is not None + assert bsc_info.get('account_kind') is not None + assert not bsc_info.get('is_hns_enabled') + assert cc_info.get('sku_name') is not None + assert cc_info.get('account_kind') is not None + assert not cc_info.get('is_hns_enabled') + assert bc_info.get('sku_name') is not None + assert bc_info.get('account_kind') is not None + assert not bc_info.get('is_hns_enabled') @BlobPreparer() @recorded_by_proxy diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py index 17122ed31dda..9c1f4c2f0464 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py @@ -2573,11 +2573,85 @@ async def test_get_account_information(self, **kwargs): # Act await self._setup(storage_account_name, storage_account_key) - info = await self.bsc.get_account_information() + bsc_info = await self.bsc.get_account_information() + container_client = self.bsc.get_container_client(self.container_name) + cc_info = await container_client.get_account_information() + blob_client = await self._create_blob() + bc_info = await blob_client.get_account_information() # Assert - assert info.get('sku_name') is not None - assert info.get('account_kind') is not None + assert bsc_info.get('sku_name') is not None + assert bsc_info.get('account_kind') is not None + assert not bsc_info.get('is_hns_enabled') + assert cc_info.get('sku_name') is not None + assert cc_info.get('account_kind') is not None + assert not cc_info.get('is_hns_enabled') + assert bc_info.get('sku_name') is not None + assert bc_info.get('account_kind') is not None + assert not bc_info.get('is_hns_enabled') + + @BlobPreparer() + @recorded_by_proxy_async + async def test_get_account_information_sas(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + await self._setup(storage_account_name, storage_account_key) + + account_token = self.generate_sas( + generate_account_sas, + account_name=storage_account_name, + account_key=storage_account_key, + resource_types=ResourceTypes(service=True), + permission=AccountSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + container_token = self.generate_sas( + generate_container_sas, + account_name=storage_account_name, + container_name=self.container_name, + account_key=storage_account_key, + permission=ContainerSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + blob_token = self.generate_sas( + generate_blob_sas, + account_name=storage_account_name, + container_name=self.container_name, + blob_name=self._get_blob_reference(), + account_key=storage_account_key, + permission=BlobSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + + # Act + bsc = BlobServiceClient( + self.account_url(storage_account_name, "blob"), + credential=account_token) + bsc_info = await bsc.get_account_information() + container_client = ContainerClient( + self.account_url(storage_account_name, "blob"), + self.container_name, + credential=container_token) + cc_info = await container_client.get_account_information() + blob_client = BlobClient( + self.account_url(storage_account_name, "blob"), + self.container_name, + self._get_blob_reference(), + credential=blob_token) + bc_info = await blob_client.get_account_information() + + # Assert + assert bsc_info.get('sku_name') is not None + assert bsc_info.get('account_kind') is not None + assert not bsc_info.get('is_hns_enabled') + assert cc_info.get('sku_name') is not None + assert cc_info.get('account_kind') is not None + assert not cc_info.get('is_hns_enabled') + assert bc_info.get('sku_name') is not None + assert bc_info.get('account_kind') is not None + assert not bc_info.get('is_hns_enabled') @BlobPreparer() @recorded_by_proxy_async From 8509ba7407c11af325c2b194ed9e42f73a2e8415 Mon Sep 17 00:00:00 2001 From: Peter Wu <162184229+weirongw23-msft@users.noreply.github.com> Date: Tue, 23 Apr 2024 18:57:05 -0400 Subject: [PATCH 03/13] [Storage] [File Share] [STG 94] Added tests for Authentication Error Detail message (#35234) --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../azure-storage-file-datalake/assets.json | 2 +- .../azure-storage-file-share/assets.json | 2 +- .../_generated/_azure_file_storage.py | 2 +- .../fileshare/_generated/_configuration.py | 4 +- .../_generated/aio/_azure_file_storage.py | 2 +- .../_generated/aio/_configuration.py | 4 +- .../aio/operations/_directory_operations.py | 25 +++--- .../aio/operations/_file_operations.py | 43 +++++----- .../aio/operations/_service_operations.py | 13 ++- .../aio/operations/_share_operations.py | 41 +++++----- .../_generated/models/_models_py3.py | 10 ++- .../operations/_directory_operations.py | 43 +++++----- .../_generated/operations/_file_operations.py | 79 ++++++++++--------- .../operations/_service_operations.py | 19 +++-- .../operations/_share_operations.py | 75 ++++++++++-------- .../tests/test_share.py | 36 ++++++++- .../tests/test_share_async.py | 39 ++++++++- sdk/storage/azure-storage-queue/assets.json | 2 +- 19 files changed, 279 insertions(+), 164 deletions(-) diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index a68d1dba0adf..c7ffdc341154 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-blob", - "Tag": "python/storage/azure-storage-blob_c4f327d388" + "Tag": "python/storage/azure-storage-blob_ba57356b0e" } diff --git a/sdk/storage/azure-storage-file-datalake/assets.json b/sdk/storage/azure-storage-file-datalake/assets.json index cbe0c3dc25c0..cae3918f5e32 100644 --- a/sdk/storage/azure-storage-file-datalake/assets.json +++ b/sdk/storage/azure-storage-file-datalake/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-datalake", - "Tag": "python/storage/azure-storage-file-datalake_95d136bf90" + "Tag": "python/storage/azure-storage-file-datalake_922696d4ec" } diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index b4ad58843489..75c74f0f875b 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-share", - "Tag": "python/storage/azure-storage-file-share_1159609065" + "Tag": "python/storage/azure-storage-file-share_890795be5a" } diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py index 3c7796a01895..aac0adcdceec 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py @@ -44,7 +44,7 @@ class AzureFileStorage: # pylint: disable=client-accepts-api-version-keyword URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-05-04". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py index 5eb5a5f150d2..54aea0342111 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py @@ -33,7 +33,7 @@ class AzureFileStorageConfiguration: # pylint: disable=too-many-instance-attrib URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-05-04". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that @@ -49,7 +49,7 @@ def __init__( allow_source_trailing_dot: Optional[bool] = None, **kwargs: Any ) -> None: - version: Literal["2024-05-04"] = kwargs.pop("version", "2024-05-04") + version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04") file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update") if url is None: diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py index c58d28789cf3..46b977e4d579 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py @@ -44,7 +44,7 @@ class AzureFileStorage: # pylint: disable=client-accepts-api-version-keyword URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-05-04". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py index 5f4ac8b24bdd..a71a8e74cfb8 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py @@ -33,7 +33,7 @@ class AzureFileStorageConfiguration: # pylint: disable=too-many-instance-attrib URI. Default value is None. :type allow_source_trailing_dot: bool :keyword version: Specifies the version of the operation to use for this request. Default value - is "2024-05-04". Note that overriding this default value may result in unsupported behavior. + is "2024-08-04". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. Default value is "update". Note that @@ -49,7 +49,7 @@ def __init__( allow_source_trailing_dot: Optional[bool] = None, **kwargs: Any ) -> None: - version: Literal["2024-05-04"] = kwargs.pop("version", "2024-05-04") + version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04") file_range_write_from_url: Literal["update"] = kwargs.pop("file_range_write_from_url", "update") if url is None: diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py index 583cf184473f..2877ddb3fa11 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,6 +37,10 @@ build_set_properties_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +114,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +210,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,7 +297,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,7 +390,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,7 +485,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -578,7 +583,7 @@ async def list_files_and_directories_segment( :rtype: ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -674,7 +679,7 @@ async def list_handles( :rtype: ~azure.storage.fileshare.models.ListHandlesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -765,7 +770,7 @@ async def force_close_handles( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,7 +890,7 @@ async def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py index 406411dc60e8..8aa0012fd84a 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -45,6 +46,10 @@ build_upload_range_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -127,7 +132,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +261,7 @@ async def download( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +462,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +577,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +684,7 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -803,7 +808,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +898,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -973,7 +978,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1060,7 +1065,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1144,7 +1149,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1258,7 +1263,7 @@ async def upload_range( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1384,7 +1389,7 @@ async def upload_range_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1503,7 +1508,7 @@ async def get_range_list( :rtype: ~azure.storage.fileshare.models.ShareFileRangeList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1614,7 +1619,7 @@ async def start_copy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1720,7 +1725,7 @@ async def abort_copy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1809,7 +1814,7 @@ async def list_handles( :rtype: ~azure.storage.fileshare.models.ListHandlesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1895,7 +1900,7 @@ async def force_close_handles( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2017,7 +2022,7 @@ async def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py index 5232833a70c0..82b5d5681cc2 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -30,6 +31,10 @@ build_set_properties_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,7 +141,7 @@ async def get_properties(self, timeout: Optional[int] = None, **kwargs: Any) -> :rtype: ~azure.storage.fileshare.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +228,7 @@ async def list_shares_segment( :rtype: ~azure.storage.fileshare.models.ListSharesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py index 0734e23b452b..f5d20d560a07 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -45,6 +46,10 @@ build_set_properties_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -104,7 +109,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +186,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,7 +299,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +388,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +477,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +569,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -653,7 +658,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -750,7 +755,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -832,7 +837,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -953,7 +958,7 @@ async def create_permission( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1033,7 +1038,7 @@ async def get_permission( :rtype: ~azure.storage.fileshare.models.SharePermission :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1117,7 +1122,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1198,7 +1203,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1273,7 +1278,7 @@ async def get_access_policy( :rtype: list[~azure.storage.fileshare.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1354,7 +1359,7 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1438,7 +1443,7 @@ async def get_statistics( :rtype: ~azure.storage.fileshare.models.ShareStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1526,7 +1531,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 94f5fcac3f72..5dd7985911e5 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -1543,19 +1543,27 @@ class StorageError(_serialization.Model): :ivar message: :vartype message: str + :ivar authentication_error_detail: + :vartype authentication_error_detail: str """ _attribute_map = { "message": {"key": "Message", "type": "str"}, + "authentication_error_detail": {"key": "AuthenticationErrorDetail", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, message: Optional[str] = None, authentication_error_detail: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword message: :paramtype message: str + :keyword authentication_error_detail: + :paramtype authentication_error_detail: str """ super().__init__(**kwargs) self.message = message + self.authentication_error_detail = authentication_error_detail class StorageServiceProperties(_serialization.Model): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py index 03bfd31171bf..52e76948e026 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +57,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -105,7 +110,7 @@ def build_get_properties_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -146,7 +151,7 @@ def build_delete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -192,7 +197,7 @@ def build_set_properties_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -245,7 +250,7 @@ def build_set_metadata_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -294,7 +299,7 @@ def build_list_files_and_directories_segment_request( # pylint: disable=name-to restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -350,7 +355,7 @@ def build_list_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["listhandles"] = kwargs.pop("comp", _params.pop("comp", "listhandles")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -401,7 +406,7 @@ def build_force_close_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["forceclosehandles"] = kwargs.pop("comp", _params.pop("comp", "forceclosehandles")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -461,7 +466,7 @@ def build_rename_request( restype: Literal["directory"] = kwargs.pop("restype", _params.pop("restype", "directory")) comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -587,7 +592,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -683,7 +688,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -770,7 +775,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -863,7 +868,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +963,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1056,7 +1061,7 @@ def list_files_and_directories_segment( :rtype: ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1152,7 +1157,7 @@ def list_handles( :rtype: ~azure.storage.fileshare.models.ListHandlesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1243,7 +1248,7 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1363,7 +1368,7 @@ def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py index bec5b64e3145..a26b1206aa0a 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, IO, Iterator, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Iterator, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +65,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) file_type_constant: Literal["file"] = kwargs.pop("file_type_constant", _headers.pop("x-ms-type", "file")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -131,7 +136,7 @@ def build_download_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -178,7 +183,7 @@ def build_get_properties_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -220,7 +225,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -274,7 +279,7 @@ def build_set_http_headers_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -344,7 +349,7 @@ def build_set_metadata_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -391,7 +396,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -440,7 +445,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -487,7 +492,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -535,7 +540,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -587,7 +592,7 @@ def build_upload_range_request( comp: Literal["range"] = kwargs.pop("comp", _params.pop("comp", "range")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -653,7 +658,7 @@ def build_upload_range_from_url_request( file_range_write_from_url: Literal["update"] = kwargs.pop( "file_range_write_from_url", _headers.pop("x-ms-write", "update") ) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -729,7 +734,7 @@ def build_get_range_list_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["rangelist"] = kwargs.pop("comp", _params.pop("comp", "rangelist")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -790,7 +795,7 @@ def build_start_copy_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -864,7 +869,7 @@ def build_abort_copy_request( copy_action_abort_constant: Literal["abort"] = kwargs.pop( "copy_action_abort_constant", _headers.pop("x-ms-copy-action", "abort") ) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -910,7 +915,7 @@ def build_list_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["listhandles"] = kwargs.pop("comp", _params.pop("comp", "listhandles")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -958,7 +963,7 @@ def build_force_close_handles_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["forceclosehandles"] = kwargs.pop("comp", _params.pop("comp", "forceclosehandles")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1016,7 +1021,7 @@ def build_rename_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["rename"] = kwargs.pop("comp", _params.pop("comp", "rename")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -1152,7 +1157,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1281,7 +1286,7 @@ def download( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1482,7 +1487,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1597,7 +1602,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1704,7 +1709,7 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1828,7 +1833,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1918,7 +1923,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1998,7 +2003,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2085,7 +2090,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2169,7 +2174,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2283,7 +2288,7 @@ def upload_range( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2409,7 +2414,7 @@ def upload_range_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2528,7 +2533,7 @@ def get_range_list( :rtype: ~azure.storage.fileshare.models.ShareFileRangeList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2639,7 +2644,7 @@ def start_copy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2745,7 +2750,7 @@ def abort_copy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2834,7 +2839,7 @@ def list_handles( :rtype: ~azure.storage.fileshare.models.ListHandlesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2920,7 +2925,7 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3042,7 +3047,7 @@ def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py index 187801dc381d..7923f4cc5bcc 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_set_properties_request( restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -74,7 +79,7 @@ def build_get_properties_request(url: str, *, timeout: Optional[int] = None, **k restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -112,7 +117,7 @@ def build_list_shares_segment_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -180,7 +185,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -245,7 +250,7 @@ def get_properties(self, timeout: Optional[int] = None, **kwargs: Any) -> _model :rtype: ~azure.storage.fileshare.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,7 +337,7 @@ def list_shares_segment( :rtype: ~azure.storage.fileshare.models.ListSharesResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 9f73185677b4..3a156414fdb6 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,7 @@ def build_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -94,7 +99,7 @@ def build_get_properties_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -134,7 +139,7 @@ def build_delete_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -179,7 +184,7 @@ def build_acquire_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["acquire"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "acquire")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -227,7 +232,7 @@ def build_release_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["release"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "release")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -273,7 +278,7 @@ def build_change_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["change"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "change")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -320,7 +325,7 @@ def build_renew_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["renew"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "renew")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -366,7 +371,7 @@ def build_break_lease_request( comp: Literal["lease"] = kwargs.pop("comp", _params.pop("comp", "lease")) action: Literal["break"] = kwargs.pop("action", _headers.pop("x-ms-lease-action", "break")) restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -407,7 +412,7 @@ def build_create_snapshot_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["snapshot"] = kwargs.pop("comp", _params.pop("comp", "snapshot")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -446,7 +451,7 @@ def build_create_permission_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["filepermission"] = kwargs.pop("comp", _params.pop("comp", "filepermission")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -487,7 +492,7 @@ def build_get_permission_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["filepermission"] = kwargs.pop("comp", _params.pop("comp", "filepermission")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -529,7 +534,7 @@ def build_set_properties_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -574,7 +579,7 @@ def build_set_metadata_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["metadata"] = kwargs.pop("comp", _params.pop("comp", "metadata")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -610,7 +615,7 @@ def build_get_access_policy_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -645,7 +650,7 @@ def build_set_access_policy_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["acl"] = kwargs.pop("comp", _params.pop("comp", "acl")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -681,7 +686,7 @@ def build_get_statistics_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -721,7 +726,7 @@ def build_restore_request( restype: Literal["share"] = kwargs.pop("restype", _params.pop("restype", "share")) comp: Literal["undelete"] = kwargs.pop("comp", _params.pop("comp", "undelete")) - version: Literal["2024-05-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-05-04")) + version: Literal["2024-08-04"] = kwargs.pop("version", _headers.pop("x-ms-version", "2024-08-04")) accept = _headers.pop("Accept", "application/xml") # Construct URL @@ -808,7 +813,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -885,7 +890,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -998,7 +1003,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1087,7 +1092,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1176,7 +1181,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1268,7 +1273,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1357,7 +1362,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1454,7 +1459,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1536,7 +1541,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1657,7 +1662,7 @@ def create_permission( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1737,7 +1742,7 @@ def get_permission( :rtype: ~azure.storage.fileshare.models.SharePermission :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1821,7 +1826,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1902,7 +1907,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1977,7 +1982,7 @@ def get_access_policy( :rtype: list[~azure.storage.fileshare.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2058,7 +2063,7 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2142,7 +2147,7 @@ def get_statistics( :rtype: ~azure.storage.fileshare.models.ShareStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2230,7 +2235,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py index 60333a24b904..60855f2ca782 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share.py @@ -10,7 +10,12 @@ import pytest import requests -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError +) from azure.core.pipeline.transport import RequestsTransport from azure.storage.fileshare import ( AccessPolicy, @@ -24,7 +29,8 @@ ShareProtocols, ShareRootSquash, ShareSasPermissions, - ShareServiceClient + ShareServiceClient, + StorageErrorCode ) from devtools_testutils import recorded_by_proxy @@ -950,6 +956,32 @@ def test_list_shares_account_sas(self, **kwargs): self.assertNamedItemInContainer(shares, share.share_name) self._delete_shares() + @FileSharePreparer() + @recorded_by_proxy + def test_list_shares_account_sas_fails(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + share = self._create_share() + sas_token = self.generate_sas( + generate_account_sas, + storage_account_name, + storage_account_key, + ResourceTypes(service=True), + AccountSasPermissions(list=True), + datetime.utcnow() - timedelta(hours=1) + ) + + # Act + fsc = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=sas_token) + with pytest.raises(ClientAuthenticationError) as e: + shares = list(fsc.list_shares()) + + # Assert + assert e.value.error_code == StorageErrorCode.AUTHENTICATION_FAILED + assert "authenticationerrordetail" in e.value.message + @FileSharePreparer() @recorded_by_proxy def test_set_share_metadata(self, **kwargs): diff --git a/sdk/storage/azure-storage-file-share/tests/test_share_async.py b/sdk/storage/azure-storage-file-share/tests/test_share_async.py index 748e75a14222..987b36c3bb77 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share_async.py @@ -9,7 +9,12 @@ import pytest import requests -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError +) from azure.core.pipeline.transport import AioHttpTransport from azure.storage.fileshare import ( AccessPolicy, @@ -20,7 +25,9 @@ ShareAccessTier, ShareProtocols, ShareRootSquash, - ShareSasPermissions + ShareSasPermissions, + ShareServiceClient, + StorageErrorCode ) from azure.storage.fileshare.aio import ShareClient, ShareFileClient, ShareServiceClient @@ -962,6 +969,34 @@ async def test_list_shares_account_sas(self, **kwargs): self.assertNamedItemInContainer(shares, share.share_name) await self._delete_shares() + @FileSharePreparer() + @recorded_by_proxy_async + async def test_list_shares_account_sas_fails(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + share = await self._create_share() + sas_token = self.generate_sas( + generate_account_sas, + storage_account_name, + storage_account_key, + ResourceTypes(service=True), + AccountSasPermissions(list=True), + datetime.utcnow() - timedelta(hours=1) + ) + + # Act + fsc = ShareServiceClient(self.account_url(storage_account_name, "file"), credential=sas_token) + with pytest.raises(ClientAuthenticationError) as e: + shares = [] + async for s in fsc.list_shares(): + shares.append(s) + + # Assert + assert e.value.error_code == StorageErrorCode.AUTHENTICATION_FAILED + assert "authenticationerrordetail" in e.value.message + @FileSharePreparer() @recorded_by_proxy_async diff --git a/sdk/storage/azure-storage-queue/assets.json b/sdk/storage/azure-storage-queue/assets.json index 866e4b465469..6f69716318e3 100644 --- a/sdk/storage/azure-storage-queue/assets.json +++ b/sdk/storage/azure-storage-queue/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-queue", - "Tag": "python/storage/azure-storage-queue_da8bdfe45e" + "Tag": "python/storage/azure-storage-queue_effe33bc27" } From 1be7b83f649d2bdab678aa218a77766553867e9e Mon Sep 17 00:00:00 2001 From: vincenttran-msft <101599632+vincenttran-msft@users.noreply.github.com> Date: Wed, 1 May 2024 15:37:03 -0700 Subject: [PATCH 04/13] [Storage] [STG94] Support more service versions in Queue, propagate StorageBearer Challenge to all packages (#35356) --- .../azure/storage/blob/_shared/base_client.py | 2 +- .../azure/storage/blob/_shared/base_client_async.py | 5 +++-- sdk/storage/azure-storage-file-datalake/CHANGELOG.md | 2 +- sdk/storage/azure-storage-file-datalake/assets.json | 2 +- .../azure/storage/filedatalake/_serialize.py | 1 + .../azure/storage/filedatalake/_shared/base_client.py | 4 ++-- .../storage/filedatalake/_shared/base_client_async.py | 8 ++++---- .../tests/test_datalake_service_client.py | 7 +++---- .../tests/test_datalake_service_client_async.py | 7 +++---- .../tests/test_directory.py | 7 +++---- .../tests/test_directory_async.py | 7 +++---- .../azure-storage-file-datalake/tests/test_file.py | 7 +++---- .../tests/test_file_async.py | 7 +++---- .../tests/test_file_system.py | 7 +++---- .../tests/test_file_system_async.py | 7 +++---- .../azure/storage/fileshare/_serialize.py | 1 + .../azure/storage/fileshare/_shared/base_client.py | 4 ++-- .../storage/fileshare/_shared/base_client_async.py | 8 ++++---- .../azure-storage-file-share/tests/test_file.py | 2 +- .../azure-storage-file-share/tests/test_file_async.py | 2 +- sdk/storage/azure-storage-queue/CHANGELOG.md | 2 +- sdk/storage/azure-storage-queue/assets.json | 2 +- .../azure/storage/queue/_serialize.py | 11 +++++++++++ .../azure/storage/queue/_shared/base_client.py | 4 ++-- .../azure/storage/queue/_shared/base_client_async.py | 8 ++++---- sdk/storage/azure-storage-queue/tests/test_queue.py | 10 ++++------ .../azure-storage-queue/tests/test_queue_async.py | 10 ++++------ 27 files changed, 73 insertions(+), 71 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py index 9d62c3abb3bb..0d624eb23952 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client.py @@ -231,7 +231,7 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = StorageBearerTokenCredentialPolicy(credential, audience) + self._credential_policy = StorageBearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client_async.py index 778b0454d8b4..2e5d3888b648 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/base_client_async.py @@ -6,7 +6,7 @@ # mypy: disable-error-code="attr-defined" import logging -from typing import Any, Dict, Optional, Tuple, TYPE_CHECKING, Union +from typing import Any, cast, Dict, Optional, Tuple, TYPE_CHECKING, Union from azure.core.async_paging import AsyncList from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential @@ -104,7 +104,8 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = AsyncStorageBearerTokenCredentialPolicy(credential, audience) + self._credential_policy = AsyncStorageBearerTokenCredentialPolicy( + cast(AsyncTokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index d9a318493fc0..8a90b2f55779 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -3,7 +3,7 @@ ## 12.16.0b1 (Unreleased) ### Features Added - +- Updated OAuth implementation to use the AAD scope returned in a Bearer challenge. ## 12.15.0 (Unreleased) diff --git a/sdk/storage/azure-storage-file-datalake/assets.json b/sdk/storage/azure-storage-file-datalake/assets.json index cae3918f5e32..af2ca0aa023b 100644 --- a/sdk/storage/azure-storage-file-datalake/assets.json +++ b/sdk/storage/azure-storage-file-datalake/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-datalake", - "Tag": "python/storage/azure-storage-file-datalake_922696d4ec" + "Tag": "python/storage/azure-storage-file-datalake_dec64d97f2" } diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py index 42ca982d8838..8c4a26173732 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py @@ -22,6 +22,7 @@ '2020-06-12', '2020-08-04', '2020-10-02', + '2020-12-06', '2021-02-12', '2021-04-10', '2021-06-08', diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py index 8746ae3195fd..0d624eb23952 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client.py @@ -23,7 +23,6 @@ from azure.core.pipeline.transport import HttpTransport, RequestsTransport # pylint: disable=non-abstract-transport-import, no-name-in-module from azure.core.pipeline.policies import ( AzureSasCredentialPolicy, - BearerTokenCredentialPolicy, ContentDecodePolicy, DistributedTracingPolicy, HttpLoggingPolicy, @@ -38,6 +37,7 @@ from .policies import ( ExponentialRetry, QueueMessagePolicy, + StorageBearerTokenCredentialPolicy, StorageContentValidation, StorageHeadersPolicy, StorageHosts, @@ -231,7 +231,7 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = BearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) + self._credential_policy = StorageBearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client_async.py index 8ddb5b390e11..2e5d3888b648 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/base_client_async.py @@ -14,7 +14,6 @@ from azure.core.exceptions import HttpResponseError from azure.core.pipeline import AsyncPipeline from azure.core.pipeline.policies import ( - AsyncBearerTokenCredentialPolicy, AsyncRedirectPolicy, AzureSasCredentialPolicy, ContentDecodePolicy, @@ -34,7 +33,7 @@ StorageHosts, StorageRequestHook, ) -from .policies_async import AsyncStorageResponseHook +from .policies_async import AsyncStorageBearerTokenCredentialPolicy, AsyncStorageResponseHook from .response_handlers import PartialBatchErrorException, process_storage_error from .._shared_access_signature import _is_credential_sastoken @@ -97,7 +96,7 @@ def _create_pipeline( **kwargs: Any ) -> Tuple[StorageConfiguration, AsyncPipeline]: self._credential_policy: Optional[ - Union[AsyncBearerTokenCredentialPolicy, + Union[AsyncStorageBearerTokenCredentialPolicy, SharedKeyCredentialPolicy, AzureSasCredentialPolicy]] = None if hasattr(credential, 'get_token'): @@ -105,7 +104,8 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = AsyncBearerTokenCredentialPolicy(cast(AsyncTokenCredential, credential), audience) + self._credential_policy = AsyncStorageBearerTokenCredentialPolicy( + cast(AsyncTokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py index 71498aa9593f..a0136a47bd8c 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client.py @@ -495,7 +495,6 @@ def test_bad_audience_service_client(self, **kwargs): audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert - with pytest.raises(ClientAuthenticationError): - dsc.list_file_systems() - dsc.create_file_system('testfs22') + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + dsc.list_file_systems() + dsc.create_file_system('testfs22') diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py index f8d357ae164a..0362acc7aa18 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_datalake_service_client_async.py @@ -497,7 +497,6 @@ async def test_bad_audience_service_client(self, **kwargs): audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert - with pytest.raises(ClientAuthenticationError): - dsc.list_file_systems() - await dsc.create_file_system(file_system_name + '1') + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + dsc.list_file_systems() + await dsc.create_file_system(file_system_name + '1') diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_directory.py b/sdk/storage/azure-storage-file-datalake/tests/test_directory.py index 3e29eb736e11..8c8c4725ef7f 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_directory.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_directory.py @@ -1603,10 +1603,9 @@ def test_bad_audience_dir_client(self, **kwargs): credential=token_credential, audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert - with pytest.raises(ClientAuthenticationError): - directory_client.exists() - directory_client.create_sub_directory('testsubdir') + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + directory_client.exists() + directory_client.create_sub_directory('testsubdir') # ------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py index 386485aeda6f..6318b80b59dc 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_directory_async.py @@ -1553,10 +1553,9 @@ async def test_bad_audience_dir_client(self, **kwargs): credential=token_credential, audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert - with pytest.raises(ClientAuthenticationError): - await directory_client.exists() - await directory_client.create_sub_directory('testsubdir') + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + await directory_client.exists() + await directory_client.create_sub_directory('testsubdir') # ------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file.py b/sdk/storage/azure-storage-file-datalake/tests/test_file.py index 32d45f52edae..ce4d0ad539b7 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file.py @@ -1628,11 +1628,10 @@ def test_bad_audience_file_client(self, **kwargs): audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge data = b'Hello world' - with pytest.raises(ClientAuthenticationError): - fc.get_file_properties() - fc.upload_data(data, overwrite=True) + fc.get_file_properties() + fc.upload_data(data, overwrite=True) # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py index 3da8d9537030..a14f148cc76a 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py @@ -1526,11 +1526,10 @@ async def test_bad_audience_file_client(self, **kwargs): audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge data = b'Hello world' - with pytest.raises(ClientAuthenticationError): - await fc.get_file_properties() - await fc.upload_data(data, overwrite=True) + await fc.get_file_properties() + await fc.upload_data(data, overwrite=True) # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py b/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py index 7501621fc65d..cc1e2d89dab8 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file_system.py @@ -1121,10 +1121,9 @@ def test_bad_audience_service_client(self, **kwargs): audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert - with pytest.raises(ClientAuthenticationError): - fsc.exists() - fsc.create_directory('testdir22') + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + fsc.exists() + fsc.create_directory('testdir22') # ------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py index 92716db72922..f2e2ed727688 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file_system_async.py @@ -1251,10 +1251,9 @@ async def test_bad_audience_service_client(self, **kwargs): audience=f'https://badaudience.blob.core.windows.net/' ) - # Assert - with pytest.raises(ClientAuthenticationError): - await fsc.exists() - await fsc.create_directory('testdir22') + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + await fsc.exists() + await fsc.create_directory('testdir22') # ------------------------------------------------------------------------------ if __name__ == '__main__': diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py index 8d03f6fff821..15bb36f4f6a3 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py @@ -30,6 +30,7 @@ '2020-06-12', '2020-08-04', '2020-10-02', + '2020-12-06', '2021-02-12', '2021-04-10', '2021-06-08', diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py index 8746ae3195fd..0d624eb23952 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client.py @@ -23,7 +23,6 @@ from azure.core.pipeline.transport import HttpTransport, RequestsTransport # pylint: disable=non-abstract-transport-import, no-name-in-module from azure.core.pipeline.policies import ( AzureSasCredentialPolicy, - BearerTokenCredentialPolicy, ContentDecodePolicy, DistributedTracingPolicy, HttpLoggingPolicy, @@ -38,6 +37,7 @@ from .policies import ( ExponentialRetry, QueueMessagePolicy, + StorageBearerTokenCredentialPolicy, StorageContentValidation, StorageHeadersPolicy, StorageHosts, @@ -231,7 +231,7 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = BearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) + self._credential_policy = StorageBearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py index 8ddb5b390e11..2e5d3888b648 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/base_client_async.py @@ -14,7 +14,6 @@ from azure.core.exceptions import HttpResponseError from azure.core.pipeline import AsyncPipeline from azure.core.pipeline.policies import ( - AsyncBearerTokenCredentialPolicy, AsyncRedirectPolicy, AzureSasCredentialPolicy, ContentDecodePolicy, @@ -34,7 +33,7 @@ StorageHosts, StorageRequestHook, ) -from .policies_async import AsyncStorageResponseHook +from .policies_async import AsyncStorageBearerTokenCredentialPolicy, AsyncStorageResponseHook from .response_handlers import PartialBatchErrorException, process_storage_error from .._shared_access_signature import _is_credential_sastoken @@ -97,7 +96,7 @@ def _create_pipeline( **kwargs: Any ) -> Tuple[StorageConfiguration, AsyncPipeline]: self._credential_policy: Optional[ - Union[AsyncBearerTokenCredentialPolicy, + Union[AsyncStorageBearerTokenCredentialPolicy, SharedKeyCredentialPolicy, AzureSasCredentialPolicy]] = None if hasattr(credential, 'get_token'): @@ -105,7 +104,8 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = AsyncBearerTokenCredentialPolicy(cast(AsyncTokenCredential, credential), audience) + self._credential_policy = AsyncStorageBearerTokenCredentialPolicy( + cast(AsyncTokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-file-share/tests/test_file.py b/sdk/storage/azure-storage-file-share/tests/test_file.py index 86ea0dfec4f3..7f1258ef2c05 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file.py @@ -3762,6 +3762,6 @@ def test_bad_audience_file_client(self, **kwargs): # Assert with pytest.raises(ClientAuthenticationError): - file_client.get_file_properties() + file_client.exists() # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_async.py index 3b1317fb6a6d..6be9c5d2c8bb 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_async.py @@ -3878,4 +3878,4 @@ async def test_bad_audience_file_client(self, **kwargs): # Assert with pytest.raises(ClientAuthenticationError): - await file_client.get_file_properties() + await file_client.exists() diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index a2d7a04f146a..8a030e26869c 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -3,7 +3,7 @@ ## 12.11.0b1 (Unreleased) ### Features Added - +- Updated OAuth implementation to use the AAD scope returned in a Bearer challenge. ## 12.10.0 (Unreleased) diff --git a/sdk/storage/azure-storage-queue/assets.json b/sdk/storage/azure-storage-queue/assets.json index 6f69716318e3..9433ba2740aa 100644 --- a/sdk/storage/azure-storage-queue/assets.json +++ b/sdk/storage/azure-storage-queue/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-queue", - "Tag": "python/storage/azure-storage-queue_effe33bc27" + "Tag": "python/storage/azure-storage-queue_8161cc758c" } diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py index 6279cd9228f2..91b518280fe1 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py @@ -15,7 +15,18 @@ '2020-06-12', '2020-08-04', '2020-10-02', + '2020-12-06', '2021-02-12', + '2021-04-10', + '2021-06-08', + '2021-08-06', + '2021-12-02', + '2022-11-02', + '2023-01-03', + '2023-05-03', + '2023-08-03', + '2023-11-03', + '2024-05-04', '2024-08-04', ] diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py index 8746ae3195fd..0d624eb23952 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client.py @@ -23,7 +23,6 @@ from azure.core.pipeline.transport import HttpTransport, RequestsTransport # pylint: disable=non-abstract-transport-import, no-name-in-module from azure.core.pipeline.policies import ( AzureSasCredentialPolicy, - BearerTokenCredentialPolicy, ContentDecodePolicy, DistributedTracingPolicy, HttpLoggingPolicy, @@ -38,6 +37,7 @@ from .policies import ( ExponentialRetry, QueueMessagePolicy, + StorageBearerTokenCredentialPolicy, StorageContentValidation, StorageHeadersPolicy, StorageHosts, @@ -231,7 +231,7 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = BearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) + self._credential_policy = StorageBearerTokenCredentialPolicy(cast(TokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py index 8ddb5b390e11..2e5d3888b648 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/base_client_async.py @@ -14,7 +14,6 @@ from azure.core.exceptions import HttpResponseError from azure.core.pipeline import AsyncPipeline from azure.core.pipeline.policies import ( - AsyncBearerTokenCredentialPolicy, AsyncRedirectPolicy, AzureSasCredentialPolicy, ContentDecodePolicy, @@ -34,7 +33,7 @@ StorageHosts, StorageRequestHook, ) -from .policies_async import AsyncStorageResponseHook +from .policies_async import AsyncStorageBearerTokenCredentialPolicy, AsyncStorageResponseHook from .response_handlers import PartialBatchErrorException, process_storage_error from .._shared_access_signature import _is_credential_sastoken @@ -97,7 +96,7 @@ def _create_pipeline( **kwargs: Any ) -> Tuple[StorageConfiguration, AsyncPipeline]: self._credential_policy: Optional[ - Union[AsyncBearerTokenCredentialPolicy, + Union[AsyncStorageBearerTokenCredentialPolicy, SharedKeyCredentialPolicy, AzureSasCredentialPolicy]] = None if hasattr(credential, 'get_token'): @@ -105,7 +104,8 @@ def _create_pipeline( audience = str(kwargs.pop('audience')).rstrip('/') + DEFAULT_OAUTH_SCOPE else: audience = STORAGE_OAUTH_SCOPE - self._credential_policy = AsyncBearerTokenCredentialPolicy(cast(AsyncTokenCredential, credential), audience) + self._credential_policy = AsyncStorageBearerTokenCredentialPolicy( + cast(AsyncTokenCredential, credential), audience) elif isinstance(credential, SharedKeyCredentialPolicy): self._credential_policy = credential elif isinstance(credential, AzureSasCredential): diff --git a/sdk/storage/azure-storage-queue/tests/test_queue.py b/sdk/storage/azure-storage-queue/tests/test_queue.py index 2b4375bf578d..2054debf3df6 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue.py @@ -1387,9 +1387,8 @@ def test_bad_audience_queue_service_client(self, **kwargs): audience=f'https://badaudience.queue.core.windows.net' ) - # Assert - with pytest.raises(ClientAuthenticationError): - qsc.get_service_properties() + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + qsc.get_service_properties() @QueuePreparer() @recorded_by_proxy @@ -1429,9 +1428,8 @@ def test_bad_audience_queue_client(self, **kwargs): audience=f'https://badaudience.queue.core.windows.net' ) - # Assert - with pytest.raises(ClientAuthenticationError): - queue.get_queue_properties() + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + queue.get_queue_properties() # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_async.py index 5621528a10bd..715d7501a7ea 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_async.py @@ -1417,9 +1417,8 @@ async def test_bad_audience_queue_service_client(self, **kwargs): audience=f'https://badaudience.queue.core.windows.net' ) - # Assert - with pytest.raises(ClientAuthenticationError): - await qsc.get_service_properties() + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + await qsc.get_service_properties() @QueuePreparer() @recorded_by_proxy_async @@ -1461,9 +1460,8 @@ async def test_bad_audience_queue_client(self, **kwargs): audience=f'https://badaudience.queue.core.windows.net' ) - # Assert - with pytest.raises(ClientAuthenticationError): - await queue.get_queue_properties() + # Will not raise ClientAuthenticationError despite bad audience due to Bearer Challenge + await queue.get_queue_properties() # ------------------------------------------------------------------------------ if __name__ == '__main__': From 97e9a3158a2a94689dffe3dcfd5bdf905191987b Mon Sep 17 00:00:00 2001 From: Peter Wu <162184229+weirongw23-msft@users.noreply.github.com> Date: Wed, 8 May 2024 13:15:12 -0400 Subject: [PATCH 05/13] [Storage] [STG 94] Error Code for Copy Blob (#35376) --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../azure/storage/blob/_generated/_patch.py | 1 + .../storage/blob/_generated/aio/_patch.py | 1 + .../aio/operations/_append_blob_operations.py | 15 +++-- .../aio/operations/_blob_operations.py | 55 +++++++++-------- .../aio/operations/_block_blob_operations.py | 19 +++--- .../aio/operations/_container_operations.py | 43 +++++++------ .../aio/operations/_page_blob_operations.py | 25 ++++---- .../aio/operations/_service_operations.py | 23 ++++--- .../blob/_generated/models/_models_py3.py | 28 ++++++++- .../operations/_append_blob_operations.py | 15 +++-- .../_generated/operations/_blob_operations.py | 55 +++++++++-------- .../operations/_block_blob_operations.py | 19 +++--- .../operations/_container_operations.py | 43 +++++++------ .../operations/_page_blob_operations.py | 25 ++++---- .../operations/_service_operations.py | 23 ++++--- .../azure/storage/blob/_shared/policies.py | 11 +++- .../storage/blob/_shared/response_handlers.py | 21 ++++--- .../tests/test_append_blob.py | 23 +++++++ .../tests/test_append_blob_async.py | 23 +++++++ .../tests/test_block_blob.py | 47 +++++++++++++++ .../tests/test_block_blob_async.py | 47 +++++++++++++++ .../tests/test_common_blob.py | 53 ++++++++++++++++ .../tests/test_common_blob_async.py | 53 ++++++++++++++++ .../tests/test_page_blob.py | 23 +++++++ .../tests/test_page_blob_async.py | 23 +++++++ .../azure-storage-blob/tests/test_retry.py | 60 +++++++++++++++++++ .../tests/test_retry_async.py | 60 +++++++++++++++++++ .../storage/filedatalake/_shared/policies.py | 11 +++- .../filedatalake/_shared/response_handlers.py | 21 ++++--- .../azure-storage-file-share/assets.json | 2 +- .../storage/fileshare/_generated/_patch.py | 1 + .../fileshare/_generated/aio/_patch.py | 1 + .../_generated/models/_models_py3.py | 27 ++++++++- .../storage/fileshare/_shared/policies.py | 11 +++- .../fileshare/_shared/response_handlers.py | 21 ++++--- .../tests/test_file.py | 44 ++++++++++++++ .../tests/test_file_async.py | 51 ++++++++++++++++ .../tests/test_share.py | 2 +- .../tests/test_share_async.py | 2 +- .../azure/storage/queue/_shared/policies.py | 11 +++- .../queue/_shared/response_handlers.py | 21 ++++--- 42 files changed, 870 insertions(+), 192 deletions(-) diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index c7ffdc341154..0ed403784c2a 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-blob", - "Tag": "python/storage/azure-storage-blob_ba57356b0e" + "Tag": "python/storage/azure-storage-blob_863b753fbb" } diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index 23e5744c8db7..2840b96ee011 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_seal_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -119,7 +124,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +300,7 @@ async def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +489,7 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,7 +651,7 @@ async def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 910ebcb2358e..f71ffebc37b5 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -52,6 +53,10 @@ build_undelete_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +137,7 @@ async def download( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +424,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -640,7 +645,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +736,7 @@ async def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +814,7 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +898,7 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1020,7 +1025,7 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1101,7 +1106,7 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1171,7 +1176,7 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1266,7 +1271,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1399,7 +1404,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1501,7 +1506,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1601,7 +1606,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1707,7 +1712,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1815,7 +1820,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1930,7 +1935,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2097,7 +2102,7 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2279,7 +2284,7 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2420,7 +2425,7 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2532,7 +2537,7 @@ async def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2620,7 +2625,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2716,7 +2721,7 @@ async def query( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2962,7 +2967,7 @@ async def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3070,7 +3075,7 @@ async def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index 6237bc20dc04..5123996799f5 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +35,10 @@ build_upload_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ async def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +368,7 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +560,7 @@ async def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -706,7 +711,7 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -890,7 +895,7 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1062,7 +1067,7 @@ async def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py index 8772e786345a..9a5197df8829 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -45,6 +46,10 @@ build_submit_batch_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -107,7 +112,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +199,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +304,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -397,7 +402,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +491,7 @@ async def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -587,7 +592,7 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -693,7 +698,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -776,7 +781,7 @@ async def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +862,7 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -964,7 +969,7 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1059,7 +1064,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1154,7 +1159,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1247,7 +1252,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1347,7 +1352,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1446,7 +1451,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1558,7 +1563,7 @@ async def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1675,7 @@ async def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1750,7 +1755,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index 854d58017352..45d5c64de5fb 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -37,6 +38,10 @@ build_upload_pages_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +142,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +322,7 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +490,7 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -663,7 +668,7 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -851,7 +856,7 @@ async def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1003,7 +1008,7 @@ async def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1131,7 @@ async def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1255,7 +1260,7 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1367,7 +1372,7 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index eeb45644cdf2..7a3c62fec53d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -35,6 +36,10 @@ build_submit_batch_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ async def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -234,7 +239,7 @@ async def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +341,7 @@ async def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +423,7 @@ async def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +502,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,7 +584,7 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -685,7 +690,7 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py index cd88cb20487f..4676b0eb1be4 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py @@ -2580,19 +2580,45 @@ class StorageError(_serialization.Model): :ivar message: :vartype message: str + :ivar copy_source_status_code: + :vartype copy_source_status_code: int + :ivar copy_source_error_code: + :vartype copy_source_error_code: str + :ivar copy_source_error_message: + :vartype copy_source_error_message: str """ _attribute_map = { "message": {"key": "Message", "type": "str"}, + "copy_source_status_code": {"key": "CopySourceStatusCode", "type": "int"}, + "copy_source_error_code": {"key": "CopySourceErrorCode", "type": "str"}, + "copy_source_error_message": {"key": "CopySourceErrorMessage", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + message: Optional[str] = None, + copy_source_status_code: Optional[int] = None, + copy_source_error_code: Optional[str] = None, + copy_source_error_message: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword message: :paramtype message: str + :keyword copy_source_status_code: + :paramtype copy_source_status_code: int + :keyword copy_source_error_code: + :paramtype copy_source_error_code: str + :keyword copy_source_error_message: + :paramtype copy_source_error_message: str """ super().__init__(**kwargs) self.message = message + self.copy_source_status_code = copy_source_status_code + self.copy_source_error_code = copy_source_error_code + self.copy_source_error_message = copy_source_error_message class StorageServiceProperties(_serialization.Model): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index c412a42591ea..f950ba4053bc 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -489,7 +494,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -665,7 +670,7 @@ def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -854,7 +859,7 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1016,7 +1021,7 @@ def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index b3eba6f4a8c1..385821f836a3 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Iterator, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Iterator, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1539,7 +1544,7 @@ def download( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1826,7 +1831,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2047,7 +2052,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2138,7 +2143,7 @@ def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2216,7 +2221,7 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2300,7 +2305,7 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2427,7 +2432,7 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2508,7 +2513,7 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2578,7 +2583,7 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2673,7 +2678,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2806,7 +2811,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2908,7 +2913,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3008,7 +3013,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3114,7 +3119,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3222,7 +3227,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3337,7 +3342,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3504,7 +3509,7 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3686,7 +3691,7 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3827,7 +3832,7 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3939,7 +3944,7 @@ def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4027,7 +4032,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4123,7 +4128,7 @@ def query( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4369,7 +4374,7 @@ def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4477,7 +4482,7 @@ def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index 35164fd08cb6..0a3083b16a7b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -749,7 +754,7 @@ def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -971,7 +976,7 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1163,7 +1168,7 @@ def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,7 +1319,7 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1498,7 +1503,7 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1675,7 @@ def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py index b14eabb97e42..37fe1f75556b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -938,7 +943,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1025,7 +1030,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1130,7 +1135,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1233,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1317,7 +1322,7 @@ def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1418,7 +1423,7 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1524,7 +1529,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1607,7 +1612,7 @@ def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1688,7 +1693,7 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1795,7 +1800,7 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1890,7 +1895,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1985,7 +1990,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2078,7 +2083,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2178,7 +2183,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2277,7 +2282,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2389,7 +2394,7 @@ def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2501,7 +2506,7 @@ def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2581,7 +2586,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index 63d50d3331a3..e388063fc7fa 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -889,7 +894,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1069,7 +1074,7 @@ def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,7 +1242,7 @@ def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1415,7 +1420,7 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1603,7 +1608,7 @@ def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1755,7 +1760,7 @@ def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1878,7 +1883,7 @@ def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2007,7 +2012,7 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2119,7 +2124,7 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index 9f2529836450..0d1bc1509661 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -392,7 +397,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +472,7 @@ def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +547,7 @@ def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -644,7 +649,7 @@ def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -726,7 +731,7 @@ def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -805,7 +810,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -887,7 +892,7 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +998,7 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py index 4596cb3d1b81..b2cd79e0b7e4 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode +from .models import LocationMode, StorageErrorCode try: _unicode_type = unicode # type: ignore @@ -88,6 +88,15 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True + if status >= 400: + error_code = response.http_response.headers.get('x-ms-copy-source-error-code') + retry_codes = [ + StorageErrorCode.OPERATION_TIMED_OUT, + StorageErrorCode.INTERNAL_ERROR, + StorageErrorCode.SERVER_BUSY + ] + if error_code in retry_codes: + return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py index e6b653035835..dc84c2dbfb25 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import NoReturn +from typing import Dict, NoReturn, Optional from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data = {} - error_dict = {} + additional_data: Dict[str, Optional[str]] = {} + error_dict: Dict[str, Optional[str]] = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag.lower(): child.text + child.tag: child.text for child in error_body } # If it is a JSON response @@ -118,9 +118,14 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - error_code = error_dict.get('code') - error_message = error_dict.get('message') - additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} + for k, v in error_dict.items(): + k_lower = k.lower() + if k_lower == 'code': + error_code = v + elif k_lower == 'message': + error_message = v + else: + additional_data[k] = v except DecodeError: pass diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob.py b/sdk/storage/azure-storage-blob/tests/test_append_blob.py index 6b309847b672..ecfe5bba2efe 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob.py @@ -340,6 +340,29 @@ def test_append_block_from_url(self, **kwargs): destination_blob_client.append_block_from_url(source_blob_client.url + '?' + sas, source_length=LARGE_BLOB_SIZE) + @BlobPreparer() + @recorded_by_proxy + def test_append_blob_async_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + bsc = BlobServiceClient( + self.account_url(storage_account_name, "blob"), + credential=storage_account_key, + max_page_size=4 * 1024) + self._setup(bsc) + source_blob = self._create_blob(bsc) + dest_blob = self._create_blob(bsc) + + # Act + with pytest.raises(HttpResponseError) as e: + dest_blob.append_block_from_url(source_blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy def test_append_block_from_url_and_validate_content_md5(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py index 811c0cd2cda7..9ffc503069db 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py @@ -328,6 +328,29 @@ async def test_append_block_from_url(self, **kwargs): await destination_blob_client.append_block_from_url(source_blob_client.url + '?' + sas, source_length=LARGE_BLOB_SIZE) + @BlobPreparer() + @recorded_by_proxy_async + async def test_append_blob_async_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + bsc = BlobServiceClient( + self.account_url(storage_account_name, "blob"), + credential=storage_account_key, + max_page_size=4 * 1024) + await self._setup(bsc) + source_blob = await self._create_blob(bsc) + dest_blob = await self._create_blob(bsc) + + # Act + with pytest.raises(HttpResponseError) as e: + await dest_blob.append_block_from_url(source_blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy_async async def test_append_block_from_url_and_validate_content_md5(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_block_blob.py index 0db4213f78df..60faee7b7403 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob.py @@ -499,6 +499,27 @@ def test_put_block(self, **kwargs): # Assert + @BlobPreparer() + @recorded_by_proxy + def test_upload_blob_from_url_sync_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + + # Act + with pytest.raises(HttpResponseError) as e: + target_blob.upload_blob_from_url(source_blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy def test_put_block_with_response(self, **kwargs): @@ -624,6 +645,32 @@ def test_put_block_with_immutability_policy(self, **kwargs): return variables + @BlobPreparer() + @recorded_by_proxy + def test_stage_block_from_url_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + split = 4 * 1024 + + # Act + with pytest.raises(HttpResponseError) as e: + target_blob.stage_block_from_url( + block_id=1, + source_url=source_blob.url, + source_offset=0, + source_length=split) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy def test_put_block_list_invalid_block_id(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py index 2002a7188a67..503d253bbd0e 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py @@ -509,6 +509,27 @@ async def test_upload_blob_from_url_source_and_destination_properties(self, **kw assert new_blob_copy1_props.tag_count is None assert new_blob_copy2_props.tag_count is None + @BlobPreparer() + @recorded_by_proxy_async + async def test_upload_blob_from_url_sync_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + await self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + + # Act + with pytest.raises(HttpResponseError) as e: + await target_blob.upload_blob_from_url(source_blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy_async async def test_put_block(self, **kwargs): @@ -576,6 +597,32 @@ async def test_put_block_from_url_and_commit(self, **kwargs): assert len(uncommitted) == 0 assert len(committed) == 2 + @BlobPreparer() + @recorded_by_proxy_async + async def test_stage_block_from_url_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + await self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + split = 4 * 1024 + + # Act + with pytest.raises(HttpResponseError) as e: + await target_blob.stage_block_from_url( + block_id=1, + source_url=source_blob.url, + source_offset=0, + source_length=split) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy_async async def test_put_block_with_response(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py index a19f8b003b78..1b504a0db53a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -1693,6 +1693,59 @@ def test_abort_copy_blob_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' + @BlobPreparer() + @recorded_by_proxy + def test_copy_blob_async_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + + sas_token = self.generate_sas( + generate_blob_sas, + source_blob.account_name, + source_blob.container_name, + source_blob.blob_name, + account_key=source_blob.credential.account_key, + permission=BlobSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) + + # Act + with pytest.raises(HttpResponseError) as e: + target_blob.start_copy_from_url(blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-error-code"] == "BlobNotFound" + assert e.value.response.headers["x-ms-copy-source-status-code"] == "404" + + @BlobPreparer() + @recorded_by_proxy + def test_copy_blob_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + + # Act + with pytest.raises(HttpResponseError) as e: + target_blob.start_copy_from_url(source_blob.url, requires_sync=True) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy def test_snapshot_blob(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py index 9c1f4c2f0464..0434009b686a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py @@ -1907,6 +1907,59 @@ async def test_abort_copy_blob_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' + @BlobPreparer() + @recorded_by_proxy_async + async def test_copy_blob_async_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + await self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + + sas_token = self.generate_sas( + generate_blob_sas, + source_blob.account_name, + source_blob.container_name, + source_blob.blob_name, + account_key=source_blob.credential.account_key, + permission=BlobSasPermissions(read=True), + expiry=datetime.utcnow() + timedelta(hours=1), + ) + blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) + + # Act + with pytest.raises(HttpResponseError) as e: + await target_blob.start_copy_from_url(blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-error-code"] == "BlobNotFound" + assert e.value.response.headers["x-ms-copy-source-status-code"] == "404" + + @BlobPreparer() + @recorded_by_proxy_async + async def test_copy_blob_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + await self._setup(storage_account_name, storage_account_key) + source_blob_name = "sourceblob" + source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) + target_blob_name = "targetblob" + target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) + + # Act + with pytest.raises(HttpResponseError) as e: + await target_blob.start_copy_from_url(source_blob.url, requires_sync=True) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy_async async def test_snapshot_blob(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob.py b/sdk/storage/azure-storage-blob/tests/test_page_blob.py index beb40b426064..b03965677a3a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob.py @@ -577,6 +577,29 @@ def test_upload_pages_from_url(self, **kwargs): assert blob_properties.get('etag') == source_with_special_chars_resp.get('etag') assert blob_properties.get('last_modified') == source_with_special_chars_resp.get('last_modified') + @BlobPreparer() + @recorded_by_proxy + def test_upload_pages_from_url_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + bsc = BlobServiceClient( + self.account_url(storage_account_name, "blob"), + credential=storage_account_key, + max_page_size=4 * 1024) + self._setup(bsc) + source_blob = self._create_blob(bsc) + dest_blob = self._create_blob(bsc) + + # Act + with pytest.raises(HttpResponseError) as e: + dest_blob.upload_blob_from_url(source_blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy def test_upload_pages_from_url_with_oauth(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py index 27bc668bcf69..cfc831f7f55c 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py @@ -564,6 +564,29 @@ async def test_upload_pages_from_url(self, **kwargs): assert blob_properties.get('etag') == resp.get('etag') assert blob_properties.get('last_modified') == resp.get('last_modified') + @BlobPreparer() + @recorded_by_proxy_async + async def test_upload_pages_from_url_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + # Arrange + bsc = BlobServiceClient( + self.account_url(storage_account_name, "blob"), + credential=storage_account_key, + max_page_size=4 * 1024) + await self._setup(bsc) + source_blob = await self._create_blob(bsc) + dest_blob = await self._create_blob(bsc) + + # Act + with pytest.raises(HttpResponseError) as e: + await dest_blob.upload_blob_from_url(source_blob.url) + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" + @BlobPreparer() @recorded_by_proxy_async async def test_upload_pages_from_url_and_validate_content_md5(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_retry.py b/sdk/storage/azure-storage-blob/tests/test_retry.py index 489f823d9197..c91e2365ab4c 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry.py @@ -21,6 +21,7 @@ LinearRetry, LocationMode ) +from azure.storage.blob._shared.models import StorageErrorCode from requests import Response from requests.exceptions import ContentDecodingError, ChunkedEncodingError, ReadTimeout @@ -550,4 +551,63 @@ def test_streaming_retry(self, **kwargs): blob.download_blob() assert iterator_mock.__next__.call_count == count[0] == 3 + @BlobPreparer() + @recorded_by_proxy + def test_retry_on_copy_source_error(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + """Test that retry on timeout, server error, server busy if surfaced from x-ms-copy-source-status-code.""" + # Arrange + container_name = self.get_resource_name('utcontainer') + retry = LinearRetry(backoff=1, retry_total=3) + retry_counter = RetryCounter() + service = self._create_storage_service( + BlobServiceClient, + storage_account_name, + storage_account_key, + retry_policy=retry) + + def response_handler(raw_response): + if retry_counter.count == 0: + raw_response.http_response.status_code = 400 + raw_response.http_response.headers['x-ms-copy-source-status-code'] = '408' + raw_response.http_response.headers['x-ms-copy-source-error-code'] = ( + StorageErrorCode.OPERATION_TIMED_OUT) + elif retry_counter.count == 1: + raw_response.http_response.status_code = 400 + raw_response.http_response.headers['x-ms-copy-source-status-code'] = '500' + raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.INTERNAL_ERROR + elif retry_counter.count == 2: + raw_response.http_response.status_code = 400 + raw_response.http_response.headers['x-ms-copy-source-status-code'] = '503' + raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.SERVER_BUSY + + def assert_exception_is_present_on_retry_context(**kwargs): + assert kwargs.get('response') is not None + if retry_counter.count == 0: + assert kwargs['response'].status_code == 400 + assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '408' + assert kwargs['response'].headers['x-ms-copy-source-error-code'] == ( + StorageErrorCode.OPERATION_TIMED_OUT) + elif retry_counter.count == 1: + assert kwargs['response'].status_code == 400 + assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '500' + assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.INTERNAL_ERROR + elif retry_counter.count == 2: + assert kwargs['response'].status_code == 400 + assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '503' + assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.SERVER_BUSY + retry_counter.simple_count(retry) + + # Act + with pytest.raises(HttpResponseError): + service.create_container( + container_name, + raw_response_hook=response_handler, + retry_hook=assert_exception_is_present_on_retry_context) + + # Assert + assert retry_counter.count == 3 + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_retry_async.py b/sdk/storage/azure-storage-blob/tests/test_retry_async.py index f19e092d6956..371bba0d4dfb 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry_async.py @@ -20,6 +20,7 @@ from azure.core.pipeline.transport import AioHttpTransport from azure.storage.blob import LocationMode from azure.storage.blob._shared.policies_async import ExponentialRetry, LinearRetry +from azure.storage.blob._shared.models import StorageErrorCode from azure.storage.blob.aio import BlobServiceClient from devtools_testutils import ResponseCallback, RetryCounter @@ -529,4 +530,63 @@ async def test_streaming_retry(self, **kwargs): await blob.download_blob() assert stream_reader_read_mock.call_count == count[0] == 4 + @BlobPreparer() + @recorded_by_proxy_async + async def test_retry_on_copy_source_error(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + """Test that retry on timeout, server error, server busy if surfaced from x-ms-copy-source-status-code.""" + # Arrange + container_name = self.get_resource_name('utcontainer') + retry = LinearRetry(backoff=1, retry_total=3) + retry_counter = RetryCounter() + service = self._create_storage_service( + BlobServiceClient, + storage_account_name, + storage_account_key, + retry_policy=retry) + + def response_handler(raw_response): + if retry_counter.count == 0: + raw_response.http_response.status_code = 400 + raw_response.http_response.headers['x-ms-copy-source-status-code'] = '408' + raw_response.http_response.headers['x-ms-copy-source-error-code'] = ( + StorageErrorCode.OPERATION_TIMED_OUT) + elif retry_counter.count == 1: + raw_response.http_response.status_code = 400 + raw_response.http_response.headers['x-ms-copy-source-status-code'] = '500' + raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.INTERNAL_ERROR + elif retry_counter.count == 2: + raw_response.http_response.status_code = 400 + raw_response.http_response.headers['x-ms-copy-source-status-code'] = '503' + raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.SERVER_BUSY + + def assert_exception_is_present_on_retry_context(**kwargs): + assert kwargs.get('response') is not None + if retry_counter.count == 0: + assert kwargs['response'].status_code == 400 + assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '408' + assert kwargs['response'].headers['x-ms-copy-source-error-code'] == ( + StorageErrorCode.OPERATION_TIMED_OUT) + elif retry_counter.count == 1: + assert kwargs['response'].status_code == 400 + assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '500' + assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.INTERNAL_ERROR + elif retry_counter.count == 2: + assert kwargs['response'].status_code == 400 + assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '503' + assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.SERVER_BUSY + retry_counter.simple_count(retry) + + # Act + with pytest.raises(HttpResponseError): + await service.create_container( + container_name, + raw_response_hook=response_handler, + retry_hook=assert_exception_is_present_on_retry_context) + + # Assert + assert retry_counter.count == 3 + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py index 4abfc9163a84..7f8caabbb710 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode +from .models import LocationMode, StorageErrorCode try: _unicode_type = unicode # type: ignore @@ -88,6 +88,15 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True + if status >= 400: + error_code = response.http_response.headers.get('x-ms-copy-source-error-code') + retry_codes = [ + StorageErrorCode.OPERATION_TIMED_OUT, + StorageErrorCode.INTERNAL_ERROR, + StorageErrorCode.SERVER_BUSY + ] + if error_code in retry_codes: + return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py index e6b653035835..dc84c2dbfb25 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import NoReturn +from typing import Dict, NoReturn, Optional from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data = {} - error_dict = {} + additional_data: Dict[str, Optional[str]] = {} + error_dict: Dict[str, Optional[str]] = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag.lower(): child.text + child.tag: child.text for child in error_body } # If it is a JSON response @@ -118,9 +118,14 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - error_code = error_dict.get('code') - error_message = error_dict.get('message') - additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} + for k, v in error_dict.items(): + k_lower = k.lower() + if k_lower == 'code': + error_code = v + elif k_lower == 'message': + error_message = v + else: + additional_data[k] = v except DecodeError: pass diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index 75c74f0f875b..c084ac07ee98 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-share", - "Tag": "python/storage/azure-storage-file-share_890795be5a" + "Tag": "python/storage/azure-storage-file-share_a600655193" } diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py index f99e77fef986..17dbc073e01b 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py @@ -25,6 +25,7 @@ # # -------------------------------------------------------------------------- + # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 5dd7985911e5..7fe1a4ff1cb1 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -1543,26 +1543,51 @@ class StorageError(_serialization.Model): :ivar message: :vartype message: str + :ivar copy_source_status_code: + :vartype copy_source_status_code: int + :ivar copy_source_error_code: + :vartype copy_source_error_code: str + :ivar copy_source_error_message: + :vartype copy_source_error_message: str :ivar authentication_error_detail: :vartype authentication_error_detail: str """ _attribute_map = { "message": {"key": "Message", "type": "str"}, + "copy_source_status_code": {"key": "CopySourceStatusCode", "type": "int"}, + "copy_source_error_code": {"key": "CopySourceErrorCode", "type": "str"}, + "copy_source_error_message": {"key": "CopySourceErrorMessage", "type": "str"}, "authentication_error_detail": {"key": "AuthenticationErrorDetail", "type": "str"}, } def __init__( - self, *, message: Optional[str] = None, authentication_error_detail: Optional[str] = None, **kwargs: Any + self, + *, + message: Optional[str] = None, + copy_source_status_code: Optional[int] = None, + copy_source_error_code: Optional[str] = None, + copy_source_error_message: Optional[str] = None, + authentication_error_detail: Optional[str] = None, + **kwargs: Any ) -> None: """ :keyword message: :paramtype message: str + :keyword copy_source_status_code: + :paramtype copy_source_status_code: int + :keyword copy_source_error_code: + :paramtype copy_source_error_code: str + :keyword copy_source_error_message: + :paramtype copy_source_error_message: str :keyword authentication_error_detail: :paramtype authentication_error_detail: str """ super().__init__(**kwargs) self.message = message + self.copy_source_status_code = copy_source_status_code + self.copy_source_error_code = copy_source_error_code + self.copy_source_error_message = copy_source_error_message self.authentication_error_detail = authentication_error_detail diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py index 82a9f9e8f2ba..705b1cd73f90 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode +from .models import LocationMode, StorageErrorCode try: _unicode_type = unicode # type: ignore @@ -88,6 +88,15 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True + if status >= 400: + error_code = response.http_response.headers.get('x-ms-copy-source-error-code') + retry_codes = [ + StorageErrorCode.OPERATION_TIMED_OUT, + StorageErrorCode.INTERNAL_ERROR, + StorageErrorCode.SERVER_BUSY + ] + if error_code in retry_codes: + return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py index e6b653035835..dc84c2dbfb25 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import NoReturn +from typing import Dict, NoReturn, Optional from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data = {} - error_dict = {} + additional_data: Dict[str, Optional[str]] = {} + error_dict: Dict[str, Optional[str]] = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag.lower(): child.text + child.tag: child.text for child in error_body } # If it is a JSON response @@ -118,9 +118,14 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - error_code = error_dict.get('code') - error_message = error_dict.get('message') - additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} + for k, v in error_dict.items(): + k_lower = k.lower() + if k_lower == 'code': + error_code = v + elif k_lower == 'message': + error_message = v + else: + additional_data[k] = v except DecodeError: pass diff --git a/sdk/storage/azure-storage-file-share/tests/test_file.py b/sdk/storage/azure-storage-file-share/tests/test_file.py index 7f1258ef2c05..1258357bd687 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file.py @@ -1566,6 +1566,28 @@ def test_update_range_from_file_url_with_oauth(self, **kwargs): destination_file_client.upload_range_from_url(source_blob_client.url, offset=0, length=512, source_offset=0, source_authorization=token) + @FileSharePreparer() + @recorded_by_proxy + def test_update_range_from_file_url_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + source_file_name = 'testfile' + source_file_client = self._create_file(file_name=source_file_name) + data = b'abcdefghijklmnop' * 32 + source_file_client.upload_range(data, offset=0, length=512) + + destination_file_name = 'filetoupdate' + destination_file_client = self._create_empty_file(file_name=destination_file_name) + + with pytest.raises(HttpResponseError) as e: + destination_file_client.upload_range_from_url( + source_file_client.url, offset=0, length=512, source_offset=0) + + assert e.value.response.headers["x-ms-copy-source-status-code"] == "401" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "NoAuthenticationInformation" + @FileSharePreparer() @recorded_by_proxy def test_update_range_from_file_url_with_lease(self, **kwargs): @@ -2584,6 +2606,28 @@ def test_abort_copy_file_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' + @FileSharePreparer() + @recorded_by_proxy + def test_copy_file_async_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + + # Act + file_client = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path="targetfile", + credential=storage_account_key) + + with pytest.raises(ResourceNotFoundError) as e: + file_client.start_copy_from_url("https://error.file.core.windows.net/") + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "400" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "InvalidQueryParameterValue" + @FileSharePreparer() @recorded_by_proxy def test_unicode_get_file_unicode_name(self, **kwargs): diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_async.py index 6be9c5d2c8bb..373d78906b10 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_async.py @@ -1597,6 +1597,34 @@ async def test_update_range_from_file_url_with_oauth(self, **kwargs): await destination_file_client.upload_range_from_url( source_blob_client.url, offset=0, length=512, source_offset=0, source_authorization=token) + @FileSharePreparer() + @recorded_by_proxy_async + async def test_update_range_from_file_url_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + source_file_name = 'testfile' + source_file_client = await self._create_file( + storage_account_name, + storage_account_key, + file_name=source_file_name) + data = b'abcdefghijklmnop' * 32 + await source_file_client.upload_range(data, offset=0, length=512) + + destination_file_name = 'filetoupdate' + destination_file_client = await self._create_empty_file( + storage_account_name, + storage_account_key, + file_name=destination_file_name) + + with pytest.raises(HttpResponseError) as e: + await destination_file_client.upload_range_from_url( + source_file_client.url, offset=0, length=512, source_offset=0) + + assert e.value.response.headers["x-ms-copy-source-status-code"] == "401" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "NoAuthenticationInformation" + @FileSharePreparer() @recorded_by_proxy_async async def test_update_range_from_file_url_with_lease(self, **kwargs): @@ -2636,6 +2664,29 @@ async def test_abort_copy_file_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' + @FileSharePreparer() + @recorded_by_proxy_async + async def test_copy_file_async_copy_source_error_and_status_code(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + await self._setup_share(storage_account_name, storage_account_key) + + # Act + file_client = ShareFileClient( + self.account_url(storage_account_name, "file"), + share_name=self.share_name, + file_path="targetfile", + credential=storage_account_key) + + with pytest.raises(ResourceNotFoundError) as e: + await file_client.start_copy_from_url("https://error.file.core.windows.net/") + + # Assert + assert e.value.response.headers["x-ms-copy-source-status-code"] == "400" + assert e.value.response.headers["x-ms-copy-source-error-code"] == "InvalidQueryParameterValue" + @FileSharePreparer() @recorded_by_proxy_async async def test_unicode_get_file_unicode_name(self, **kwargs): diff --git a/sdk/storage/azure-storage-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py index 60855f2ca782..eb88bfd29a0c 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share.py @@ -980,7 +980,7 @@ def test_list_shares_account_sas_fails(self, **kwargs): # Assert assert e.value.error_code == StorageErrorCode.AUTHENTICATION_FAILED - assert "authenticationerrordetail" in e.value.message + assert "AuthenticationErrorDetail" in e.value.message @FileSharePreparer() @recorded_by_proxy diff --git a/sdk/storage/azure-storage-file-share/tests/test_share_async.py b/sdk/storage/azure-storage-file-share/tests/test_share_async.py index 987b36c3bb77..a04a18bb4977 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share_async.py @@ -995,7 +995,7 @@ async def test_list_shares_account_sas_fails(self, **kwargs): # Assert assert e.value.error_code == StorageErrorCode.AUTHENTICATION_FAILED - assert "authenticationerrordetail" in e.value.message + assert "AuthenticationErrorDetail" in e.value.message @FileSharePreparer() diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py index 256da7bed4d9..5df16ac02e86 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode +from .models import LocationMode, StorageErrorCode try: _unicode_type = unicode # type: ignore @@ -88,6 +88,15 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True + if status >= 400: + error_code = response.http_response.headers.get('x-ms-copy-source-error-code') + retry_codes = [ + StorageErrorCode.OPERATION_TIMED_OUT, + StorageErrorCode.INTERNAL_ERROR, + StorageErrorCode.SERVER_BUSY + ] + if error_code in retry_codes: + return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py index e6b653035835..dc84c2dbfb25 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import NoReturn +from typing import Dict, NoReturn, Optional from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data = {} - error_dict = {} + additional_data: Dict[str, Optional[str]] = {} + error_dict: Dict[str, Optional[str]] = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag.lower(): child.text + child.tag: child.text for child in error_body } # If it is a JSON response @@ -118,9 +118,14 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - error_code = error_dict.get('code') - error_message = error_dict.get('message') - additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} + for k, v in error_dict.items(): + k_lower = k.lower() + if k_lower == 'code': + error_code = v + elif k_lower == 'message': + error_message = v + else: + additional_data[k] = v except DecodeError: pass From 31bd830d747b8a0d5ddeb77b574d880c20877524 Mon Sep 17 00:00:00 2001 From: vincenttran-msft <101599632+vincenttran-msft@users.noreply.github.com> Date: Thu, 30 May 2024 12:53:01 -0700 Subject: [PATCH 06/13] [Storage] [STG94] Snapshot Management Support via REST for NFS Shares & New Header Custom Sorter (#35359) --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../storage/blob/_shared/authentication.py | 66 +++++++++++++++++-- .../tests/test_blob_access_conditions.py | 41 ++++++++++++ .../test_blob_access_conditions_async.py | 65 ++++++++++++++++++ .../filedatalake/_shared/authentication.py | 66 +++++++++++++++++-- .../azure-storage-file-share/assets.json | 2 +- .../storage/fileshare/_generated/_patch.py | 2 + .../fileshare/_generated/aio/_patch.py | 2 + .../_generated/aio/operations/_patch.py | 1 + .../aio/operations/_share_operations.py | 11 ++++ .../_generated/models/_models_py3.py | 7 ++ .../fileshare/_generated/models/_patch.py | 1 + .../fileshare/_generated/operations/_patch.py | 1 + .../operations/_share_operations.py | 21 ++++++ .../azure/storage/fileshare/_models.py | 6 ++ .../azure/storage/fileshare/_share_client.py | 3 + .../fileshare/_shared/authentication.py | 65 ++++++++++++++++-- .../fileshare/aio/_share_client_async.py | 3 + .../tests/test_share.py | 21 ++++++ .../tests/test_share_async.py | 23 +++++++ .../storage/queue/_shared/authentication.py | 66 +++++++++++++++++-- 21 files changed, 457 insertions(+), 18 deletions(-) diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index 0ed403784c2a..fce9d1a7c338 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-blob", - "Tag": "python/storage/azure-storage-blob_863b753fbb" + "Tag": "python/storage/azure-storage-blob_275000b78a" } diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py index abbbfe88127f..e4d5ed730846 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/authentication.py @@ -8,6 +8,7 @@ import re from typing import List, Tuple from urllib.parse import unquote, urlparse +from functools import cmp_to_key try: from yarl import URL @@ -27,6 +28,66 @@ logger = logging.getLogger(__name__) +table_lv0 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, 0x723, 0x725, + 0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e, + 0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, + 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, + 0x0, 0x0, 0x0, 0x743, 0x744, 0x748, 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, + 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, + 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c, 0x0, 0x750, 0x0, +] + +table_lv4 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +] + +def compare(lhs: str, rhs: str) -> int: # pylint:disable=too-many-return-statements + tables = [table_lv0, table_lv4] + curr_level, i, j, n = 0, 0, 0, len(tables) + lhs_len = len(lhs) + rhs_len = len(rhs) + while curr_level < n: + if curr_level == (n - 1) and i != j: + if i > j: + return -1 + if i < j: + return 1 + return 0 + + w1 = tables[curr_level][ord(lhs[i])] if i < lhs_len else 0x1 + w2 = tables[curr_level][ord(rhs[j])] if j < rhs_len else 0x1 + + if w1 == 0x1 and w2 == 0x1: + i = 0 + j = 0 + curr_level += 1 + elif w1 == w2: + i += 1 + j += 1 + elif w1 == 0: + i += 1 + elif w2 == 0: + j += 1 + else: + if w1 < w2: + return -1 + if w1 > w2: + return 1 + return 0 + return 0 + + # wraps a given exception with the desired exception type def _wrap_exception(ex, desired_type): msg = "" @@ -36,8 +97,6 @@ def _wrap_exception(ex, desired_type): # This method attempts to emulate the sorting done by the service def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - # Define the custom alphabet for weights - custom_weights = "-!#$%&*.^_|~+\"\'(),/`~0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz{}" # Build dict of tuples and list of keys header_dict = {} @@ -46,9 +105,8 @@ def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str header_dict[k] = v header_keys.append(k) - # Sort according to custom defined weights try: - header_keys = sorted(header_keys, key=lambda word: [custom_weights.index(c) for c in word]) + header_keys = sorted(header_keys, key=cmp_to_key(compare)) except ValueError as exc: raise ValueError("Illegal character encountered when sorting headers.") from exc diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py index 18fbae7ef491..c4aba5e31a80 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py @@ -3124,4 +3124,45 @@ def test_header_metadata_sort_in_upload_blob(self, **kwargs): # Act blob_client.upload_blob(data, length=len(data), metadata=metadata) + @BlobPreparer() + @recorded_by_proxy + def test_header_metadata_sort_in_upload_blob_translation(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup() + data = b'hello world' + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + try: + container_client = bsc.create_container(self.container_name) + except: + container_client = bsc.get_container_client(self.container_name) + blob_client = container_client.get_blob_client('blob1') + + # Hand-picked metadata examples that sorted incorrectly with our previous implementation. + metadata = { + 'test': 'val', + 'test-': 'val', + 'test--': 'val', + 'test-_': 'val', + 'test_-': 'val', + 'test__': 'val', + 'test-a': 'val', + 'test-A': 'val', + 'test-_A': 'val', + 'test_a': 'val', + 'test_Z': 'val', + 'test_a_': 'val', + 'test_a-': 'val', + 'test_a-_': 'val', + } + + # Act + # If we hit invalid metadata error, that means we have successfully sorted headers properly to pass auth error + with pytest.raises(HttpResponseError) as e: + blob_client.upload_blob(data, length=len(data), metadata=metadata) + + # Assert + assert StorageErrorCode.invalid_metadata == e.value.error_code + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py index 2b21f444f00c..ac2a864851ed 100644 --- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions_async.py @@ -3092,4 +3092,69 @@ async def test_header_metadata_sort_in_upload_blob(self, **kwargs): # Act await blob_client.upload_blob(data, length=len(data), metadata=metadata) + @BlobPreparer() + @recorded_by_proxy_async + async def test_header_metadata_sort_in_upload_blob(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup() + data = b'hello world' + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + try: + container_client = await bsc.create_container(self.container_name) + except: + container_client = bsc.get_container_client(self.container_name) + blob_client = container_client.get_blob_client('blob1') + + # Hand-picked metadata examples as Python & service don't sort '_' with the same weight + metadata = {'a0': 'a', 'a1': 'a', 'a2': 'a', 'a3': 'a', 'a4': 'a', 'a5': 'a', 'a6': 'a', 'a7': 'a', 'a8': 'a', + 'a9': 'a', '_': 'a', '_a': 'a', 'a_': 'a', '__': 'a', '_a_': 'a', 'b': 'a', 'c': 'a', 'y': 'a', + 'z': 'z_', '_z': 'a', '_F': 'a', 'F': 'a', 'F_': 'a', '_F_': 'a', '__F': 'a', '__a': 'a', 'a__': 'a' + } + + # Act + await blob_client.upload_blob(data, length=len(data), metadata=metadata) + + @BlobPreparer() + @recorded_by_proxy_async + async def test_header_metadata_sort_in_upload_blob_translation(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup() + data = b'hello world' + bsc = BlobServiceClient(self.account_url(storage_account_name, "blob"), storage_account_key) + try: + container_client = await bsc.create_container(self.container_name) + except: + container_client = bsc.get_container_client(self.container_name) + blob_client = container_client.get_blob_client('blob1') + + # Hand-picked metadata examples that sorted incorrectly with our previous implementation. + metadata = { + 'test': 'val', + 'test-': 'val', + 'test--': 'val', + 'test-_': 'val', + 'test_-': 'val', + 'test__': 'val', + 'test-a': 'val', + 'test-A': 'val', + 'test-_A': 'val', + 'test_a': 'val', + 'test_Z': 'val', + 'test_a_': 'val', + 'test_a-': 'val', + 'test_a-_': 'val', + } + + # Act + # If we hit invalid metadata error, that means we have successfully sorted headers properly to pass auth error + with pytest.raises(HttpResponseError) as e: + await blob_client.upload_blob(data, length=len(data), metadata=metadata) + + # Assert + assert StorageErrorCode.invalid_metadata == e.value.error_code + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py index abbbfe88127f..e4d5ed730846 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/authentication.py @@ -8,6 +8,7 @@ import re from typing import List, Tuple from urllib.parse import unquote, urlparse +from functools import cmp_to_key try: from yarl import URL @@ -27,6 +28,66 @@ logger = logging.getLogger(__name__) +table_lv0 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, 0x723, 0x725, + 0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e, + 0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, + 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, + 0x0, 0x0, 0x0, 0x743, 0x744, 0x748, 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, + 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, + 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c, 0x0, 0x750, 0x0, +] + +table_lv4 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +] + +def compare(lhs: str, rhs: str) -> int: # pylint:disable=too-many-return-statements + tables = [table_lv0, table_lv4] + curr_level, i, j, n = 0, 0, 0, len(tables) + lhs_len = len(lhs) + rhs_len = len(rhs) + while curr_level < n: + if curr_level == (n - 1) and i != j: + if i > j: + return -1 + if i < j: + return 1 + return 0 + + w1 = tables[curr_level][ord(lhs[i])] if i < lhs_len else 0x1 + w2 = tables[curr_level][ord(rhs[j])] if j < rhs_len else 0x1 + + if w1 == 0x1 and w2 == 0x1: + i = 0 + j = 0 + curr_level += 1 + elif w1 == w2: + i += 1 + j += 1 + elif w1 == 0: + i += 1 + elif w2 == 0: + j += 1 + else: + if w1 < w2: + return -1 + if w1 > w2: + return 1 + return 0 + return 0 + + # wraps a given exception with the desired exception type def _wrap_exception(ex, desired_type): msg = "" @@ -36,8 +97,6 @@ def _wrap_exception(ex, desired_type): # This method attempts to emulate the sorting done by the service def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - # Define the custom alphabet for weights - custom_weights = "-!#$%&*.^_|~+\"\'(),/`~0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz{}" # Build dict of tuples and list of keys header_dict = {} @@ -46,9 +105,8 @@ def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str header_dict[k] = v header_keys.append(k) - # Sort according to custom defined weights try: - header_keys = sorted(header_keys, key=lambda word: [custom_weights.index(c) for c in word]) + header_keys = sorted(header_keys, key=cmp_to_key(compare)) except ValueError as exc: raise ValueError("Illegal character encountered when sorting headers.") from exc diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index c084ac07ee98..f31202404fee 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "python", "TagPrefix": "python/storage/azure-storage-file-share", - "Tag": "python/storage/azure-storage-file-share_a600655193" + "Tag": "python/storage/azure-storage-file-share_e105feb7fb" } diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py index 17dbc073e01b..d3be7c117232 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py @@ -28,5 +28,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py index 17dbc073e01b..d3be7c117232 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py @@ -28,5 +28,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py index f5d20d560a07..bb89d8fb19c1 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py @@ -82,6 +82,7 @@ async def create( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -105,6 +106,8 @@ async def create( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -131,6 +134,7 @@ async def create( # pylint: disable=inconsistent-return-statements access_tier=access_tier, enabled_protocols=enabled_protocols, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, version=self._config.version, headers=_headers, @@ -266,6 +270,9 @@ async def get_properties( # pylint: disable=inconsistent-return-statements "str", response.headers.get("x-ms-enabled-protocols") ) response_headers["x-ms-root-squash"] = self._deserialize("str", response.headers.get("x-ms-root-squash")) + response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( + "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") + ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1098,6 +1105,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements quota: Optional[int] = None, access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1116,6 +1124,8 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1148,6 +1158,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements access_tier=access_tier, lease_id=_lease_id, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 7fe1a4ff1cb1..0730e6732024 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -1239,6 +1239,8 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many :vartype enabled_protocols: str :ivar root_squash: Known values are: "NoRootSquash", "RootSquash", and "AllSquash". :vartype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :ivar enable_snapshot_virtual_directory_access: + :vartype enable_snapshot_virtual_directory_access: bool """ _validation = { @@ -1266,6 +1268,7 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many "lease_duration": {"key": "LeaseDuration", "type": "str"}, "enabled_protocols": {"key": "EnabledProtocols", "type": "str"}, "root_squash": {"key": "RootSquash", "type": "str"}, + "enable_snapshot_virtual_directory_access": {"key": "EnableSnapshotVirtualDirectoryAccess", "type": "bool"}, } def __init__( @@ -1289,6 +1292,7 @@ def __init__( lease_duration: Optional[Union[str, "_models.LeaseDurationType"]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, "_models.ShareRootSquash"]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -1331,6 +1335,8 @@ def __init__( :paramtype enabled_protocols: str :keyword root_squash: Known values are: "NoRootSquash", "RootSquash", and "AllSquash". :paramtype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :keyword enable_snapshot_virtual_directory_access: + :paramtype enable_snapshot_virtual_directory_access: bool """ super().__init__(**kwargs) self.last_modified = last_modified @@ -1351,6 +1357,7 @@ def __init__( self.lease_duration = lease_duration self.enabled_protocols = enabled_protocols self.root_squash = root_squash + self.enable_snapshot_virtual_directory_access = enable_snapshot_virtual_directory_access class ShareProtocolSettings(_serialization.Model): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 3a156414fdb6..4f78e8fd55ff 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -48,6 +48,7 @@ def build_create_request( access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -82,6 +83,10 @@ def build_create_request( _headers["x-ms-enabled-protocols"] = _SERIALIZER.header("enabled_protocols", enabled_protocols, "str") if root_squash is not None: _headers["x-ms-root-squash"] = _SERIALIZER.header("root_squash", root_squash, "str") + if enable_snapshot_virtual_directory_access is not None: + _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( + "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -527,6 +532,7 @@ def build_set_properties_request( access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, lease_id: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -561,6 +567,10 @@ def build_set_properties_request( _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") if root_squash is not None: _headers["x-ms-root-squash"] = _SERIALIZER.header("root_squash", root_squash, "str") + if enable_snapshot_virtual_directory_access is not None: + _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( + "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -786,6 +796,7 @@ def create( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -809,6 +820,8 @@ def create( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -835,6 +848,7 @@ def create( # pylint: disable=inconsistent-return-statements access_tier=access_tier, enabled_protocols=enabled_protocols, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, version=self._config.version, headers=_headers, @@ -970,6 +984,9 @@ def get_properties( # pylint: disable=inconsistent-return-statements "str", response.headers.get("x-ms-enabled-protocols") ) response_headers["x-ms-root-squash"] = self._deserialize("str", response.headers.get("x-ms-root-squash")) + response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( + "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") + ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1802,6 +1819,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements quota: Optional[int] = None, access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1820,6 +1838,8 @@ def set_properties( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1852,6 +1872,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements access_tier=access_tier, lease_id=_lease_id, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py index dc42fef21bc3..141de2b503f6 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py @@ -341,6 +341,9 @@ class ShareProperties(DictMixin): Possible values include: 'NoRootSquash', 'RootSquash', 'AllSquash'. :ivar list(str) protocols: Indicates the protocols enabled on the share. The protocol can be either SMB or NFS. + :ivar bool enable_snapshot_virtual_directory_access: + Specifies whether the snapshot virtual directory should be accessible at the root of the share + mount point when NFS is enabled. if not specified, the default is True. """ def __init__(self, **kwargs): @@ -364,6 +367,8 @@ def __init__(self, **kwargs): self.protocols = [protocol.strip() for protocol in kwargs.get('x-ms-enabled-protocols', None).split(',')]\ if kwargs.get('x-ms-enabled-protocols', None) else None self.root_squash = kwargs.get('x-ms-root-squash', None) + self.enable_snapshot_virtual_directory_access = \ + kwargs.get('x-ms-enable-snapshot-virtual-directory-access') @classmethod def _from_generated(cls, generated): props = cls() @@ -387,6 +392,7 @@ def _from_generated(cls, generated): props.protocols = [protocol.strip() for protocol in generated.properties.enabled_protocols.split(',')]\ if generated.properties.enabled_protocols else None props.root_squash = generated.properties.root_squash + props.enable_snapshot_virtual_directory_access = generated.properties.enable_snapshot_virtual_directory_access return props diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py index 6335fd7ed1c4..2c7c154bb703 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py @@ -362,6 +362,9 @@ def create_share(self, **kwargs): Root squash to set on the share. Only valid for NFS shares. Possible values include: 'NoRootSquash', 'RootSquash', 'AllSquash'. :paramtype root_squash: str or ~azure.storage.fileshare.ShareRootSquash + :keyword bool enable_snapshot_virtual_directory_access: + Specifies whether the snapshot virtual directory should be accessible at the root of the share + mount point when NFS is enabled. Default value is True. :returns: Share-updated property dict (Etag and last modified). :rtype: Dict[str, Any] diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py index abbbfe88127f..7f01527560b6 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/authentication.py @@ -8,6 +8,7 @@ import re from typing import List, Tuple from urllib.parse import unquote, urlparse +from functools import cmp_to_key try: from yarl import URL @@ -26,6 +27,65 @@ logger = logging.getLogger(__name__) +table_lv0 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, 0x723, 0x725, + 0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e, + 0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, + 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, + 0x0, 0x0, 0x0, 0x743, 0x744, 0x748, 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, + 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, + 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c, 0x0, 0x750, 0x0, +] + +table_lv4 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +] + +def compare(lhs: str, rhs: str) -> int: # pylint:disable=too-many-return-statements + tables = [table_lv0, table_lv4] + curr_level, i, j, n = 0, 0, 0, len(tables) + lhs_len = len(lhs) + rhs_len = len(rhs) + while curr_level < n: + if curr_level == (n - 1) and i != j: + if i > j: + return -1 + if i < j: + return 1 + return 0 + + w1 = tables[curr_level][ord(lhs[i])] if i < lhs_len else 0x1 + w2 = tables[curr_level][ord(rhs[j])] if j < rhs_len else 0x1 + + if w1 == 0x1 and w2 == 0x1: + i = 0 + j = 0 + curr_level += 1 + elif w1 == w2: + i += 1 + j += 1 + elif w1 == 0: + i += 1 + elif w2 == 0: + j += 1 + else: + if w1 < w2: + return -1 + if w1 > w2: + return 1 + return 0 + return 0 + # wraps a given exception with the desired exception type def _wrap_exception(ex, desired_type): @@ -36,8 +96,6 @@ def _wrap_exception(ex, desired_type): # This method attempts to emulate the sorting done by the service def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - # Define the custom alphabet for weights - custom_weights = "-!#$%&*.^_|~+\"\'(),/`~0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz{}" # Build dict of tuples and list of keys header_dict = {} @@ -46,9 +104,8 @@ def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str header_dict[k] = v header_keys.append(k) - # Sort according to custom defined weights try: - header_keys = sorted(header_keys, key=lambda word: [custom_weights.index(c) for c in word]) + header_keys = sorted(header_keys, key=cmp_to_key(compare)) except ValueError as exc: raise ValueError("Illegal character encountered when sorting headers.") from exc diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py index d942fbd17acc..2fc1c179aa9e 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py @@ -225,6 +225,9 @@ async def create_share(self, **kwargs): Root squash to set on the share. Only valid for NFS shares. Possible values include: 'NoRootSquash', 'RootSquash', 'AllSquash'. :paramtype root_squash: str or ~azure.storage.fileshare.ShareRootSquash + :keyword bool enable_snapshot_virtual_directory_access: + Specifies whether the snapshot virtual directory should be accessible at the root of the share + mount point when NFS is enabled. Default value is True. :returns: Share-updated property dict (Etag and last modified). :rtype: Dict[str, Any] diff --git a/sdk/storage/azure-storage-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py index eb88bfd29a0c..335185e62b97 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share.py @@ -752,6 +752,27 @@ def test_list_shares_no_options(self, **kwargs): self.assertNamedItemInContainer(shares, share.share_name) self._delete_shares() + @FileSharePreparer() + @recorded_by_proxy + def test_list_shares_enable_snapshot_virtual_directory_access(self, **kwargs): + premium_storage_file_account_name = kwargs.pop("premium_storage_file_account_name") + premium_storage_file_account_key = kwargs.pop("premium_storage_file_account_key") + + self._setup(premium_storage_file_account_name, premium_storage_file_account_key) + share = self._create_share(protocols="NFS", enable_snapshot_virtual_directory_access=False) + + # Act + list_props = list(self.fsc.list_shares()) + share_props = share.get_share_properties() + + # Assert + assert list_props[0].protocols[0] == 'NFS' + assert list_props[0].enable_snapshot_virtual_directory_access is False + + assert share_props.protocols[0] == 'NFS' + assert share_props.enable_snapshot_virtual_directory_access is False + self._delete_shares() + @FileSharePreparer() @recorded_by_proxy def test_list_shares_no_options_for_premium_account(self, **kwargs): diff --git a/sdk/storage/azure-storage-file-share/tests/test_share_async.py b/sdk/storage/azure-storage-file-share/tests/test_share_async.py index a04a18bb4977..3691ab2e7ec6 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share_async.py @@ -749,6 +749,29 @@ async def test_list_shares_no_options(self, **kwargs): self.assertNamedItemInContainer(shares, share.share_name) await self._delete_shares(share.share_name) + @FileSharePreparer() + @recorded_by_proxy_async + async def test_list_shares_enable_snapshot_virtual_directory_access(self, **kwargs): + premium_storage_file_account_name = kwargs.pop("premium_storage_file_account_name") + premium_storage_file_account_key = kwargs.pop("premium_storage_file_account_key") + + self._setup(premium_storage_file_account_name, premium_storage_file_account_key) + share = await self._create_share(protocols="NFS", enable_snapshot_virtual_directory_access=False) + + # Act + list_props = [] + async for s in self.fsc.list_shares(): + list_props.append(s) + share_props = await share.get_share_properties() + + # Assert + assert list_props[0].protocols[0] == 'NFS' + assert list_props[0].enable_snapshot_virtual_directory_access is False + + assert share_props.protocols[0] == 'NFS' + assert share_props.enable_snapshot_virtual_directory_access is False + await self._delete_shares() + @FileSharePreparer() @recorded_by_proxy_async async def test_list_shares_no_options_for_premium_account(self, **kwargs): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py index abbbfe88127f..e4d5ed730846 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/authentication.py @@ -8,6 +8,7 @@ import re from typing import List, Tuple from urllib.parse import unquote, urlparse +from functools import cmp_to_key try: from yarl import URL @@ -27,6 +28,66 @@ logger = logging.getLogger(__name__) +table_lv0 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721, 0x723, 0x725, + 0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e, + 0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, + 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, + 0x0, 0x0, 0x0, 0x743, 0x744, 0x748, 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, + 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, + 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c, 0x0, 0x750, 0x0, +] + +table_lv4 = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, +] + +def compare(lhs: str, rhs: str) -> int: # pylint:disable=too-many-return-statements + tables = [table_lv0, table_lv4] + curr_level, i, j, n = 0, 0, 0, len(tables) + lhs_len = len(lhs) + rhs_len = len(rhs) + while curr_level < n: + if curr_level == (n - 1) and i != j: + if i > j: + return -1 + if i < j: + return 1 + return 0 + + w1 = tables[curr_level][ord(lhs[i])] if i < lhs_len else 0x1 + w2 = tables[curr_level][ord(rhs[j])] if j < rhs_len else 0x1 + + if w1 == 0x1 and w2 == 0x1: + i = 0 + j = 0 + curr_level += 1 + elif w1 == w2: + i += 1 + j += 1 + elif w1 == 0: + i += 1 + elif w2 == 0: + j += 1 + else: + if w1 < w2: + return -1 + if w1 > w2: + return 1 + return 0 + return 0 + + # wraps a given exception with the desired exception type def _wrap_exception(ex, desired_type): msg = "" @@ -36,8 +97,6 @@ def _wrap_exception(ex, desired_type): # This method attempts to emulate the sorting done by the service def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str, str]]: - # Define the custom alphabet for weights - custom_weights = "-!#$%&*.^_|~+\"\'(),/`~0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz{}" # Build dict of tuples and list of keys header_dict = {} @@ -46,9 +105,8 @@ def _storage_header_sort(input_headers: List[Tuple[str, str]]) -> List[Tuple[str header_dict[k] = v header_keys.append(k) - # Sort according to custom defined weights try: - header_keys = sorted(header_keys, key=lambda word: [custom_weights.index(c) for c in word]) + header_keys = sorted(header_keys, key=cmp_to_key(compare)) except ValueError as exc: raise ValueError("Illegal character encountered when sorting headers.") from exc From 19c92e4879ccb57a87ede20f53f6973ca143ff7c Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 30 May 2024 17:15:26 -0400 Subject: [PATCH 07/13] Revert "[Storage] [STG 94] Error Code for Copy Blob (#35376)" This reverts commit 97e9a3158a2a94689dffe3dcfd5bdf905191987b. --- .../azure/storage/blob/_generated/_patch.py | 1 - .../storage/blob/_generated/aio/_patch.py | 1 - .../aio/operations/_append_blob_operations.py | 15 ++--- .../aio/operations/_blob_operations.py | 55 ++++++++--------- .../aio/operations/_block_blob_operations.py | 19 +++--- .../aio/operations/_container_operations.py | 43 ++++++------- .../aio/operations/_page_blob_operations.py | 25 ++++---- .../aio/operations/_service_operations.py | 23 +++---- .../blob/_generated/models/_models_py3.py | 28 +-------- .../operations/_append_blob_operations.py | 15 ++--- .../_generated/operations/_blob_operations.py | 55 ++++++++--------- .../operations/_block_blob_operations.py | 19 +++--- .../operations/_container_operations.py | 43 ++++++------- .../operations/_page_blob_operations.py | 25 ++++---- .../operations/_service_operations.py | 23 +++---- .../azure/storage/blob/_shared/policies.py | 11 +--- .../storage/blob/_shared/response_handlers.py | 21 +++---- .../tests/test_append_blob.py | 23 ------- .../tests/test_append_blob_async.py | 23 ------- .../tests/test_block_blob.py | 47 --------------- .../tests/test_block_blob_async.py | 47 --------------- .../tests/test_common_blob.py | 53 ---------------- .../tests/test_common_blob_async.py | 53 ---------------- .../tests/test_page_blob.py | 23 ------- .../tests/test_page_blob_async.py | 23 ------- .../azure-storage-blob/tests/test_retry.py | 60 ------------------- .../tests/test_retry_async.py | 60 ------------------- .../storage/filedatalake/_shared/policies.py | 11 +--- .../filedatalake/_shared/response_handlers.py | 21 +++---- .../storage/fileshare/_generated/_patch.py | 1 - .../fileshare/_generated/aio/_patch.py | 1 - .../_generated/models/_models_py3.py | 27 +-------- .../storage/fileshare/_shared/policies.py | 11 +--- .../fileshare/_shared/response_handlers.py | 21 +++---- .../tests/test_file.py | 44 -------------- .../tests/test_file_async.py | 51 ---------------- .../tests/test_share.py | 2 +- .../tests/test_share_async.py | 2 +- .../azure/storage/queue/_shared/policies.py | 11 +--- .../queue/_shared/response_handlers.py | 21 +++---- 40 files changed, 190 insertions(+), 868 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py index 17dbc073e01b..f99e77fef986 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py @@ -25,7 +25,6 @@ # # -------------------------------------------------------------------------- - # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py index 17dbc073e01b..f99e77fef986 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py @@ -25,7 +25,6 @@ # # -------------------------------------------------------------------------- - # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index 2840b96ee011..23e5744c8db7 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,10 +32,6 @@ build_seal_request, ) -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -124,7 +119,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +295,7 @@ async def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +484,7 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -651,7 +646,7 @@ async def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index f71ffebc37b5..910ebcb2358e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, Type, TypeVar, Union +from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -53,10 +52,6 @@ build_undelete_request, ) -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +132,7 @@ async def download( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +419,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -645,7 +640,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -736,7 +731,7 @@ async def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -814,7 +809,7 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -898,7 +893,7 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1025,7 +1020,7 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1106,7 +1101,7 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1176,7 +1171,7 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1271,7 +1266,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1404,7 +1399,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1506,7 +1501,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1606,7 +1601,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1712,7 +1707,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1820,7 +1815,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1935,7 +1930,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2102,7 +2097,7 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2284,7 +2279,7 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2425,7 +2420,7 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2537,7 +2532,7 @@ async def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2625,7 +2620,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2721,7 +2716,7 @@ async def query( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2967,7 +2962,7 @@ async def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3075,7 +3070,7 @@ async def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index 5123996799f5..6237bc20dc04 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -35,10 +34,6 @@ build_upload_request, ) -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -146,7 +141,7 @@ async def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -368,7 +363,7 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -560,7 +555,7 @@ async def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +706,7 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -895,7 +890,7 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1067,7 +1062,7 @@ async def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py index 9a5197df8829..8772e786345a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,10 +45,6 @@ build_submit_batch_request, ) -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -112,7 +107,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -199,7 +194,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -304,7 +299,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -402,7 +397,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +486,7 @@ async def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -592,7 +587,7 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -698,7 +693,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -781,7 +776,7 @@ async def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +857,7 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -969,7 +964,7 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1064,7 +1059,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1159,7 +1154,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1252,7 +1247,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1352,7 +1347,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1451,7 +1446,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1563,7 +1558,7 @@ async def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1675,7 +1670,7 @@ async def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1755,7 +1750,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index 45d5c64de5fb..854d58017352 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -38,10 +37,6 @@ build_upload_pages_request, ) -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -142,7 +137,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -322,7 +317,7 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,7 +485,7 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -668,7 +663,7 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -856,7 +851,7 @@ async def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1008,7 +1003,7 @@ async def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1131,7 +1126,7 @@ async def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1260,7 +1255,7 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1372,7 +1367,7 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index 7a3c62fec53d..eeb45644cdf2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -36,10 +35,6 @@ build_submit_batch_request, ) -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +84,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -164,7 +159,7 @@ async def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +234,7 @@ async def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +336,7 @@ async def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +418,7 @@ async def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -502,7 +497,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -584,7 +579,7 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,7 +685,7 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py index 4676b0eb1be4..cd88cb20487f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py @@ -2580,45 +2580,19 @@ class StorageError(_serialization.Model): :ivar message: :vartype message: str - :ivar copy_source_status_code: - :vartype copy_source_status_code: int - :ivar copy_source_error_code: - :vartype copy_source_error_code: str - :ivar copy_source_error_message: - :vartype copy_source_error_message: str """ _attribute_map = { "message": {"key": "Message", "type": "str"}, - "copy_source_status_code": {"key": "CopySourceStatusCode", "type": "int"}, - "copy_source_error_code": {"key": "CopySourceErrorCode", "type": "str"}, - "copy_source_error_message": {"key": "CopySourceErrorMessage", "type": "str"}, } - def __init__( - self, - *, - message: Optional[str] = None, - copy_source_status_code: Optional[int] = None, - copy_source_error_code: Optional[str] = None, - copy_source_error_message: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: :paramtype message: str - :keyword copy_source_status_code: - :paramtype copy_source_status_code: int - :keyword copy_source_error_code: - :paramtype copy_source_error_code: str - :keyword copy_source_error_message: - :paramtype copy_source_error_message: str """ super().__init__(**kwargs) self.message = message - self.copy_source_status_code = copy_source_status_code - self.copy_source_error_code = copy_source_error_code - self.copy_source_error_message = copy_source_error_message class StorageServiceProperties(_serialization.Model): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index f950ba4053bc..c412a42591ea 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -494,7 +489,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,7 +665,7 @@ def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -859,7 +854,7 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1021,7 +1016,7 @@ def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index 385821f836a3..b3eba6f4a8c1 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, Iterator, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Iterator, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1544,7 +1539,7 @@ def download( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1831,7 +1826,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2052,7 +2047,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2143,7 +2138,7 @@ def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2221,7 +2216,7 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2305,7 +2300,7 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2432,7 +2427,7 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2513,7 +2508,7 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2583,7 +2578,7 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2678,7 +2673,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2811,7 +2806,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2913,7 +2908,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3013,7 +3008,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3119,7 +3114,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3227,7 +3222,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3342,7 +3337,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3509,7 +3504,7 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3691,7 +3686,7 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3832,7 +3827,7 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3944,7 +3939,7 @@ def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4032,7 +4027,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4128,7 +4123,7 @@ def query( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4374,7 +4369,7 @@ def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4482,7 +4477,7 @@ def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index 0a3083b16a7b..35164fd08cb6 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -754,7 +749,7 @@ def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -976,7 +971,7 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1168,7 +1163,7 @@ def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1319,7 +1314,7 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1503,7 +1498,7 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1675,7 +1670,7 @@ def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py index 37fe1f75556b..b14eabb97e42 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -943,7 +938,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1030,7 +1025,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1135,7 +1130,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1233,7 +1228,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1322,7 +1317,7 @@ def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1423,7 +1418,7 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1529,7 +1524,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1612,7 +1607,7 @@ def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1693,7 +1688,7 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1800,7 +1795,7 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1895,7 +1890,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1990,7 +1985,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2083,7 +2078,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2183,7 +2178,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2282,7 +2277,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2394,7 +2389,7 @@ def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2506,7 +2501,7 @@ def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2586,7 +2581,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index e388063fc7fa..63d50d3331a3 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -7,8 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,10 +27,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -894,7 +889,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1074,7 +1069,7 @@ def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1242,7 +1237,7 @@ def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1420,7 +1415,7 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1608,7 +1603,7 @@ def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1760,7 +1755,7 @@ def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1883,7 +1878,7 @@ def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2012,7 +2007,7 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2124,7 +2119,7 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index 0d1bc1509661..9f2529836450 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -6,8 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,10 +26,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -397,7 +392,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +467,7 @@ def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -547,7 +542,7 @@ def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -649,7 +644,7 @@ def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +726,7 @@ def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -810,7 +805,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -892,7 +887,7 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -998,7 +993,7 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py index b2cd79e0b7e4..4596cb3d1b81 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode, StorageErrorCode +from .models import LocationMode try: _unicode_type = unicode # type: ignore @@ -88,15 +88,6 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True - if status >= 400: - error_code = response.http_response.headers.get('x-ms-copy-source-error-code') - retry_codes = [ - StorageErrorCode.OPERATION_TIMED_OUT, - StorageErrorCode.INTERNAL_ERROR, - StorageErrorCode.SERVER_BUSY - ] - if error_code in retry_codes: - return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py index dc84c2dbfb25..e6b653035835 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import Dict, NoReturn, Optional +from typing import NoReturn from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data: Dict[str, Optional[str]] = {} - error_dict: Dict[str, Optional[str]] = {} + additional_data = {} + error_dict = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag: child.text + child.tag.lower(): child.text for child in error_body } # If it is a JSON response @@ -118,14 +118,9 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - for k, v in error_dict.items(): - k_lower = k.lower() - if k_lower == 'code': - error_code = v - elif k_lower == 'message': - error_message = v - else: - additional_data[k] = v + error_code = error_dict.get('code') + error_message = error_dict.get('message') + additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} except DecodeError: pass diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob.py b/sdk/storage/azure-storage-blob/tests/test_append_blob.py index ecfe5bba2efe..6b309847b672 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob.py @@ -340,29 +340,6 @@ def test_append_block_from_url(self, **kwargs): destination_blob_client.append_block_from_url(source_blob_client.url + '?' + sas, source_length=LARGE_BLOB_SIZE) - @BlobPreparer() - @recorded_by_proxy - def test_append_blob_async_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), - credential=storage_account_key, - max_page_size=4 * 1024) - self._setup(bsc) - source_blob = self._create_blob(bsc) - dest_blob = self._create_blob(bsc) - - # Act - with pytest.raises(HttpResponseError) as e: - dest_blob.append_block_from_url(source_blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy def test_append_block_from_url_and_validate_content_md5(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py index 9ffc503069db..811c0cd2cda7 100644 --- a/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_append_blob_async.py @@ -328,29 +328,6 @@ async def test_append_block_from_url(self, **kwargs): await destination_blob_client.append_block_from_url(source_blob_client.url + '?' + sas, source_length=LARGE_BLOB_SIZE) - @BlobPreparer() - @recorded_by_proxy_async - async def test_append_blob_async_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), - credential=storage_account_key, - max_page_size=4 * 1024) - await self._setup(bsc) - source_blob = await self._create_blob(bsc) - dest_blob = await self._create_blob(bsc) - - # Act - with pytest.raises(HttpResponseError) as e: - await dest_blob.append_block_from_url(source_blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy_async async def test_append_block_from_url_and_validate_content_md5(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob.py b/sdk/storage/azure-storage-blob/tests/test_block_blob.py index 60faee7b7403..0db4213f78df 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob.py @@ -499,27 +499,6 @@ def test_put_block(self, **kwargs): # Assert - @BlobPreparer() - @recorded_by_proxy - def test_upload_blob_from_url_sync_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - - # Act - with pytest.raises(HttpResponseError) as e: - target_blob.upload_blob_from_url(source_blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy def test_put_block_with_response(self, **kwargs): @@ -645,32 +624,6 @@ def test_put_block_with_immutability_policy(self, **kwargs): return variables - @BlobPreparer() - @recorded_by_proxy - def test_stage_block_from_url_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - split = 4 * 1024 - - # Act - with pytest.raises(HttpResponseError) as e: - target_blob.stage_block_from_url( - block_id=1, - source_url=source_blob.url, - source_offset=0, - source_length=split) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy def test_put_block_list_invalid_block_id(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py index 503d253bbd0e..2002a7188a67 100644 --- a/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_block_blob_async.py @@ -509,27 +509,6 @@ async def test_upload_blob_from_url_source_and_destination_properties(self, **kw assert new_blob_copy1_props.tag_count is None assert new_blob_copy2_props.tag_count is None - @BlobPreparer() - @recorded_by_proxy_async - async def test_upload_blob_from_url_sync_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - await self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - - # Act - with pytest.raises(HttpResponseError) as e: - await target_blob.upload_blob_from_url(source_blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy_async async def test_put_block(self, **kwargs): @@ -597,32 +576,6 @@ async def test_put_block_from_url_and_commit(self, **kwargs): assert len(uncommitted) == 0 assert len(committed) == 2 - @BlobPreparer() - @recorded_by_proxy_async - async def test_stage_block_from_url_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - await self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - split = 4 * 1024 - - # Act - with pytest.raises(HttpResponseError) as e: - await target_blob.stage_block_from_url( - block_id=1, - source_url=source_blob.url, - source_offset=0, - source_length=split) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy_async async def test_put_block_with_response(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py index 1b504a0db53a..a19f8b003b78 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -1693,59 +1693,6 @@ def test_abort_copy_blob_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' - @BlobPreparer() - @recorded_by_proxy - def test_copy_blob_async_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - - sas_token = self.generate_sas( - generate_blob_sas, - source_blob.account_name, - source_blob.container_name, - source_blob.blob_name, - account_key=source_blob.credential.account_key, - permission=BlobSasPermissions(read=True), - expiry=datetime.utcnow() + timedelta(hours=1), - ) - blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) - - # Act - with pytest.raises(HttpResponseError) as e: - target_blob.start_copy_from_url(blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-error-code"] == "BlobNotFound" - assert e.value.response.headers["x-ms-copy-source-status-code"] == "404" - - @BlobPreparer() - @recorded_by_proxy - def test_copy_blob_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - - # Act - with pytest.raises(HttpResponseError) as e: - target_blob.start_copy_from_url(source_blob.url, requires_sync=True) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy def test_snapshot_blob(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py index 0434009b686a..9c1f4c2f0464 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py @@ -1907,59 +1907,6 @@ async def test_abort_copy_blob_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' - @BlobPreparer() - @recorded_by_proxy_async - async def test_copy_blob_async_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - await self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - - sas_token = self.generate_sas( - generate_blob_sas, - source_blob.account_name, - source_blob.container_name, - source_blob.blob_name, - account_key=source_blob.credential.account_key, - permission=BlobSasPermissions(read=True), - expiry=datetime.utcnow() + timedelta(hours=1), - ) - blob = BlobClient.from_blob_url(source_blob.url, credential=sas_token) - - # Act - with pytest.raises(HttpResponseError) as e: - await target_blob.start_copy_from_url(blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-error-code"] == "BlobNotFound" - assert e.value.response.headers["x-ms-copy-source-status-code"] == "404" - - @BlobPreparer() - @recorded_by_proxy_async - async def test_copy_blob_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - await self._setup(storage_account_name, storage_account_key) - source_blob_name = "sourceblob" - source_blob = self.bsc.get_blob_client(self.container_name, source_blob_name) - target_blob_name = "targetblob" - target_blob = self.bsc.get_blob_client(self.container_name, target_blob_name) - - # Act - with pytest.raises(HttpResponseError) as e: - await target_blob.start_copy_from_url(source_blob.url, requires_sync=True) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy_async async def test_snapshot_blob(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob.py b/sdk/storage/azure-storage-blob/tests/test_page_blob.py index b03965677a3a..beb40b426064 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob.py @@ -577,29 +577,6 @@ def test_upload_pages_from_url(self, **kwargs): assert blob_properties.get('etag') == source_with_special_chars_resp.get('etag') assert blob_properties.get('last_modified') == source_with_special_chars_resp.get('last_modified') - @BlobPreparer() - @recorded_by_proxy - def test_upload_pages_from_url_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), - credential=storage_account_key, - max_page_size=4 * 1024) - self._setup(bsc) - source_blob = self._create_blob(bsc) - dest_blob = self._create_blob(bsc) - - # Act - with pytest.raises(HttpResponseError) as e: - dest_blob.upload_blob_from_url(source_blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy def test_upload_pages_from_url_with_oauth(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py index cfc831f7f55c..27bc668bcf69 100644 --- a/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_page_blob_async.py @@ -564,29 +564,6 @@ async def test_upload_pages_from_url(self, **kwargs): assert blob_properties.get('etag') == resp.get('etag') assert blob_properties.get('last_modified') == resp.get('last_modified') - @BlobPreparer() - @recorded_by_proxy_async - async def test_upload_pages_from_url_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - # Arrange - bsc = BlobServiceClient( - self.account_url(storage_account_name, "blob"), - credential=storage_account_key, - max_page_size=4 * 1024) - await self._setup(bsc) - source_blob = await self._create_blob(bsc) - dest_blob = await self._create_blob(bsc) - - # Act - with pytest.raises(HttpResponseError) as e: - await dest_blob.upload_blob_from_url(source_blob.url) - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "409" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "PublicAccessNotPermitted" - @BlobPreparer() @recorded_by_proxy_async async def test_upload_pages_from_url_and_validate_content_md5(self, **kwargs): diff --git a/sdk/storage/azure-storage-blob/tests/test_retry.py b/sdk/storage/azure-storage-blob/tests/test_retry.py index c91e2365ab4c..489f823d9197 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry.py @@ -21,7 +21,6 @@ LinearRetry, LocationMode ) -from azure.storage.blob._shared.models import StorageErrorCode from requests import Response from requests.exceptions import ContentDecodingError, ChunkedEncodingError, ReadTimeout @@ -551,63 +550,4 @@ def test_streaming_retry(self, **kwargs): blob.download_blob() assert iterator_mock.__next__.call_count == count[0] == 3 - @BlobPreparer() - @recorded_by_proxy - def test_retry_on_copy_source_error(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - """Test that retry on timeout, server error, server busy if surfaced from x-ms-copy-source-status-code.""" - # Arrange - container_name = self.get_resource_name('utcontainer') - retry = LinearRetry(backoff=1, retry_total=3) - retry_counter = RetryCounter() - service = self._create_storage_service( - BlobServiceClient, - storage_account_name, - storage_account_key, - retry_policy=retry) - - def response_handler(raw_response): - if retry_counter.count == 0: - raw_response.http_response.status_code = 400 - raw_response.http_response.headers['x-ms-copy-source-status-code'] = '408' - raw_response.http_response.headers['x-ms-copy-source-error-code'] = ( - StorageErrorCode.OPERATION_TIMED_OUT) - elif retry_counter.count == 1: - raw_response.http_response.status_code = 400 - raw_response.http_response.headers['x-ms-copy-source-status-code'] = '500' - raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.INTERNAL_ERROR - elif retry_counter.count == 2: - raw_response.http_response.status_code = 400 - raw_response.http_response.headers['x-ms-copy-source-status-code'] = '503' - raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.SERVER_BUSY - - def assert_exception_is_present_on_retry_context(**kwargs): - assert kwargs.get('response') is not None - if retry_counter.count == 0: - assert kwargs['response'].status_code == 400 - assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '408' - assert kwargs['response'].headers['x-ms-copy-source-error-code'] == ( - StorageErrorCode.OPERATION_TIMED_OUT) - elif retry_counter.count == 1: - assert kwargs['response'].status_code == 400 - assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '500' - assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.INTERNAL_ERROR - elif retry_counter.count == 2: - assert kwargs['response'].status_code == 400 - assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '503' - assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.SERVER_BUSY - retry_counter.simple_count(retry) - - # Act - with pytest.raises(HttpResponseError): - service.create_container( - container_name, - raw_response_hook=response_handler, - retry_hook=assert_exception_is_present_on_retry_context) - - # Assert - assert retry_counter.count == 3 - # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_retry_async.py b/sdk/storage/azure-storage-blob/tests/test_retry_async.py index 371bba0d4dfb..f19e092d6956 100644 --- a/sdk/storage/azure-storage-blob/tests/test_retry_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_retry_async.py @@ -20,7 +20,6 @@ from azure.core.pipeline.transport import AioHttpTransport from azure.storage.blob import LocationMode from azure.storage.blob._shared.policies_async import ExponentialRetry, LinearRetry -from azure.storage.blob._shared.models import StorageErrorCode from azure.storage.blob.aio import BlobServiceClient from devtools_testutils import ResponseCallback, RetryCounter @@ -530,63 +529,4 @@ async def test_streaming_retry(self, **kwargs): await blob.download_blob() assert stream_reader_read_mock.call_count == count[0] == 4 - @BlobPreparer() - @recorded_by_proxy_async - async def test_retry_on_copy_source_error(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - """Test that retry on timeout, server error, server busy if surfaced from x-ms-copy-source-status-code.""" - # Arrange - container_name = self.get_resource_name('utcontainer') - retry = LinearRetry(backoff=1, retry_total=3) - retry_counter = RetryCounter() - service = self._create_storage_service( - BlobServiceClient, - storage_account_name, - storage_account_key, - retry_policy=retry) - - def response_handler(raw_response): - if retry_counter.count == 0: - raw_response.http_response.status_code = 400 - raw_response.http_response.headers['x-ms-copy-source-status-code'] = '408' - raw_response.http_response.headers['x-ms-copy-source-error-code'] = ( - StorageErrorCode.OPERATION_TIMED_OUT) - elif retry_counter.count == 1: - raw_response.http_response.status_code = 400 - raw_response.http_response.headers['x-ms-copy-source-status-code'] = '500' - raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.INTERNAL_ERROR - elif retry_counter.count == 2: - raw_response.http_response.status_code = 400 - raw_response.http_response.headers['x-ms-copy-source-status-code'] = '503' - raw_response.http_response.headers['x-ms-copy-source-error-code'] = StorageErrorCode.SERVER_BUSY - - def assert_exception_is_present_on_retry_context(**kwargs): - assert kwargs.get('response') is not None - if retry_counter.count == 0: - assert kwargs['response'].status_code == 400 - assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '408' - assert kwargs['response'].headers['x-ms-copy-source-error-code'] == ( - StorageErrorCode.OPERATION_TIMED_OUT) - elif retry_counter.count == 1: - assert kwargs['response'].status_code == 400 - assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '500' - assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.INTERNAL_ERROR - elif retry_counter.count == 2: - assert kwargs['response'].status_code == 400 - assert kwargs['response'].headers['x-ms-copy-source-status-code'] == '503' - assert kwargs['response'].headers['x-ms-copy-source-error-code'] == StorageErrorCode.SERVER_BUSY - retry_counter.simple_count(retry) - - # Act - with pytest.raises(HttpResponseError): - await service.create_container( - container_name, - raw_response_hook=response_handler, - retry_hook=assert_exception_is_present_on_retry_context) - - # Assert - assert retry_counter.count == 3 - # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py index 7f8caabbb710..4abfc9163a84 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode, StorageErrorCode +from .models import LocationMode try: _unicode_type = unicode # type: ignore @@ -88,15 +88,6 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True - if status >= 400: - error_code = response.http_response.headers.get('x-ms-copy-source-error-code') - retry_codes = [ - StorageErrorCode.OPERATION_TIMED_OUT, - StorageErrorCode.INTERNAL_ERROR, - StorageErrorCode.SERVER_BUSY - ] - if error_code in retry_codes: - return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py index dc84c2dbfb25..e6b653035835 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import Dict, NoReturn, Optional +from typing import NoReturn from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data: Dict[str, Optional[str]] = {} - error_dict: Dict[str, Optional[str]] = {} + additional_data = {} + error_dict = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag: child.text + child.tag.lower(): child.text for child in error_body } # If it is a JSON response @@ -118,14 +118,9 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - for k, v in error_dict.items(): - k_lower = k.lower() - if k_lower == 'code': - error_code = v - elif k_lower == 'message': - error_message = v - else: - additional_data[k] = v + error_code = error_dict.get('code') + error_message = error_dict.get('message') + additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} except DecodeError: pass diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py index d3be7c117232..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py @@ -25,7 +25,6 @@ # # -------------------------------------------------------------------------- - # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py index d3be7c117232..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py @@ -25,7 +25,6 @@ # # -------------------------------------------------------------------------- - # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 0730e6732024..7f283d0dadcf 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -1550,51 +1550,26 @@ class StorageError(_serialization.Model): :ivar message: :vartype message: str - :ivar copy_source_status_code: - :vartype copy_source_status_code: int - :ivar copy_source_error_code: - :vartype copy_source_error_code: str - :ivar copy_source_error_message: - :vartype copy_source_error_message: str :ivar authentication_error_detail: :vartype authentication_error_detail: str """ _attribute_map = { "message": {"key": "Message", "type": "str"}, - "copy_source_status_code": {"key": "CopySourceStatusCode", "type": "int"}, - "copy_source_error_code": {"key": "CopySourceErrorCode", "type": "str"}, - "copy_source_error_message": {"key": "CopySourceErrorMessage", "type": "str"}, "authentication_error_detail": {"key": "AuthenticationErrorDetail", "type": "str"}, } def __init__( - self, - *, - message: Optional[str] = None, - copy_source_status_code: Optional[int] = None, - copy_source_error_code: Optional[str] = None, - copy_source_error_message: Optional[str] = None, - authentication_error_detail: Optional[str] = None, - **kwargs: Any + self, *, message: Optional[str] = None, authentication_error_detail: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword message: :paramtype message: str - :keyword copy_source_status_code: - :paramtype copy_source_status_code: int - :keyword copy_source_error_code: - :paramtype copy_source_error_code: str - :keyword copy_source_error_message: - :paramtype copy_source_error_message: str :keyword authentication_error_detail: :paramtype authentication_error_detail: str """ super().__init__(**kwargs) self.message = message - self.copy_source_status_code = copy_source_status_code - self.copy_source_error_code = copy_source_error_code - self.copy_source_error_message = copy_source_error_message self.authentication_error_detail = authentication_error_detail diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py index 705b1cd73f90..82a9f9e8f2ba 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode, StorageErrorCode +from .models import LocationMode try: _unicode_type = unicode # type: ignore @@ -88,15 +88,6 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True - if status >= 400: - error_code = response.http_response.headers.get('x-ms-copy-source-error-code') - retry_codes = [ - StorageErrorCode.OPERATION_TIMED_OUT, - StorageErrorCode.INTERNAL_ERROR, - StorageErrorCode.SERVER_BUSY - ] - if error_code in retry_codes: - return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py index dc84c2dbfb25..e6b653035835 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import Dict, NoReturn, Optional +from typing import NoReturn from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data: Dict[str, Optional[str]] = {} - error_dict: Dict[str, Optional[str]] = {} + additional_data = {} + error_dict = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag: child.text + child.tag.lower(): child.text for child in error_body } # If it is a JSON response @@ -118,14 +118,9 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - for k, v in error_dict.items(): - k_lower = k.lower() - if k_lower == 'code': - error_code = v - elif k_lower == 'message': - error_message = v - else: - additional_data[k] = v + error_code = error_dict.get('code') + error_message = error_dict.get('message') + additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} except DecodeError: pass diff --git a/sdk/storage/azure-storage-file-share/tests/test_file.py b/sdk/storage/azure-storage-file-share/tests/test_file.py index 1258357bd687..7f1258ef2c05 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file.py @@ -1566,28 +1566,6 @@ def test_update_range_from_file_url_with_oauth(self, **kwargs): destination_file_client.upload_range_from_url(source_blob_client.url, offset=0, length=512, source_offset=0, source_authorization=token) - @FileSharePreparer() - @recorded_by_proxy - def test_update_range_from_file_url_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - self._setup(storage_account_name, storage_account_key) - source_file_name = 'testfile' - source_file_client = self._create_file(file_name=source_file_name) - data = b'abcdefghijklmnop' * 32 - source_file_client.upload_range(data, offset=0, length=512) - - destination_file_name = 'filetoupdate' - destination_file_client = self._create_empty_file(file_name=destination_file_name) - - with pytest.raises(HttpResponseError) as e: - destination_file_client.upload_range_from_url( - source_file_client.url, offset=0, length=512, source_offset=0) - - assert e.value.response.headers["x-ms-copy-source-status-code"] == "401" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "NoAuthenticationInformation" - @FileSharePreparer() @recorded_by_proxy def test_update_range_from_file_url_with_lease(self, **kwargs): @@ -2606,28 +2584,6 @@ def test_abort_copy_file_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' - @FileSharePreparer() - @recorded_by_proxy - def test_copy_file_async_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - self._setup(storage_account_name, storage_account_key) - - # Act - file_client = ShareFileClient( - self.account_url(storage_account_name, "file"), - share_name=self.share_name, - file_path="targetfile", - credential=storage_account_key) - - with pytest.raises(ResourceNotFoundError) as e: - file_client.start_copy_from_url("https://error.file.core.windows.net/") - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "400" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "InvalidQueryParameterValue" - @FileSharePreparer() @recorded_by_proxy def test_unicode_get_file_unicode_name(self, **kwargs): diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_async.py index 373d78906b10..6be9c5d2c8bb 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_file_async.py @@ -1597,34 +1597,6 @@ async def test_update_range_from_file_url_with_oauth(self, **kwargs): await destination_file_client.upload_range_from_url( source_blob_client.url, offset=0, length=512, source_offset=0, source_authorization=token) - @FileSharePreparer() - @recorded_by_proxy_async - async def test_update_range_from_file_url_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - self._setup(storage_account_name, storage_account_key) - source_file_name = 'testfile' - source_file_client = await self._create_file( - storage_account_name, - storage_account_key, - file_name=source_file_name) - data = b'abcdefghijklmnop' * 32 - await source_file_client.upload_range(data, offset=0, length=512) - - destination_file_name = 'filetoupdate' - destination_file_client = await self._create_empty_file( - storage_account_name, - storage_account_key, - file_name=destination_file_name) - - with pytest.raises(HttpResponseError) as e: - await destination_file_client.upload_range_from_url( - source_file_client.url, offset=0, length=512, source_offset=0) - - assert e.value.response.headers["x-ms-copy-source-status-code"] == "401" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "NoAuthenticationInformation" - @FileSharePreparer() @recorded_by_proxy_async async def test_update_range_from_file_url_with_lease(self, **kwargs): @@ -2664,29 +2636,6 @@ async def test_abort_copy_file_with_synchronous_copy_fails(self, **kwargs): # Assert assert copy_resp['copy_status'] == 'success' - @FileSharePreparer() - @recorded_by_proxy_async - async def test_copy_file_async_copy_source_error_and_status_code(self, **kwargs): - storage_account_name = kwargs.pop("storage_account_name") - storage_account_key = kwargs.pop("storage_account_key") - - self._setup(storage_account_name, storage_account_key) - await self._setup_share(storage_account_name, storage_account_key) - - # Act - file_client = ShareFileClient( - self.account_url(storage_account_name, "file"), - share_name=self.share_name, - file_path="targetfile", - credential=storage_account_key) - - with pytest.raises(ResourceNotFoundError) as e: - await file_client.start_copy_from_url("https://error.file.core.windows.net/") - - # Assert - assert e.value.response.headers["x-ms-copy-source-status-code"] == "400" - assert e.value.response.headers["x-ms-copy-source-error-code"] == "InvalidQueryParameterValue" - @FileSharePreparer() @recorded_by_proxy_async async def test_unicode_get_file_unicode_name(self, **kwargs): diff --git a/sdk/storage/azure-storage-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py index 335185e62b97..185d61f23d62 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share.py @@ -1001,7 +1001,7 @@ def test_list_shares_account_sas_fails(self, **kwargs): # Assert assert e.value.error_code == StorageErrorCode.AUTHENTICATION_FAILED - assert "AuthenticationErrorDetail" in e.value.message + assert "authenticationerrordetail" in e.value.message @FileSharePreparer() @recorded_by_proxy diff --git a/sdk/storage/azure-storage-file-share/tests/test_share_async.py b/sdk/storage/azure-storage-file-share/tests/test_share_async.py index 3691ab2e7ec6..2d12b853ab52 100644 --- a/sdk/storage/azure-storage-file-share/tests/test_share_async.py +++ b/sdk/storage/azure-storage-file-share/tests/test_share_async.py @@ -1018,7 +1018,7 @@ async def test_list_shares_account_sas_fails(self, **kwargs): # Assert assert e.value.error_code == StorageErrorCode.AUTHENTICATION_FAILED - assert "AuthenticationErrorDetail" in e.value.message + assert "authenticationerrordetail" in e.value.message @FileSharePreparer() diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py index 5df16ac02e86..256da7bed4d9 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies.py @@ -33,7 +33,7 @@ from .authentication import StorageHttpChallenge from .constants import DEFAULT_OAUTH_SCOPE -from .models import LocationMode, StorageErrorCode +from .models import LocationMode try: _unicode_type = unicode # type: ignore @@ -88,15 +88,6 @@ def is_retry(response, mode): # pylint: disable=too-many-return-statements if status == 408: # Response code 408 is a timeout and should be retried. return True - if status >= 400: - error_code = response.http_response.headers.get('x-ms-copy-source-error-code') - retry_codes = [ - StorageErrorCode.OPERATION_TIMED_OUT, - StorageErrorCode.INTERNAL_ERROR, - StorageErrorCode.SERVER_BUSY - ] - if error_code in retry_codes: - return True return False if status >= 500: # Response codes above 500 with the exception of 501 Not Implemented and diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py index dc84c2dbfb25..e6b653035835 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_shared/response_handlers.py @@ -4,7 +4,7 @@ # license information. # -------------------------------------------------------------------------- import logging -from typing import Dict, NoReturn, Optional +from typing import NoReturn from xml.etree.ElementTree import Element from azure.core.exceptions import ( @@ -81,7 +81,7 @@ def return_raw_deserialized(response, *_): return response.http_response.location_mode, response.context[ContentDecodePolicy.CONTEXT_NAME] -def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements, too-many-branches +def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # pylint:disable=too-many-statements raise_error = HttpResponseError serialized = False if not storage_error.response or storage_error.response.status_code in [200, 204]: @@ -92,8 +92,8 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py serialized = True error_code = storage_error.response.headers.get('x-ms-error-code') error_message = storage_error.message - additional_data: Dict[str, Optional[str]] = {} - error_dict: Dict[str, Optional[str]] = {} + additional_data = {} + error_dict = {} try: error_body = ContentDecodePolicy.deserialize_from_http_generics(storage_error.response) try: @@ -104,7 +104,7 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If it is an XML response if isinstance(error_body, Element): error_dict = { - child.tag: child.text + child.tag.lower(): child.text for child in error_body } # If it is a JSON response @@ -118,14 +118,9 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # py # If we extracted from a Json or XML response # There is a chance error_dict is just a string if error_dict and isinstance(error_dict, dict): - for k, v in error_dict.items(): - k_lower = k.lower() - if k_lower == 'code': - error_code = v - elif k_lower == 'message': - error_message = v - else: - additional_data[k] = v + error_code = error_dict.get('code') + error_message = error_dict.get('message') + additional_data = {k: v for k, v in error_dict.items() if k not in {'code', 'message'}} except DecodeError: pass From 0023a9aa38911795419a0a9b9980d470c381732b Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 4 Jun 2024 14:01:22 -0700 Subject: [PATCH 08/13] Generate against newest swaggers, move to newest swagger stable --- .../azure/storage/blob/_generated/_patch.py | 2 + .../storage/blob/_generated/_serialization.py | 2 +- .../storage/blob/_generated/aio/_patch.py | 2 + .../aio/operations/_append_blob_operations.py | 17 ++++-- .../aio/operations/_blob_operations.py | 57 ++++++++++--------- .../aio/operations/_block_blob_operations.py | 25 ++++---- .../aio/operations/_container_operations.py | 43 +++++++------- .../aio/operations/_page_blob_operations.py | 27 +++++---- .../blob/_generated/aio/operations/_patch.py | 2 + .../aio/operations/_service_operations.py | 23 +++++--- .../storage/blob/_generated/models/_patch.py | 2 + .../operations/_append_blob_operations.py | 17 ++++-- .../_generated/operations/_blob_operations.py | 57 ++++++++++--------- .../operations/_block_blob_operations.py | 25 ++++---- .../operations/_container_operations.py | 43 +++++++------- .../operations/_page_blob_operations.py | 27 +++++---- .../blob/_generated/operations/_patch.py | 2 + .../operations/_service_operations.py | 23 +++++--- .../azure-storage-blob/swagger/README.md | 2 +- .../storage/filedatalake/_generated/_patch.py | 2 + .../filedatalake/_generated/_serialization.py | 2 +- .../filedatalake/_generated/aio/_patch.py | 2 + .../aio/operations/_file_system_operations.py | 19 ++++--- .../_generated/aio/operations/_patch.py | 2 + .../aio/operations/_path_operations.py | 35 +++++++----- .../aio/operations/_service_operations.py | 9 ++- .../filedatalake/_generated/models/_patch.py | 2 + .../operations/_file_system_operations.py | 19 ++++--- .../_generated/operations/_patch.py | 2 + .../_generated/operations/_path_operations.py | 35 +++++++----- .../operations/_service_operations.py | 9 ++- .../swagger/README.md | 2 +- .../fileshare/_generated/_serialization.py | 2 +- .../aio/operations/_file_operations.py | 4 +- .../_generated/aio/operations/_patch.py | 1 + .../aio/operations/_share_operations.py | 11 ---- .../_generated/models/_models_py3.py | 17 +----- .../fileshare/_generated/models/_patch.py | 1 + .../_generated/operations/_file_operations.py | 4 +- .../fileshare/_generated/operations/_patch.py | 1 + .../operations/_share_operations.py | 21 ------- .../swagger/README.md | 2 +- .../azure/storage/queue/_generated/_patch.py | 2 + .../queue/_generated/_serialization.py | 2 +- .../storage/queue/_generated/aio/_patch.py | 2 + .../aio/operations/_message_id_operations.py | 11 +++- .../aio/operations/_messages_operations.py | 15 +++-- .../queue/_generated/aio/operations/_patch.py | 1 + .../aio/operations/_queue_operations.py | 19 ++++--- .../aio/operations/_service_operations.py | 15 +++-- .../storage/queue/_generated/models/_patch.py | 1 + .../operations/_message_id_operations.py | 11 +++- .../operations/_messages_operations.py | 15 +++-- .../queue/_generated/operations/_patch.py | 1 + .../operations/_queue_operations.py | 19 ++++--- .../operations/_service_operations.py | 15 +++-- .../azure-storage-queue/swagger/README.md | 2 +- 57 files changed, 423 insertions(+), 310 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py index f99e77fef986..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py @@ -27,5 +27,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py index 2f781d740827..f0c6180722c8 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_serialization.py @@ -1441,7 +1441,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py index f99e77fef986..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py @@ -27,5 +27,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index 23e5744c8db7..ad079981e434 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,10 @@ build_seal_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -119,7 +124,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -151,10 +156,10 @@ async def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -295,7 +300,7 @@ async def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -484,7 +489,7 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,7 +651,7 @@ async def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 910ebcb2358e..6d58684426d2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -52,6 +53,10 @@ build_undelete_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -132,7 +137,7 @@ async def download( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +424,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -640,7 +645,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +736,7 @@ async def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +814,7 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -893,7 +898,7 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -921,10 +926,10 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements _blob_content_disposition = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1020,7 +1025,7 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1101,7 +1106,7 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1171,7 +1176,7 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1266,7 +1271,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1399,7 +1404,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1501,7 +1506,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1601,7 +1606,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1707,7 +1712,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1815,7 +1820,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1930,7 +1935,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2097,7 +2102,7 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2279,7 +2284,7 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2420,7 +2425,7 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2532,7 +2537,7 @@ async def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2620,7 +2625,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2716,7 +2721,7 @@ async def query( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2962,7 +2967,7 @@ async def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3070,7 +3075,7 @@ async def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index 6237bc20dc04..1c9ec3aa5e31 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -34,6 +35,10 @@ build_upload_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -141,7 +146,7 @@ async def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,10 +179,10 @@ async def upload( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -363,7 +368,7 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,10 +405,10 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements _source_if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -555,7 +560,7 @@ async def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -706,7 +711,7 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -890,7 +895,7 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -923,10 +928,10 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1062,7 +1067,7 @@ async def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py index 8772e786345a..9a5197df8829 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -45,6 +46,10 @@ build_submit_batch_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -107,7 +112,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +199,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +304,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -397,7 +402,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -486,7 +491,7 @@ async def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -587,7 +592,7 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -693,7 +698,7 @@ async def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -776,7 +781,7 @@ async def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +862,7 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -964,7 +969,7 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1059,7 +1064,7 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1154,7 +1159,7 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1247,7 +1252,7 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1347,7 +1352,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1446,7 +1451,7 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1558,7 +1563,7 @@ async def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1670,7 +1675,7 @@ async def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1750,7 +1755,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index 854d58017352..b31da275846b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -37,6 +38,10 @@ build_upload_pages_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +142,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,10 +174,10 @@ async def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -317,7 +322,7 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +490,7 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -663,7 +668,7 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -851,7 +856,7 @@ async def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1003,7 +1008,7 @@ async def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1126,7 +1131,7 @@ async def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1255,7 +1260,7 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1367,7 +1372,7 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py index 029b47fe4787..18451f8af59a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -10,6 +11,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import List __all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index eeb45644cdf2..7a3c62fec53d 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -35,6 +36,10 @@ build_submit_batch_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -159,7 +164,7 @@ async def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -234,7 +239,7 @@ async def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,7 +341,7 @@ async def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +423,7 @@ async def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +502,7 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,7 +584,7 @@ async def submit_batch( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -685,7 +690,7 @@ async def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py index 029b47fe4787..18451f8af59a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -10,6 +11,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import List __all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index c412a42591ea..587ede879a4c 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -489,7 +494,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,10 +526,10 @@ def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -665,7 +670,7 @@ def append_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -854,7 +859,7 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1016,7 +1021,7 @@ def seal( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index b3eba6f4a8c1..422cf59b5a48 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Iterator, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, Iterator, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1539,7 +1544,7 @@ def download( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1826,7 +1831,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2047,7 +2052,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2138,7 +2143,7 @@ def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2216,7 +2221,7 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2300,7 +2305,7 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2328,10 +2333,10 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements _blob_content_disposition = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -2427,7 +2432,7 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2508,7 +2513,7 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2578,7 +2583,7 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2673,7 +2678,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2806,7 +2811,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2908,7 +2913,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3008,7 +3013,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3114,7 +3119,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3222,7 +3227,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3337,7 +3342,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3504,7 +3509,7 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3686,7 +3691,7 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3827,7 +3832,7 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3939,7 +3944,7 @@ def set_tier( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4027,7 +4032,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4123,7 +4128,7 @@ def query( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4369,7 +4374,7 @@ def get_tags( :rtype: ~azure.storage.blob.models.BlobTags :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4477,7 +4482,7 @@ def set_tags( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index 35164fd08cb6..f811a7052493 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -749,7 +754,7 @@ def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,10 +787,10 @@ def upload( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -971,7 +976,7 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1008,10 +1013,10 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements _source_if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1163,7 +1168,7 @@ def stage_block( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,7 +1319,7 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1498,7 +1503,7 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1531,10 +1536,10 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1670,7 +1675,7 @@ def get_block_list( :rtype: ~azure.storage.blob.models.BlockList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py index b14eabb97e42..37fe1f75556b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -938,7 +943,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1025,7 +1030,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1130,7 +1135,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1233,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1317,7 +1322,7 @@ def get_access_policy( :rtype: list[~azure.storage.blob.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1418,7 +1423,7 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1524,7 +1529,7 @@ def restore( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1607,7 +1612,7 @@ def rename( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1688,7 +1693,7 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1795,7 +1800,7 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1890,7 +1895,7 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1985,7 +1990,7 @@ def release_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2078,7 +2083,7 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2178,7 +2183,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2277,7 +2282,7 @@ def change_lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2389,7 +2394,7 @@ def list_blob_flat_segment( :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2501,7 +2506,7 @@ def list_blob_hierarchy_segment( :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2581,7 +2586,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index 63d50d3331a3..acd82c2bebd2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -889,7 +894,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -921,10 +926,10 @@ def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control + _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1069,7 +1074,7 @@ def upload_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1237,7 +1242,7 @@ def clear_pages( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1415,7 +1420,7 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1603,7 +1608,7 @@ def get_page_ranges( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1755,7 +1760,7 @@ def get_page_ranges_diff( :rtype: ~azure.storage.blob.models.PageList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1878,7 +1883,7 @@ def resize( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2007,7 +2012,7 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2119,7 +2124,7 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py index 029b47fe4787..18451f8af59a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -10,6 +11,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import List __all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index 9f2529836450..0d1bc1509661 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -392,7 +397,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,7 +472,7 @@ def get_properties( :rtype: ~azure.storage.blob.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -542,7 +547,7 @@ def get_statistics( :rtype: ~azure.storage.blob.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -644,7 +649,7 @@ def list_containers_segment( :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -726,7 +731,7 @@ def get_user_delegation_key( :rtype: ~azure.storage.blob.models.UserDelegationKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -805,7 +810,7 @@ def get_account_info( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -887,7 +892,7 @@ def submit_batch( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +998,7 @@ def filter_blobs( :rtype: ~azure.storage.blob.models.FilterBlobSegment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 5387db1bc35e..1234593ea121 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json +input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json output-folder: ../azure/storage/blob/_generated namespace: azure.storage.blob no-namespace-folders: true diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py index f99e77fef986..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py @@ -27,5 +27,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_serialization.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_serialization.py index 2f781d740827..f0c6180722c8 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_serialization.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_serialization.py @@ -1441,7 +1441,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py index f99e77fef986..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py @@ -27,5 +27,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py index 0f0c26bcd466..f5c11c835fb5 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_set_properties_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +96,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +186,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,7 +263,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,7 +349,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +453,7 @@ async def list_paths( :rtype: ~azure.storage.filedatalake.models.PathList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -558,7 +563,7 @@ async def list_blob_hierarchy_segment( :rtype: ~azure.storage.filedatalake.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py index 029b47fe4787..18451f8af59a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -10,6 +11,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import List __all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py index 2f381a613a95..625135b3fa45 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterator, Callable, Dict, IO, Literal, Optional, TypeVar, Union +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -39,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -193,7 +198,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -460,7 +465,7 @@ async def update( :rtype: ~azure.storage.filedatalake.models.SetAccessControlRecursiveResponse or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,10 +492,10 @@ async def update( _if_unmodified_since = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control + _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -641,7 +646,7 @@ async def lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +779,7 @@ async def read( :rtype: AsyncIterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -966,7 +971,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1099,7 +1104,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1220,7 +1225,7 @@ async def set_access_control( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1346,7 +1351,7 @@ async def set_access_control_recursive( :rtype: ~azure.storage.filedatalake.models.SetAccessControlRecursiveResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1491,7 +1496,7 @@ async def flush_data( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1521,10 +1526,10 @@ async def flush_data( # pylint: disable=inconsistent-return-statements _encryption_algorithm = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control + _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1676,7 +1681,7 @@ async def append_data( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1796,7 +1801,7 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1875,7 +1880,7 @@ async def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py index 5b2e09fddb33..57032bf8b7dc 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._service_operations import build_list_file_systems_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -96,7 +101,7 @@ def list_file_systems( resource: Literal["account"] = kwargs.pop("resource", _params.pop("resource", "account")) cls: ClsType[_models.FileSystemList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py index 029b47fe4787..18451f8af59a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -10,6 +11,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import List __all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py index dd568262d1c4..69efc186e612 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -352,7 +357,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -442,7 +447,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -519,7 +524,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -605,7 +610,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -709,7 +714,7 @@ def list_paths( :rtype: ~azure.storage.filedatalake.models.PathList :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -819,7 +824,7 @@ def list_blob_hierarchy_segment( :rtype: ~azure.storage.filedatalake.models.ListBlobsHierarchySegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py index 029b47fe4787..18451f8af59a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize @@ -10,6 +11,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import List __all__ = [] # type: List[str] # Add all objects you want publicly available to users at this package level diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py index 5ec9f4fea9f4..6f706eaa5791 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, IO, Iterator, Literal, Optional, TypeVar, Union +import sys +from typing import Any, Callable, Dict, IO, Iterator, Literal, Optional, Type, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -1055,7 +1060,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1322,7 +1327,7 @@ def update( :rtype: ~azure.storage.filedatalake.models.SetAccessControlRecursiveResponse or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1349,10 +1354,10 @@ def update( _if_unmodified_since = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control + _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1503,7 +1508,7 @@ def lease( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1636,7 +1641,7 @@ def read( :rtype: Iterator[bytes] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1828,7 +1833,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1961,7 +1966,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2082,7 +2087,7 @@ def set_access_control( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2208,7 +2213,7 @@ def set_access_control_recursive( :rtype: ~azure.storage.filedatalake.models.SetAccessControlRecursiveResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2353,7 +2358,7 @@ def flush_data( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2383,10 +2388,10 @@ def flush_data( # pylint: disable=inconsistent-return-statements _encryption_algorithm = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control + _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -2538,7 +2543,7 @@ def append_data( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2658,7 +2663,7 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2737,7 +2742,7 @@ def undelete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py index 2855beb09a6d..5c3b01d7576c 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -144,7 +149,7 @@ def list_file_systems( resource: Literal["account"] = kwargs.pop("resource", _params.pop("resource", "account")) cls: ClsType[_models.FileSystemList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-file-datalake/swagger/README.md b/sdk/storage/azure-storage-file-datalake/swagger/README.md index 21e46a4f3b6d..c6793cd48d67 100644 --- a/sdk/storage/azure-storage-file-datalake/swagger/README.md +++ b/sdk/storage/azure-storage-file-datalake/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Azure.Storage.Files.DataLake/preview/2023-05-03/DataLakeStorage.json +input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Azure.Storage.Files.DataLake/stable/2023-05-03/DataLakeStorage.json output-folder: ../azure/storage/filedatalake/_generated namespace: azure.storage.filedatalake no-namespace-folders: true diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_serialization.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_serialization.py index 2f781d740827..f0c6180722c8 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_serialization.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_serialization.py @@ -1441,7 +1441,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py index 8aa0012fd84a..27b66f0fa9d6 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py @@ -155,10 +155,10 @@ async def create( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control + _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language - _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -707,10 +707,10 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control + _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language - _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py index 49900f6ab120..5755fd181b3f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py index bb89d8fb19c1..f5d20d560a07 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py @@ -82,7 +82,6 @@ async def create( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, - enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -106,8 +105,6 @@ async def create( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :param enable_snapshot_virtual_directory_access: Default value is None. - :type enable_snapshot_virtual_directory_access: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -134,7 +131,6 @@ async def create( # pylint: disable=inconsistent-return-statements access_tier=access_tier, enabled_protocols=enabled_protocols, root_squash=root_squash, - enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, version=self._config.version, headers=_headers, @@ -270,9 +266,6 @@ async def get_properties( # pylint: disable=inconsistent-return-statements "str", response.headers.get("x-ms-enabled-protocols") ) response_headers["x-ms-root-squash"] = self._deserialize("str", response.headers.get("x-ms-root-squash")) - response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( - "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") - ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1105,7 +1098,6 @@ async def set_properties( # pylint: disable=inconsistent-return-statements quota: Optional[int] = None, access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, - enable_snapshot_virtual_directory_access: Optional[bool] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1124,8 +1116,6 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :param enable_snapshot_virtual_directory_access: Default value is None. - :type enable_snapshot_virtual_directory_access: bool :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1158,7 +1148,6 @@ async def set_properties( # pylint: disable=inconsistent-return-statements access_tier=access_tier, lease_id=_lease_id, root_squash=root_squash, - enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 7f283d0dadcf..94f5fcac3f72 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -1239,8 +1239,6 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many :vartype enabled_protocols: str :ivar root_squash: Known values are: "NoRootSquash", "RootSquash", and "AllSquash". :vartype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :ivar enable_snapshot_virtual_directory_access: - :vartype enable_snapshot_virtual_directory_access: bool """ _validation = { @@ -1268,7 +1266,6 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many "lease_duration": {"key": "LeaseDuration", "type": "str"}, "enabled_protocols": {"key": "EnabledProtocols", "type": "str"}, "root_squash": {"key": "RootSquash", "type": "str"}, - "enable_snapshot_virtual_directory_access": {"key": "EnableSnapshotVirtualDirectoryAccess", "type": "bool"}, } def __init__( @@ -1292,7 +1289,6 @@ def __init__( lease_duration: Optional[Union[str, "_models.LeaseDurationType"]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, "_models.ShareRootSquash"]] = None, - enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -1335,8 +1331,6 @@ def __init__( :paramtype enabled_protocols: str :keyword root_squash: Known values are: "NoRootSquash", "RootSquash", and "AllSquash". :paramtype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :keyword enable_snapshot_virtual_directory_access: - :paramtype enable_snapshot_virtual_directory_access: bool """ super().__init__(**kwargs) self.last_modified = last_modified @@ -1357,7 +1351,6 @@ def __init__( self.lease_duration = lease_duration self.enabled_protocols = enabled_protocols self.root_squash = root_squash - self.enable_snapshot_virtual_directory_access = enable_snapshot_virtual_directory_access class ShareProtocolSettings(_serialization.Model): @@ -1550,27 +1543,19 @@ class StorageError(_serialization.Model): :ivar message: :vartype message: str - :ivar authentication_error_detail: - :vartype authentication_error_detail: str """ _attribute_map = { "message": {"key": "Message", "type": "str"}, - "authentication_error_detail": {"key": "AuthenticationErrorDetail", "type": "str"}, } - def __init__( - self, *, message: Optional[str] = None, authentication_error_detail: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: """ :keyword message: :paramtype message: str - :keyword authentication_error_detail: - :paramtype authentication_error_detail: str """ super().__init__(**kwargs) self.message = message - self.authentication_error_detail = authentication_error_detail class StorageServiceProperties(_serialization.Model): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py index 49900f6ab120..5755fd181b3f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py index a26b1206aa0a..797f4e96506c 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py @@ -1180,10 +1180,10 @@ def create( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control + _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language - _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1732,10 +1732,10 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control + _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language - _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py index 49900f6ab120..5755fd181b3f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 4f78e8fd55ff..3a156414fdb6 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -48,7 +48,6 @@ def build_create_request( access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, - enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -83,10 +82,6 @@ def build_create_request( _headers["x-ms-enabled-protocols"] = _SERIALIZER.header("enabled_protocols", enabled_protocols, "str") if root_squash is not None: _headers["x-ms-root-squash"] = _SERIALIZER.header("root_squash", root_squash, "str") - if enable_snapshot_virtual_directory_access is not None: - _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( - "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -532,7 +527,6 @@ def build_set_properties_request( access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, lease_id: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, - enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -567,10 +561,6 @@ def build_set_properties_request( _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") if root_squash is not None: _headers["x-ms-root-squash"] = _SERIALIZER.header("root_squash", root_squash, "str") - if enable_snapshot_virtual_directory_access is not None: - _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( - "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" - ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -796,7 +786,6 @@ def create( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, - enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -820,8 +809,6 @@ def create( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :param enable_snapshot_virtual_directory_access: Default value is None. - :type enable_snapshot_virtual_directory_access: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -848,7 +835,6 @@ def create( # pylint: disable=inconsistent-return-statements access_tier=access_tier, enabled_protocols=enabled_protocols, root_squash=root_squash, - enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, version=self._config.version, headers=_headers, @@ -984,9 +970,6 @@ def get_properties( # pylint: disable=inconsistent-return-statements "str", response.headers.get("x-ms-enabled-protocols") ) response_headers["x-ms-root-squash"] = self._deserialize("str", response.headers.get("x-ms-root-squash")) - response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( - "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") - ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1819,7 +1802,6 @@ def set_properties( # pylint: disable=inconsistent-return-statements quota: Optional[int] = None, access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, - enable_snapshot_virtual_directory_access: Optional[bool] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1838,8 +1820,6 @@ def set_properties( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :param enable_snapshot_virtual_directory_access: Default value is None. - :type enable_snapshot_virtual_directory_access: bool :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1872,7 +1852,6 @@ def set_properties( # pylint: disable=inconsistent-return-statements access_tier=access_tier, lease_id=_lease_id, root_squash=root_squash, - enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 4ab5aa9d06f8..335e7f3d1ef3 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/preview/2024-05-04/file.json +input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json output-folder: ../azure/storage/fileshare/_generated namespace: azure.storage.fileshare no-namespace-folders: true diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py index f99e77fef986..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py @@ -27,5 +27,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_serialization.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_serialization.py index 2f781d740827..f0c6180722c8 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_serialization.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_serialization.py @@ -1441,7 +1441,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py index f99e77fef986..4688ca7f8ac2 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py @@ -27,5 +27,7 @@ # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md + + def patch_sdk(): pass diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py index 49dbfe484382..dddee6d2daf2 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from ..._vendor import _convert_request from ...operations._message_id_operations import build_delete_request, build_update_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +93,7 @@ async def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +172,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py index 4f9359873830..7be183ba87d7 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_peek_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +93,7 @@ async def dequeue( :rtype: list[~azure.storage.queue.models.DequeuedMessageItem] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,7 +161,7 @@ async def clear( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +248,7 @@ async def enqueue( :rtype: list[~azure.storage.queue.models.EnqueuedMessage] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +331,7 @@ async def peek( :rtype: list[~azure.storage.queue.models.PeekedMessageItem] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py index bb39b99e5767..796f71282102 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,6 +34,10 @@ build_set_metadata_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,7 @@ async def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -153,7 +158,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -216,7 +221,7 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +300,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,7 +366,7 @@ async def get_access_policy( :rtype: list[~azure.storage.queue.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +440,7 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py index c05b30792dbe..ff256d797a87 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ build_set_properties_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,7 +155,7 @@ async def get_properties( :rtype: ~azure.storage.queue.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +226,7 @@ async def get_statistics( :rtype: ~azure.storage.queue.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +323,7 @@ async def list_queues_segment( :rtype: ~azure.storage.queue.models.ListQueuesSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py index 8550972c162f..32e90d88ef22 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -171,7 +176,7 @@ def update( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -250,7 +255,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py index ab9189be0105..96bfb1fb774c 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -243,7 +248,7 @@ def dequeue( :rtype: list[~azure.storage.queue.models.DequeuedMessageItem] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,7 +316,7 @@ def clear( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -398,7 +403,7 @@ def enqueue( :rtype: list[~azure.storage.queue.models.EnqueuedMessage] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -481,7 +486,7 @@ def peek( :rtype: list[~azure.storage.queue.models.PeekedMessageItem] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py index f7dd32510333..49900f6ab120 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py @@ -2,6 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py index 28584fac4af2..8de6bf6679f3 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -290,7 +295,7 @@ def create( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +364,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +427,7 @@ def get_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -501,7 +506,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,7 +572,7 @@ def get_access_policy( :rtype: list[~azure.storage.queue.models.SignedIdentifier] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +646,7 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py index 9f9cc01e8d29..f9eea8cde861 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, List, Literal, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +27,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -230,7 +235,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +306,7 @@ def get_properties( :rtype: ~azure.storage.queue.models.StorageServiceProperties :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,7 +377,7 @@ def get_statistics( :rtype: ~azure.storage.queue.models.StorageServiceStats :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +474,7 @@ def list_queues_segment( :rtype: ~azure.storage.queue.models.ListQueuesSegmentResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/storage/azure-storage-queue/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md index d2a1ad574be4..eb213880a30b 100644 --- a/sdk/storage/azure-storage-queue/swagger/README.md +++ b/sdk/storage/azure-storage-queue/swagger/README.md @@ -19,7 +19,7 @@ autorest --use=C:/work/autorest.python --version=2.0.4280 ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.QueueStorage/preview/2018-03-28/queue.json +input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.QueueStorage/stable/2018-03-28/queue.json output-folder: ../azure/storage/queue/_generated namespace: azure.storage.queue no-namespace-folders: true From ad860698a772d2cfbdfcf2bd78ba6c6bd69afdf4 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 4 Jun 2024 14:14:43 -0700 Subject: [PATCH 09/13] Changelogs --- sdk/storage/azure-storage-file-share/CHANGELOG.md | 3 ++- sdk/storage/azure-storage-queue/CHANGELOG.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index 3acffa7315c9..98105691e93d 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -3,7 +3,8 @@ ## 12.17.0b1 (Unreleased) ### Features Added - +- Added `enable_snapshot_virtual_directory_access` parameter support for NFS shares on premium-tier Storage accounts. +- Added a more descriptive authorization error message when facing authorization errors. ## 12.16.0 (2024-05-07) diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index d7d702da34fc..b95ba660930a 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features Added - Updated OAuth implementation to use the AAD scope returned in a Bearer challenge. +- Fixed an issue where client specified service versions may be ignored. ## 12.10.0 (2024-05-07) From 8dcbc31c3cba913bdb3a3419d2b0f202e9c97273 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Tue, 4 Jun 2024 20:07:06 -0700 Subject: [PATCH 10/13] Regen on newest swagger, main swagger links --- .../blob/_generated/aio/operations/_patch.py | 1 + .../storage/blob/_generated/models/_patch.py | 1 + .../blob/_generated/operations/_patch.py | 1 + .../azure-storage-blob/swagger/README.md | 2 +- .../_generated/aio/operations/_patch.py | 1 + .../filedatalake/_generated/models/_patch.py | 1 + .../_generated/operations/_patch.py | 1 + .../swagger/README.md | 2 +- .../aio/operations/_share_operations.py | 11 ++++++++++ .../_generated/models/_models_py3.py | 17 ++++++++++++++- .../operations/_share_operations.py | 21 +++++++++++++++++++ .../swagger/README.md | 2 +- .../queue/_generated/aio/operations/_patch.py | 1 + .../storage/queue/_generated/models/_patch.py | 1 + .../queue/_generated/operations/_patch.py | 1 + .../azure-storage-queue/swagger/README.md | 2 +- 16 files changed, 61 insertions(+), 5 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py index 18451f8af59a..71dde502c70f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py index 18451f8af59a..71dde502c70f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py index 18451f8af59a..71dde502c70f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 1234593ea121..d271978abc72 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json output-folder: ../azure/storage/blob/_generated namespace: azure.storage.blob no-namespace-folders: true diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py index 18451f8af59a..71dde502c70f 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py index 18451f8af59a..71dde502c70f 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py index 18451f8af59a..71dde502c70f 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-file-datalake/swagger/README.md b/sdk/storage/azure-storage-file-datalake/swagger/README.md index c6793cd48d67..462243a0e044 100644 --- a/sdk/storage/azure-storage-file-datalake/swagger/README.md +++ b/sdk/storage/azure-storage-file-datalake/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Azure.Storage.Files.DataLake/stable/2023-05-03/DataLakeStorage.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Azure.Storage.Files.DataLake/stable/2023-05-03/DataLakeStorage.json output-folder: ../azure/storage/filedatalake/_generated namespace: azure.storage.filedatalake no-namespace-folders: true diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py index f5d20d560a07..bb89d8fb19c1 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py @@ -82,6 +82,7 @@ async def create( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -105,6 +106,8 @@ async def create( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -131,6 +134,7 @@ async def create( # pylint: disable=inconsistent-return-statements access_tier=access_tier, enabled_protocols=enabled_protocols, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, version=self._config.version, headers=_headers, @@ -266,6 +270,9 @@ async def get_properties( # pylint: disable=inconsistent-return-statements "str", response.headers.get("x-ms-enabled-protocols") ) response_headers["x-ms-root-squash"] = self._deserialize("str", response.headers.get("x-ms-root-squash")) + response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( + "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") + ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1098,6 +1105,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements quota: Optional[int] = None, access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1116,6 +1124,8 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1148,6 +1158,7 @@ async def set_properties( # pylint: disable=inconsistent-return-statements access_tier=access_tier, lease_id=_lease_id, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 94f5fcac3f72..7f283d0dadcf 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -1239,6 +1239,8 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many :vartype enabled_protocols: str :ivar root_squash: Known values are: "NoRootSquash", "RootSquash", and "AllSquash". :vartype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :ivar enable_snapshot_virtual_directory_access: + :vartype enable_snapshot_virtual_directory_access: bool """ _validation = { @@ -1266,6 +1268,7 @@ class SharePropertiesInternal(_serialization.Model): # pylint: disable=too-many "lease_duration": {"key": "LeaseDuration", "type": "str"}, "enabled_protocols": {"key": "EnabledProtocols", "type": "str"}, "root_squash": {"key": "RootSquash", "type": "str"}, + "enable_snapshot_virtual_directory_access": {"key": "EnableSnapshotVirtualDirectoryAccess", "type": "bool"}, } def __init__( @@ -1289,6 +1292,7 @@ def __init__( lease_duration: Optional[Union[str, "_models.LeaseDurationType"]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, "_models.ShareRootSquash"]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -1331,6 +1335,8 @@ def __init__( :paramtype enabled_protocols: str :keyword root_squash: Known values are: "NoRootSquash", "RootSquash", and "AllSquash". :paramtype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :keyword enable_snapshot_virtual_directory_access: + :paramtype enable_snapshot_virtual_directory_access: bool """ super().__init__(**kwargs) self.last_modified = last_modified @@ -1351,6 +1357,7 @@ def __init__( self.lease_duration = lease_duration self.enabled_protocols = enabled_protocols self.root_squash = root_squash + self.enable_snapshot_virtual_directory_access = enable_snapshot_virtual_directory_access class ShareProtocolSettings(_serialization.Model): @@ -1543,19 +1550,27 @@ class StorageError(_serialization.Model): :ivar message: :vartype message: str + :ivar authentication_error_detail: + :vartype authentication_error_detail: str """ _attribute_map = { "message": {"key": "Message", "type": "str"}, + "authentication_error_detail": {"key": "AuthenticationErrorDetail", "type": "str"}, } - def __init__(self, *, message: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, message: Optional[str] = None, authentication_error_detail: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword message: :paramtype message: str + :keyword authentication_error_detail: + :paramtype authentication_error_detail: str """ super().__init__(**kwargs) self.message = message + self.authentication_error_detail = authentication_error_detail class StorageServiceProperties(_serialization.Model): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 3a156414fdb6..4f78e8fd55ff 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -48,6 +48,7 @@ def build_create_request( access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -82,6 +83,10 @@ def build_create_request( _headers["x-ms-enabled-protocols"] = _SERIALIZER.header("enabled_protocols", enabled_protocols, "str") if root_squash is not None: _headers["x-ms-root-squash"] = _SERIALIZER.header("root_squash", root_squash, "str") + if enable_snapshot_virtual_directory_access is not None: + _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( + "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -527,6 +532,7 @@ def build_set_properties_request( access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, lease_id: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -561,6 +567,10 @@ def build_set_properties_request( _headers["x-ms-lease-id"] = _SERIALIZER.header("lease_id", lease_id, "str") if root_squash is not None: _headers["x-ms-root-squash"] = _SERIALIZER.header("root_squash", root_squash, "str") + if enable_snapshot_virtual_directory_access is not None: + _headers["x-ms-enable-snapshot-virtual-directory-access"] = _SERIALIZER.header( + "enable_snapshot_virtual_directory_access", enable_snapshot_virtual_directory_access, "bool" + ) _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) @@ -786,6 +796,7 @@ def create( # pylint: disable=inconsistent-return-statements access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, enabled_protocols: Optional[str] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, **kwargs: Any ) -> None: """Creates a new share under the specified account. If the share with the same name already @@ -809,6 +820,8 @@ def create( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -835,6 +848,7 @@ def create( # pylint: disable=inconsistent-return-statements access_tier=access_tier, enabled_protocols=enabled_protocols, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, version=self._config.version, headers=_headers, @@ -970,6 +984,9 @@ def get_properties( # pylint: disable=inconsistent-return-statements "str", response.headers.get("x-ms-enabled-protocols") ) response_headers["x-ms-root-squash"] = self._deserialize("str", response.headers.get("x-ms-root-squash")) + response_headers["x-ms-enable-snapshot-virtual-directory-access"] = self._deserialize( + "bool", response.headers.get("x-ms-enable-snapshot-virtual-directory-access") + ) if cls: return cls(pipeline_response, None, response_headers) # type: ignore @@ -1802,6 +1819,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements quota: Optional[int] = None, access_tier: Optional[Union[str, _models.ShareAccessTier]] = None, root_squash: Optional[Union[str, _models.ShareRootSquash]] = None, + enable_snapshot_virtual_directory_access: Optional[bool] = None, lease_access_conditions: Optional[_models.LeaseAccessConditions] = None, **kwargs: Any ) -> None: @@ -1820,6 +1838,8 @@ def set_properties( # pylint: disable=inconsistent-return-statements :param root_squash: Root squash to set on the share. Only valid for NFS shares. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". Default value is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :param enable_snapshot_virtual_directory_access: Default value is None. + :type enable_snapshot_virtual_directory_access: bool :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :return: None or the result of cls(response) @@ -1852,6 +1872,7 @@ def set_properties( # pylint: disable=inconsistent-return-statements access_tier=access_tier, lease_id=_lease_id, root_squash=root_squash, + enable_snapshot_virtual_directory_access=enable_snapshot_virtual_directory_access, restype=restype, comp=comp, version=self._config.version, diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 335e7f3d1ef3..892312f958c5 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json output-folder: ../azure/storage/fileshare/_generated namespace: azure.storage.fileshare no-namespace-folders: true diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py index 49900f6ab120..5755fd181b3f 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py index 49900f6ab120..5755fd181b3f 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py index 49900f6ab120..5755fd181b3f 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_patch.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. # ------------------------------------ + """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/storage/azure-storage-queue/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md index eb213880a30b..6c89b915afa1 100644 --- a/sdk/storage/azure-storage-queue/swagger/README.md +++ b/sdk/storage/azure-storage-queue/swagger/README.md @@ -19,7 +19,7 @@ autorest --use=C:/work/autorest.python --version=2.0.4280 ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.QueueStorage/stable/2018-03-28/queue.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Microsoft.QueueStorage/stable/2018-03-28/queue.json output-folder: ../azure/storage/queue/_generated namespace: azure.storage.queue no-namespace-folders: true From f93b16dacf477bcab03e760ab50237eb8deb070b Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 5 Jun 2024 15:56:04 -0700 Subject: [PATCH 11/13] Regen after Isabelle fix in gen code --- .../_generated/aio/operations/_append_blob_operations.py | 2 +- .../blob/_generated/aio/operations/_blob_operations.py | 2 +- .../_generated/aio/operations/_block_blob_operations.py | 6 +++--- .../blob/_generated/aio/operations/_page_blob_operations.py | 2 +- .../blob/_generated/operations/_append_blob_operations.py | 2 +- .../storage/blob/_generated/operations/_blob_operations.py | 2 +- .../blob/_generated/operations/_block_blob_operations.py | 6 +++--- .../blob/_generated/operations/_page_blob_operations.py | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index ad079981e434..2840b96ee011 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -156,10 +156,10 @@ async def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 6d58684426d2..f71ffebc37b5 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -926,10 +926,10 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements _blob_content_disposition = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index 1c9ec3aa5e31..5123996799f5 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -179,10 +179,10 @@ async def upload( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -405,10 +405,10 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements _source_if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -928,10 +928,10 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index b31da275846b..45d5c64de5fb 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -174,10 +174,10 @@ async def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index 587ede879a4c..f950ba4053bc 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -526,10 +526,10 @@ def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index 422cf59b5a48..385821f836a3 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -2333,10 +2333,10 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements _blob_content_disposition = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index f811a7052493..0a3083b16a7b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -787,10 +787,10 @@ def upload( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1013,10 +1013,10 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements _source_if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1536,10 +1536,10 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index acd82c2bebd2..e388063fc7fa 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -926,10 +926,10 @@ def create( # pylint: disable=inconsistent-return-statements _if_tags = None if blob_http_headers is not None: _blob_cache_control = blob_http_headers.blob_cache_control - _blob_content_md5 = blob_http_headers.blob_content_MD5 _blob_content_disposition = blob_http_headers.blob_content_disposition _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language + _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_type = blob_http_headers.blob_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id From 50f4e42e9ca5b3fc0af2bfb8807be6ea2d2c511d Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Wed, 5 Jun 2024 16:18:36 -0700 Subject: [PATCH 12/13] Regen other 3 packages, missed dl --- .../_generated/aio/operations/_path_operations.py | 4 ++-- .../filedatalake/_generated/operations/_path_operations.py | 4 ++-- .../fileshare/_generated/aio/operations/_file_operations.py | 4 ++-- .../fileshare/_generated/operations/_file_operations.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py index 625135b3fa45..89ac80e699c6 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py @@ -492,10 +492,10 @@ async def update( _if_unmodified_since = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control - _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language + _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1526,10 +1526,10 @@ async def flush_data( # pylint: disable=inconsistent-return-statements _encryption_algorithm = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control - _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language + _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py index 6f706eaa5791..e3d158497721 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py @@ -1354,10 +1354,10 @@ def update( _if_unmodified_since = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control - _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language + _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -2388,10 +2388,10 @@ def flush_data( # pylint: disable=inconsistent-return-statements _encryption_algorithm = None if path_http_headers is not None: _cache_control = path_http_headers.cache_control - _content_md5 = path_http_headers.content_MD5 _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language + _content_md5 = path_http_headers.content_md5 _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py index 27b66f0fa9d6..8aa0012fd84a 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py @@ -155,10 +155,10 @@ async def create( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control - _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language + _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -707,10 +707,10 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control - _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language + _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py index 797f4e96506c..a26b1206aa0a 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py @@ -1180,10 +1180,10 @@ def create( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control - _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language + _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id @@ -1732,10 +1732,10 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements _lease_id = None if file_http_headers is not None: _file_cache_control = file_http_headers.file_cache_control - _file_content_md5 = file_http_headers.file_content_MD5 _file_content_disposition = file_http_headers.file_content_disposition _file_content_encoding = file_http_headers.file_content_encoding _file_content_language = file_http_headers.file_content_language + _file_content_md5 = file_http_headers.file_content_md5 _file_content_type = file_http_headers.file_content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id From 57408cc271bf014487085f0aeb5244311a7ed7f9 Mon Sep 17 00:00:00 2001 From: Vincent Tran Date: Thu, 6 Jun 2024 11:23:23 -0700 Subject: [PATCH 13/13] Main --- sdk/storage/azure-storage-blob/swagger/README.md | 2 +- sdk/storage/azure-storage-file-datalake/swagger/README.md | 2 +- sdk/storage/azure-storage-file-share/swagger/README.md | 2 +- sdk/storage/azure-storage-queue/swagger/README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index d271978abc72..3d7e16f79a45 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json output-folder: ../azure/storage/blob/_generated namespace: azure.storage.blob no-namespace-folders: true diff --git a/sdk/storage/azure-storage-file-datalake/swagger/README.md b/sdk/storage/azure-storage-file-datalake/swagger/README.md index 462243a0e044..edb3d2ef0466 100644 --- a/sdk/storage/azure-storage-file-datalake/swagger/README.md +++ b/sdk/storage/azure-storage-file-datalake/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Azure.Storage.Files.DataLake/stable/2023-05-03/DataLakeStorage.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Azure.Storage.Files.DataLake/stable/2023-05-03/DataLakeStorage.json output-folder: ../azure/storage/filedatalake/_generated namespace: azure.storage.filedatalake no-namespace-folders: true diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 892312f958c5..e70e47c65c99 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest --v3 --python ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json output-folder: ../azure/storage/fileshare/_generated namespace: azure.storage.fileshare no-namespace-folders: true diff --git a/sdk/storage/azure-storage-queue/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md index 6c89b915afa1..556f2380bee8 100644 --- a/sdk/storage/azure-storage-queue/swagger/README.md +++ b/sdk/storage/azure-storage-queue/swagger/README.md @@ -19,7 +19,7 @@ autorest --use=C:/work/autorest.python --version=2.0.4280 ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ad12f8e756a3dfbeb27b6e005ffdc99f027737a9/specification/storage/data-plane/Microsoft.QueueStorage/stable/2018-03-28/queue.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.QueueStorage/stable/2018-03-28/queue.json output-folder: ../azure/storage/queue/_generated namespace: azure.storage.queue no-namespace-folders: true