diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json
index a68d1dba0adf..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_c4f327d388"
+ "Tag": "python/storage/azure-storage-blob_275000b78a"
}
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/_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/_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/_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..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 483d4f1b6369..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,
@@ -2602,14 +2607,25 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2626,6 +2642,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 +2674,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
@@ -2702,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,
@@ -2948,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,
@@ -3056,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 7f603c21b594..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,
@@ -1732,14 +1737,25 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1756,6 +1772,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 +1804,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/_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/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_patch.py
index 029b47fe4787..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
@@ -2,6 +2,8 @@
# 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 +12,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 b60dcf0a0337..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,
@@ -479,14 +484,25 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -503,6 +519,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,
@@ -566,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,
@@ -672,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..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
@@ -2,6 +2,8 @@
# 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 +12,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 3d9374f41030..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]]
@@ -67,7 +72,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 +180,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 +276,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 +374,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
@@ -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 00f174331846..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]]
@@ -58,7 +63,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 +142,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 +210,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 +261,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 +299,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 +350,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 +419,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 +461,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 +498,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 +546,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 +614,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 +672,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 +727,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 +783,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 +839,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 +899,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 +978,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 +1081,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 +1173,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 +1219,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 +1255,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 +1277,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 +1312,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 +1376,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 +1427,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
@@ -1533,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,
@@ -1820,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,
@@ -2041,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,
@@ -2132,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,
@@ -2210,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,
@@ -2294,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,
@@ -2421,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,
@@ -2502,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,
@@ -2572,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,
@@ -2667,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,
@@ -2800,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,
@@ -2902,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,
@@ -3002,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,
@@ -3108,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,
@@ -3216,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,
@@ -3331,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,
@@ -3498,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,
@@ -3680,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,
@@ -3821,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,
@@ -3933,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,
@@ -4003,14 +4014,25 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -4027,6 +4049,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 +4081,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
@@ -4103,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,
@@ -4349,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,
@@ -4457,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 e0c427ea8fc3..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]]
@@ -72,7 +77,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 +211,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 +336,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 +412,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 +513,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 +619,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
@@ -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 f715fc59ce3e..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]]
@@ -49,7 +54,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 +103,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 +144,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 +190,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 +235,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 +281,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 +331,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 +379,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 +423,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 +468,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 +519,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 +570,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 +618,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 +666,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 +716,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 +765,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 +816,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 +851,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 +873,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)
@@ -932,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,
@@ -1019,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,
@@ -1124,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,
@@ -1222,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,
@@ -1311,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,
@@ -1412,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,
@@ -1518,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,
@@ -1601,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,
@@ -1682,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,
@@ -1789,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,
@@ -1884,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,
@@ -1979,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,
@@ -2072,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,
@@ -2172,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,
@@ -2271,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,
@@ -2383,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,
@@ -2495,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,
@@ -2557,14 +2568,25 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -2581,6 +2603,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 +2635,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..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]]
@@ -70,7 +75,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 +191,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 +291,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 +390,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 +497,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 +565,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 +636,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 +703,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 +762,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
@@ -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/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_patch.py
index 029b47fe4787..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
@@ -2,6 +2,8 @@
# 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 +12,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 aa830c3fb769..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]]
@@ -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["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 +83,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 +117,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 +158,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 +200,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 +228,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 +250,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 +276,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 +319,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
@@ -386,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,
@@ -461,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,
@@ -536,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,
@@ -638,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,
@@ -720,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,
@@ -781,14 +792,25 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -805,6 +827,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,
@@ -868,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,
@@ -974,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/_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/_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/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-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md
index 5387db1bc35e..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/main/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/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-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-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
diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
index 151532e3f571..0421e0926552 100644
--- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
+++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
@@ -3,6 +3,7 @@
## 12.16.0b1 (Unreleased)
### Features Added
+- Updated OAuth implementation to use the AAD scope returned in a Bearer challenge.
## 12.15.0 (2024-05-07)
diff --git a/sdk/storage/azure-storage-file-datalake/assets.json b/sdk/storage/azure-storage-file-datalake/assets.json
index cbe0c3dc25c0..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_95d136bf90"
+ "Tag": "python/storage/azure-storage-file-datalake_dec64d97f2"
}
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..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
@@ -2,6 +2,8 @@
# 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 +12,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..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
@@ -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,
@@ -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,
@@ -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..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
@@ -2,6 +2,8 @@
# 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 +12,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..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
@@ -2,6 +2,8 @@
# 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 +12,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..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
@@ -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,
@@ -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,
@@ -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/azure/storage/filedatalake/_serialize.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_serialize.py
index 7fc93985e8e1..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',
@@ -33,6 +34,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/_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-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/swagger/README.md b/sdk/storage/azure-storage-file-datalake/swagger/README.md
index 21e46a4f3b6d..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/main/specification/storage/data-plane/Azure.Storage.Files.DataLake/preview/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-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/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-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json
index b4ad58843489..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_1159609065"
+ "Tag": "python/storage/azure-storage-file-share_e105feb7fb"
}
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/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py
index f99e77fef986..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
@@ -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-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/_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/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py
index f99e77fef986..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
@@ -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-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/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_patch.py
index f7dd32510333..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
@@ -2,6 +2,8 @@
# 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/_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..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
@@ -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]]
@@ -77,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
@@ -100,11 +106,13 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -126,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,
@@ -181,7 +190,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,
@@ -261,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
@@ -294,7 +306,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 +395,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 +484,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 +576,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 +665,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 +762,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 +844,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 +965,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 +1045,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,
@@ -1093,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:
@@ -1111,13 +1124,15 @@ 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)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1143,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,
@@ -1198,7 +1214,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 +1289,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 +1370,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 +1454,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 +1542,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..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/models/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_patch.py
index f7dd32510333..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
@@ -2,6 +2,8 @@
# 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/_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/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_patch.py
index f7dd32510333..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
@@ -2,6 +2,8 @@
# 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/_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..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
@@ -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]]
@@ -43,13 +48,14 @@ 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 {})
_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
@@ -77,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)
@@ -94,7 +104,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 +144,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 +189,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 +237,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 +283,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 +330,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 +376,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 +417,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 +456,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 +497,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
@@ -522,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 {})
@@ -529,7 +540,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
@@ -556,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)
@@ -574,7 +589,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 +625,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 +660,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 +696,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 +736,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
@@ -781,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
@@ -804,11 +820,13 @@ 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:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -830,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,
@@ -885,7 +904,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,
@@ -965,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
@@ -998,7 +1020,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 +1109,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 +1198,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 +1290,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 +1379,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 +1476,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 +1558,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 +1679,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 +1759,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,
@@ -1797,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:
@@ -1815,13 +1838,15 @@ 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)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
- error_map = {
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
@@ -1847,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,
@@ -1902,7 +1928,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 +2003,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 +2084,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 +2168,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 +2256,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/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/_serialize.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py
index 97a294e062f7..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',
@@ -41,6 +42,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/_share_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py
index e9453e18c978..faba339c7a85 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
@@ -374,6 +374,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/_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/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py
index 5ddf6b95e45a..84872d32c770 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
@@ -232,6 +232,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/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md
index 4ab5aa9d06f8..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/main/specification/storage/data-plane/Microsoft.FileStorage/preview/2024-05-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-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-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py
index 60333a24b904..185d61f23d62 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
@@ -746,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):
@@ -950,6 +977,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..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
@@ -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
@@ -742,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):
@@ -962,6 +992,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/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md
index f063401312bf..b95ba660930a 100644
--- a/sdk/storage/azure-storage-queue/CHANGELOG.md
+++ b/sdk/storage/azure-storage-queue/CHANGELOG.md
@@ -3,7 +3,8 @@
## 12.11.0b1 (Unreleased)
### 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)
diff --git a/sdk/storage/azure-storage-queue/assets.json b/sdk/storage/azure-storage-queue/assets.json
index 866e4b465469..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_da8bdfe45e"
+ "Tag": "python/storage/azure-storage-queue_8161cc758c"
}
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..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
@@ -2,6 +2,8 @@
# 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..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
@@ -2,6 +2,8 @@
# 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..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
@@ -2,6 +2,8 @@
# 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/azure/storage/queue/_serialize.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_serialize.py
index 15e6582c4aea..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,19 @@
'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/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
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/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md
index d2a1ad574be4..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/main/specification/storage/data-plane/Microsoft.QueueStorage/preview/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
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__':