azure-storage-blob 12.26.0__py3-none-any.whl → 12.27.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azure/storage/blob/__init__.py +3 -3
- azure/storage/blob/_blob_client.py +16 -0
- azure/storage/blob/_blob_client.pyi +780 -0
- azure/storage/blob/_blob_service_client.py +41 -4
- azure/storage/blob/_blob_service_client.pyi +182 -0
- azure/storage/blob/_container_client.py +22 -0
- azure/storage/blob/_container_client.pyi +380 -0
- azure/storage/blob/_generated/_azure_blob_storage.py +3 -2
- azure/storage/blob/_generated/_configuration.py +2 -2
- azure/storage/blob/_generated/_utils/__init__.py +6 -0
- azure/storage/blob/_generated/{_serialization.py → _utils/serialization.py} +4 -22
- azure/storage/blob/_generated/aio/_azure_blob_storage.py +3 -2
- azure/storage/blob/_generated/aio/_configuration.py +2 -2
- azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +6 -10
- azure/storage/blob/_generated/aio/operations/_blob_operations.py +35 -39
- azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +9 -13
- azure/storage/blob/_generated/aio/operations/_container_operations.py +20 -24
- azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +13 -17
- azure/storage/blob/_generated/aio/operations/_service_operations.py +10 -14
- azure/storage/blob/_generated/models/_models_py3.py +30 -9
- azure/storage/blob/_generated/operations/_append_blob_operations.py +11 -15
- azure/storage/blob/_generated/operations/_blob_operations.py +60 -64
- azure/storage/blob/_generated/operations/_block_blob_operations.py +16 -20
- azure/storage/blob/_generated/operations/_container_operations.py +39 -43
- azure/storage/blob/_generated/operations/_page_blob_operations.py +23 -27
- azure/storage/blob/_generated/operations/_service_operations.py +19 -23
- azure/storage/blob/_lease.py +2 -2
- azure/storage/blob/_lease.pyi +81 -0
- azure/storage/blob/_list_blobs_helper.py +1 -1
- azure/storage/blob/_serialize.py +1 -0
- azure/storage/blob/_shared/base_client.py +0 -13
- azure/storage/blob/_shared/base_client_async.py +0 -22
- azure/storage/blob/_shared/models.py +1 -0
- azure/storage/blob/_shared/policies.py +10 -2
- azure/storage/blob/_shared/response_handlers.py +5 -0
- azure/storage/blob/_version.py +1 -1
- azure/storage/blob/aio/__init__.py +5 -8
- azure/storage/blob/aio/_blob_client_async.py +28 -8
- azure/storage/blob/aio/_blob_client_async.pyi +763 -0
- azure/storage/blob/aio/_blob_service_client_async.py +41 -4
- azure/storage/blob/aio/_blob_service_client_async.pyi +187 -0
- azure/storage/blob/aio/_container_client_async.py +27 -1
- azure/storage/blob/aio/_container_client_async.pyi +384 -0
- azure/storage/blob/aio/_lease_async.py +2 -2
- azure/storage/blob/aio/_lease_async.pyi +81 -0
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/METADATA +17 -5
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/RECORD +50 -41
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/WHEEL +1 -1
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info/licenses}/LICENSE +0 -0
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/top_level.txt +0 -0
@@ -6,8 +6,8 @@
|
|
6
6
|
# Code generated by Microsoft (R) AutoRest Code Generator.
|
7
7
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
8
8
|
# --------------------------------------------------------------------------
|
9
|
+
from collections.abc import MutableMapping
|
9
10
|
import datetime
|
10
|
-
import sys
|
11
11
|
from typing import Any, Callable, Dict, IO, Literal, Optional, TypeVar, Union
|
12
12
|
|
13
13
|
from azure.core import PipelineClient
|
@@ -26,12 +26,8 @@ from azure.core.utils import case_insensitive_dict
|
|
26
26
|
|
27
27
|
from .. import models as _models
|
28
28
|
from .._configuration import AzureBlobStorageConfiguration
|
29
|
-
from ..
|
29
|
+
from .._utils.serialization import Deserializer, Serializer
|
30
30
|
|
31
|
-
if sys.version_info >= (3, 9):
|
32
|
-
from collections.abc import MutableMapping
|
33
|
-
else:
|
34
|
-
from typing import MutableMapping # type: ignore
|
35
31
|
T = TypeVar("T")
|
36
32
|
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
37
33
|
|
@@ -75,7 +71,7 @@ def build_create_request(
|
|
75
71
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
76
72
|
|
77
73
|
blob_type: Literal["PageBlob"] = kwargs.pop("blob_type", _headers.pop("x-ms-blob-type", "PageBlob"))
|
78
|
-
version: Literal["2025-
|
74
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
79
75
|
accept = _headers.pop("Accept", "application/xml")
|
80
76
|
|
81
77
|
# Construct URL
|
@@ -193,7 +189,7 @@ def build_upload_pages_request(
|
|
193
189
|
comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page"))
|
194
190
|
page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update"))
|
195
191
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
196
|
-
version: Literal["2025-
|
192
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
197
193
|
accept = _headers.pop("Accept", "application/xml")
|
198
194
|
|
199
195
|
# Construct URL
|
@@ -299,7 +295,7 @@ def build_clear_pages_request(
|
|
299
295
|
|
300
296
|
comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page"))
|
301
297
|
page_write: Literal["clear"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "clear"))
|
302
|
-
version: Literal["2025-
|
298
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
303
299
|
accept = _headers.pop("Accept", "application/xml")
|
304
300
|
|
305
301
|
# Construct URL
|
@@ -399,7 +395,7 @@ def build_upload_pages_from_url_request(
|
|
399
395
|
|
400
396
|
comp: Literal["page"] = kwargs.pop("comp", _params.pop("comp", "page"))
|
401
397
|
page_write: Literal["update"] = kwargs.pop("page_write", _headers.pop("x-ms-page-write", "update"))
|
402
|
-
version: Literal["2025-
|
398
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
403
399
|
accept = _headers.pop("Accept", "application/xml")
|
404
400
|
|
405
401
|
# Construct URL
|
@@ -508,7 +504,7 @@ def build_get_page_ranges_request(
|
|
508
504
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
509
505
|
|
510
506
|
comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist"))
|
511
|
-
version: Literal["2025-
|
507
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
512
508
|
accept = _headers.pop("Accept", "application/xml")
|
513
509
|
|
514
510
|
# Construct URL
|
@@ -576,7 +572,7 @@ def build_get_page_ranges_diff_request(
|
|
576
572
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
577
573
|
|
578
574
|
comp: Literal["pagelist"] = kwargs.pop("comp", _params.pop("comp", "pagelist"))
|
579
|
-
version: Literal["2025-
|
575
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
580
576
|
accept = _headers.pop("Accept", "application/xml")
|
581
577
|
|
582
578
|
# Construct URL
|
@@ -647,7 +643,7 @@ def build_resize_request(
|
|
647
643
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
648
644
|
|
649
645
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
650
|
-
version: Literal["2025-
|
646
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
651
647
|
accept = _headers.pop("Accept", "application/xml")
|
652
648
|
|
653
649
|
# Construct URL
|
@@ -714,7 +710,7 @@ def build_update_sequence_number_request(
|
|
714
710
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
715
711
|
|
716
712
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
717
|
-
version: Literal["2025-
|
713
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
718
714
|
accept = _headers.pop("Accept", "application/xml")
|
719
715
|
|
720
716
|
# Construct URL
|
@@ -773,7 +769,7 @@ def build_copy_incremental_request(
|
|
773
769
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
774
770
|
|
775
771
|
comp: Literal["incrementalcopy"] = kwargs.pop("comp", _params.pop("comp", "incrementalcopy"))
|
776
|
-
version: Literal["2025-
|
772
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
777
773
|
accept = _headers.pop("Accept", "application/xml")
|
778
774
|
|
779
775
|
# Construct URL
|
@@ -821,7 +817,7 @@ class PageBlobOperations:
|
|
821
817
|
|
822
818
|
models = _models
|
823
819
|
|
824
|
-
def __init__(self, *args, **kwargs):
|
820
|
+
def __init__(self, *args, **kwargs) -> None:
|
825
821
|
input_args = list(args)
|
826
822
|
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
827
823
|
self._config: AzureBlobStorageConfiguration = input_args.pop(0) if input_args else kwargs.pop("config")
|
@@ -858,7 +854,7 @@ class PageBlobOperations:
|
|
858
854
|
:type blob_content_length: int
|
859
855
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
860
856
|
:code:`<a
|
861
|
-
href="https://
|
857
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
862
858
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
863
859
|
:type timeout: int
|
864
860
|
:param tier: Optional. Indicates the tier to be set on the page blob. Known values are: "P4",
|
@@ -1062,7 +1058,7 @@ class PageBlobOperations:
|
|
1062
1058
|
:type transactional_content_crc64: bytes
|
1063
1059
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
1064
1060
|
:code:`<a
|
1065
|
-
href="https://
|
1061
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
1066
1062
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
1067
1063
|
:type timeout: int
|
1068
1064
|
:param range: Return only the bytes of the blob in the specified range. Default value is None.
|
@@ -1241,7 +1237,7 @@ class PageBlobOperations:
|
|
1241
1237
|
:type content_length: int
|
1242
1238
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
1243
1239
|
:code:`<a
|
1244
|
-
href="https://
|
1240
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
1245
1241
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
1246
1242
|
:type timeout: int
|
1247
1243
|
:param range: Return only the bytes of the blob in the specified range. Default value is None.
|
@@ -1415,7 +1411,7 @@ class PageBlobOperations:
|
|
1415
1411
|
:type source_contentcrc64: bytes
|
1416
1412
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
1417
1413
|
:code:`<a
|
1418
|
-
href="https://
|
1414
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
1419
1415
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
1420
1416
|
:type timeout: int
|
1421
1417
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -1597,12 +1593,12 @@ class PageBlobOperations:
|
|
1597
1593
|
:param snapshot: The snapshot parameter is an opaque DateTime value that, when present,
|
1598
1594
|
specifies the blob snapshot to retrieve. For more information on working with blob snapshots,
|
1599
1595
|
see :code:`<a
|
1600
|
-
href="https://
|
1596
|
+
href="https://learn.microsoft.com/rest/api/storageservices/creating-a-snapshot-of-a-blob">Creating
|
1601
1597
|
a Snapshot of a Blob.</a>`. Default value is None.
|
1602
1598
|
:type snapshot: str
|
1603
1599
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
1604
1600
|
:code:`<a
|
1605
|
-
href="https://
|
1601
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
1606
1602
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
1607
1603
|
:type timeout: int
|
1608
1604
|
:param range: Return only the bytes of the blob in the specified range. Default value is None.
|
@@ -1736,12 +1732,12 @@ class PageBlobOperations:
|
|
1736
1732
|
:param snapshot: The snapshot parameter is an opaque DateTime value that, when present,
|
1737
1733
|
specifies the blob snapshot to retrieve. For more information on working with blob snapshots,
|
1738
1734
|
see :code:`<a
|
1739
|
-
href="https://
|
1735
|
+
href="https://learn.microsoft.com/rest/api/storageservices/creating-a-snapshot-of-a-blob">Creating
|
1740
1736
|
a Snapshot of a Blob.</a>`. Default value is None.
|
1741
1737
|
:type snapshot: str
|
1742
1738
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
1743
1739
|
:code:`<a
|
1744
|
-
href="https://
|
1740
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
1745
1741
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
1746
1742
|
:type timeout: int
|
1747
1743
|
:param prevsnapshot: Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a
|
@@ -1887,7 +1883,7 @@ class PageBlobOperations:
|
|
1887
1883
|
:type blob_content_length: int
|
1888
1884
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
1889
1885
|
:code:`<a
|
1890
|
-
href="https://
|
1886
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
1891
1887
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
1892
1888
|
:type timeout: int
|
1893
1889
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -2015,7 +2011,7 @@ class PageBlobOperations:
|
|
2015
2011
|
:type sequence_number_action: str or ~azure.storage.blob.models.SequenceNumberActionType
|
2016
2012
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
2017
2013
|
:code:`<a
|
2018
|
-
href="https://
|
2014
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
2019
2015
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
2020
2016
|
:type timeout: int
|
2021
2017
|
:param blob_sequence_number: Set for page blobs only. The sequence number is a user-controlled
|
@@ -2132,7 +2128,7 @@ class PageBlobOperations:
|
|
2132
2128
|
:type copy_source: str
|
2133
2129
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
2134
2130
|
:code:`<a
|
2135
|
-
href="https://
|
2131
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
2136
2132
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
2137
2133
|
:type timeout: int
|
2138
2134
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# Code generated by Microsoft (R) AutoRest Code Generator.
|
7
7
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
8
8
|
# --------------------------------------------------------------------------
|
9
|
-
import
|
9
|
+
from collections.abc import MutableMapping
|
10
10
|
from typing import Any, Callable, Dict, IO, Iterator, List, Literal, Optional, TypeVar, Union
|
11
11
|
|
12
12
|
from azure.core import PipelineClient
|
@@ -27,12 +27,8 @@ from azure.core.utils import case_insensitive_dict
|
|
27
27
|
|
28
28
|
from .. import models as _models
|
29
29
|
from .._configuration import AzureBlobStorageConfiguration
|
30
|
-
from ..
|
30
|
+
from .._utils.serialization import Deserializer, Serializer
|
31
31
|
|
32
|
-
if sys.version_info >= (3, 9):
|
33
|
-
from collections.abc import MutableMapping
|
34
|
-
else:
|
35
|
-
from typing import MutableMapping # type: ignore
|
36
32
|
T = TypeVar("T")
|
37
33
|
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
38
34
|
|
@@ -49,7 +45,7 @@ def build_set_properties_request(
|
|
49
45
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
50
46
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
51
47
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
52
|
-
version: Literal["2025-
|
48
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
53
49
|
accept = _headers.pop("Accept", "application/xml")
|
54
50
|
|
55
51
|
# Construct URL
|
@@ -85,7 +81,7 @@ def build_get_properties_request(
|
|
85
81
|
|
86
82
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
87
83
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
88
|
-
version: Literal["2025-
|
84
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
89
85
|
accept = _headers.pop("Accept", "application/xml")
|
90
86
|
|
91
87
|
# Construct URL
|
@@ -119,7 +115,7 @@ def build_get_statistics_request(
|
|
119
115
|
|
120
116
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
121
117
|
comp: Literal["stats"] = kwargs.pop("comp", _params.pop("comp", "stats"))
|
122
|
-
version: Literal["2025-
|
118
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
123
119
|
accept = _headers.pop("Accept", "application/xml")
|
124
120
|
|
125
121
|
# Construct URL
|
@@ -160,7 +156,7 @@ def build_list_containers_segment_request(
|
|
160
156
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
161
157
|
|
162
158
|
comp: Literal["list"] = kwargs.pop("comp", _params.pop("comp", "list"))
|
163
|
-
version: Literal["2025-
|
159
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
164
160
|
accept = _headers.pop("Accept", "application/xml")
|
165
161
|
|
166
162
|
# Construct URL
|
@@ -202,7 +198,7 @@ def build_get_user_delegation_key_request(
|
|
202
198
|
restype: Literal["service"] = kwargs.pop("restype", _params.pop("restype", "service"))
|
203
199
|
comp: Literal["userdelegationkey"] = kwargs.pop("comp", _params.pop("comp", "userdelegationkey"))
|
204
200
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
205
|
-
version: Literal["2025-
|
201
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
206
202
|
accept = _headers.pop("Accept", "application/xml")
|
207
203
|
|
208
204
|
# Construct URL
|
@@ -238,7 +234,7 @@ def build_get_account_info_request(
|
|
238
234
|
|
239
235
|
restype: Literal["account"] = kwargs.pop("restype", _params.pop("restype", "account"))
|
240
236
|
comp: Literal["properties"] = kwargs.pop("comp", _params.pop("comp", "properties"))
|
241
|
-
version: Literal["2025-
|
237
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
242
238
|
accept = _headers.pop("Accept", "application/xml")
|
243
239
|
|
244
240
|
# Construct URL
|
@@ -278,7 +274,7 @@ def build_submit_batch_request(
|
|
278
274
|
|
279
275
|
comp: Literal["batch"] = kwargs.pop("comp", _params.pop("comp", "batch"))
|
280
276
|
multipart_content_type: Optional[str] = kwargs.pop("multipart_content_type", _headers.pop("Content-Type", None))
|
281
|
-
version: Literal["2025-
|
277
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
282
278
|
accept = _headers.pop("Accept", "application/xml")
|
283
279
|
|
284
280
|
# Construct URL
|
@@ -321,7 +317,7 @@ def build_filter_blobs_request(
|
|
321
317
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
322
318
|
|
323
319
|
comp: Literal["blobs"] = kwargs.pop("comp", _params.pop("comp", "blobs"))
|
324
|
-
version: Literal["2025-
|
320
|
+
version: Literal["2025-11-05"] = kwargs.pop("version", _headers.pop("x-ms-version", "2025-11-05"))
|
325
321
|
accept = _headers.pop("Accept", "application/xml")
|
326
322
|
|
327
323
|
# Construct URL
|
@@ -366,7 +362,7 @@ class ServiceOperations:
|
|
366
362
|
|
367
363
|
models = _models
|
368
364
|
|
369
|
-
def __init__(self, *args, **kwargs):
|
365
|
+
def __init__(self, *args, **kwargs) -> None:
|
370
366
|
input_args = list(args)
|
371
367
|
self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
372
368
|
self._config: AzureBlobStorageConfiguration = input_args.pop(0) if input_args else kwargs.pop("config")
|
@@ -388,7 +384,7 @@ class ServiceOperations:
|
|
388
384
|
:type storage_service_properties: ~azure.storage.blob.models.StorageServiceProperties
|
389
385
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
390
386
|
:code:`<a
|
391
|
-
href="https://
|
387
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
392
388
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
393
389
|
:type timeout: int
|
394
390
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -462,7 +458,7 @@ class ServiceOperations:
|
|
462
458
|
|
463
459
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
464
460
|
:code:`<a
|
465
|
-
href="https://
|
461
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
466
462
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
467
463
|
:type timeout: int
|
468
464
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -536,7 +532,7 @@ class ServiceOperations:
|
|
536
532
|
|
537
533
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
538
534
|
:code:`<a
|
539
|
-
href="https://
|
535
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
540
536
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
541
537
|
:type timeout: int
|
542
538
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -637,7 +633,7 @@ class ServiceOperations:
|
|
637
633
|
:type include: list[str or ~azure.storage.blob.models.ListContainersIncludeType]
|
638
634
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
639
635
|
:code:`<a
|
640
|
-
href="https://
|
636
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
641
637
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
642
638
|
:type timeout: int
|
643
639
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -718,7 +714,7 @@ class ServiceOperations:
|
|
718
714
|
:type key_info: ~azure.storage.blob.models.KeyInfo
|
719
715
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
720
716
|
:code:`<a
|
721
|
-
href="https://
|
717
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
722
718
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
723
719
|
:type timeout: int
|
724
720
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -796,7 +792,7 @@ class ServiceOperations:
|
|
796
792
|
|
797
793
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
798
794
|
:code:`<a
|
799
|
-
href="https://
|
795
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
800
796
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
801
797
|
:type timeout: int
|
802
798
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -877,7 +873,7 @@ class ServiceOperations:
|
|
877
873
|
:type body: IO[bytes]
|
878
874
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
879
875
|
:code:`<a
|
880
|
-
href="https://
|
876
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
881
877
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
882
878
|
:type timeout: int
|
883
879
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
@@ -967,7 +963,7 @@ class ServiceOperations:
|
|
967
963
|
|
968
964
|
:param timeout: The timeout parameter is expressed in seconds. For more information, see
|
969
965
|
:code:`<a
|
970
|
-
href="https://
|
966
|
+
href="https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations">Setting
|
971
967
|
Timeouts for Blob Service Operations.</a>`. Default value is None.
|
972
968
|
:type timeout: int
|
973
969
|
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
|
azure/storage/blob/_lease.py
CHANGED
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
|
|
20
20
|
from datetime import datetime
|
21
21
|
|
22
22
|
|
23
|
-
class BlobLeaseClient
|
23
|
+
class BlobLeaseClient: # pylint: disable=client-accepts-api-version-keyword
|
24
24
|
"""Creates a new BlobLeaseClient.
|
25
25
|
|
26
26
|
This client provides lease operations on a BlobClient or ContainerClient.
|
@@ -41,7 +41,7 @@ class BlobLeaseClient(): # pylint: disable=client-accepts-api-version-keyword
|
|
41
41
|
"""The last modified timestamp of the lease currently being maintained.
|
42
42
|
This will be `None` if no lease has yet been acquired or modified."""
|
43
43
|
|
44
|
-
def __init__(
|
44
|
+
def __init__( # pylint: disable=missing-client-constructor-parameter-credential, missing-client-constructor-parameter-kwargs
|
45
45
|
self, client: Union["BlobClient", "ContainerClient"],
|
46
46
|
lease_id: Optional[str] = None
|
47
47
|
) -> None:
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# -------------------------------------------------------------------------
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for
|
4
|
+
# license information.
|
5
|
+
# --------------------------------------------------------------------------
|
6
|
+
# pylint: skip-file
|
7
|
+
|
8
|
+
from datetime import datetime
|
9
|
+
from typing import Any, Optional, Union
|
10
|
+
|
11
|
+
from azure.core import MatchConditions
|
12
|
+
from azure.core.tracing.decorator import distributed_trace
|
13
|
+
from ._blob_client import BlobClient
|
14
|
+
from ._container_client import ContainerClient
|
15
|
+
|
16
|
+
class BlobLeaseClient:
|
17
|
+
id: str
|
18
|
+
etag: Optional[str]
|
19
|
+
last_modified: Optional[datetime]
|
20
|
+
def __init__(self, client: Union[BlobClient, ContainerClient], lease_id: Optional[str] = None) -> None: ...
|
21
|
+
@distributed_trace
|
22
|
+
def acquire(
|
23
|
+
self,
|
24
|
+
lease_duration: int = -1,
|
25
|
+
*,
|
26
|
+
if_modified_since: Optional[datetime] = None,
|
27
|
+
if_unmodified_since: Optional[datetime] = None,
|
28
|
+
etag: Optional[str] = None,
|
29
|
+
match_condition: Optional[MatchConditions] = None,
|
30
|
+
if_tags_match_condition: Optional[str] = None,
|
31
|
+
timeout: Optional[int] = None,
|
32
|
+
**kwargs: Any
|
33
|
+
) -> None: ...
|
34
|
+
@distributed_trace
|
35
|
+
def renew(
|
36
|
+
self,
|
37
|
+
*,
|
38
|
+
if_modified_since: Optional[datetime] = None,
|
39
|
+
if_unmodified_since: Optional[datetime] = None,
|
40
|
+
etag: Optional[str] = None,
|
41
|
+
match_condition: Optional[MatchConditions] = None,
|
42
|
+
if_tags_match_condition: Optional[str] = None,
|
43
|
+
timeout: Optional[int] = None,
|
44
|
+
**kwargs: Any
|
45
|
+
) -> None: ...
|
46
|
+
@distributed_trace
|
47
|
+
def release(
|
48
|
+
self,
|
49
|
+
*,
|
50
|
+
if_modified_since: Optional[datetime] = None,
|
51
|
+
if_unmodified_since: Optional[datetime] = None,
|
52
|
+
etag: Optional[str] = None,
|
53
|
+
match_condition: Optional[MatchConditions] = None,
|
54
|
+
if_tags_match_condition: Optional[str] = None,
|
55
|
+
timeout: Optional[int] = None,
|
56
|
+
**kwargs: Any
|
57
|
+
) -> None: ...
|
58
|
+
@distributed_trace
|
59
|
+
def change(
|
60
|
+
self,
|
61
|
+
proposed_lease_id: str,
|
62
|
+
*,
|
63
|
+
if_modified_since: Optional[datetime] = None,
|
64
|
+
if_unmodified_since: Optional[datetime] = None,
|
65
|
+
etag: Optional[str] = None,
|
66
|
+
match_condition: Optional[MatchConditions] = None,
|
67
|
+
if_tags_match_condition: Optional[str] = None,
|
68
|
+
timeout: Optional[int] = None,
|
69
|
+
**kwargs: Any
|
70
|
+
) -> None: ...
|
71
|
+
@distributed_trace
|
72
|
+
def break_lease(
|
73
|
+
self,
|
74
|
+
lease_break_period: Optional[int] = None,
|
75
|
+
*,
|
76
|
+
if_modified_since: Optional[datetime] = None,
|
77
|
+
if_unmodified_since: Optional[datetime] = None,
|
78
|
+
if_tags_match_condition: Optional[str] = None,
|
79
|
+
timeout: Optional[int] = None,
|
80
|
+
**kwargs: Any
|
81
|
+
) -> int: ...
|
@@ -18,7 +18,7 @@ from ._deserialize import (
|
|
18
18
|
parse_tags
|
19
19
|
)
|
20
20
|
from ._generated.models import BlobItemInternal, BlobPrefix as GenBlobPrefix, FilterBlobItem
|
21
|
-
from ._generated.
|
21
|
+
from ._generated._utils.serialization import Deserializer
|
22
22
|
from ._models import BlobProperties, FilteredBlob
|
23
23
|
from ._shared.models import DictMixin
|
24
24
|
from ._shared.response_handlers import (
|
azure/storage/blob/_serialize.py
CHANGED
@@ -127,19 +127,6 @@ class StorageAccountHostsMixin(object):
|
|
127
127
|
self._sdk_moniker = f"storage-{service}/{VERSION}"
|
128
128
|
self._config, self._pipeline = self._create_pipeline(self.credential, sdk_moniker=self._sdk_moniker, **kwargs)
|
129
129
|
|
130
|
-
def __enter__(self):
|
131
|
-
self._client.__enter__()
|
132
|
-
return self
|
133
|
-
|
134
|
-
def __exit__(self, *args):
|
135
|
-
self._client.__exit__(*args)
|
136
|
-
|
137
|
-
def close(self) -> None:
|
138
|
-
"""This method is to close the sockets opened by the client.
|
139
|
-
It need not be used when using with a context manager.
|
140
|
-
"""
|
141
|
-
self._client.close()
|
142
|
-
|
143
130
|
@property
|
144
131
|
def url(self) -> str:
|
145
132
|
"""The full endpoint URL to this entity, including SAS token if used.
|
@@ -51,28 +51,6 @@ _SERVICE_PARAMS = {
|
|
51
51
|
|
52
52
|
class AsyncStorageAccountHostsMixin(object):
|
53
53
|
|
54
|
-
def __enter__(self):
|
55
|
-
raise TypeError("Async client only supports 'async with'.")
|
56
|
-
|
57
|
-
def __exit__(self, *args):
|
58
|
-
pass
|
59
|
-
|
60
|
-
async def __aenter__(self):
|
61
|
-
await self._client.__aenter__()
|
62
|
-
return self
|
63
|
-
|
64
|
-
async def __aexit__(self, *args):
|
65
|
-
await self._client.__aexit__(*args)
|
66
|
-
|
67
|
-
async def close(self) -> None:
|
68
|
-
"""This method is to close the sockets opened by the client.
|
69
|
-
It need not be used when using with a context manager.
|
70
|
-
|
71
|
-
:return: None
|
72
|
-
:rtype: None
|
73
|
-
"""
|
74
|
-
await self._client.close()
|
75
|
-
|
76
54
|
def _format_query_string(
|
77
55
|
self,
|
78
56
|
sas_token: Optional[str],
|
@@ -168,6 +168,7 @@ class StorageErrorCode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
|
|
168
168
|
SHARING_VIOLATION = "SharingViolation"
|
169
169
|
SHARE_SNAPSHOT_IN_PROGRESS = "ShareSnapshotInProgress"
|
170
170
|
SHARE_SNAPSHOT_COUNT_EXCEEDED = "ShareSnapshotCountExceeded"
|
171
|
+
SHARE_SNAPSHOT_NOT_FOUND = "ShareSnapshotNotFound"
|
171
172
|
SHARE_SNAPSHOT_OPERATION_NOT_SUPPORTED = "ShareSnapshotOperationNotSupported"
|
172
173
|
SHARE_HAS_SNAPSHOTS = "ShareHasSnapshots"
|
173
174
|
CONTAINER_QUOTA_DOWNGRADE_NOT_ALLOWED = "ContainerQuotaDowngradeNotAllowed"
|
@@ -33,7 +33,7 @@ from azure.core.pipeline.policies import (
|
|
33
33
|
|
34
34
|
from .authentication import AzureSigningError, StorageHttpChallenge
|
35
35
|
from .constants import DEFAULT_OAUTH_SCOPE
|
36
|
-
from .models import LocationMode
|
36
|
+
from .models import LocationMode, StorageErrorCode
|
37
37
|
|
38
38
|
if TYPE_CHECKING:
|
39
39
|
from azure.core.credentials import TokenCredential
|
@@ -72,7 +72,7 @@ def retry_hook(settings, **kwargs):
|
|
72
72
|
# respect the Retry-After header, whether this header is present, and
|
73
73
|
# whether the returned status code is on the list of status codes to
|
74
74
|
# be retried upon on the presence of the aforementioned header)
|
75
|
-
def is_retry(response, mode):
|
75
|
+
def is_retry(response, mode): # pylint: disable=too-many-return-statements
|
76
76
|
status = response.http_response.status_code
|
77
77
|
if 300 <= status < 500:
|
78
78
|
# An exception occurred, but in most cases it was expected. Examples could
|
@@ -83,6 +83,14 @@ def is_retry(response, mode):
|
|
83
83
|
if status == 408:
|
84
84
|
# Response code 408 is a timeout and should be retried.
|
85
85
|
return True
|
86
|
+
if status >= 400:
|
87
|
+
error_code = response.http_response.headers.get("x-ms-copy-source-error-code")
|
88
|
+
if error_code in [
|
89
|
+
StorageErrorCode.OPERATION_TIMED_OUT,
|
90
|
+
StorageErrorCode.INTERNAL_ERROR,
|
91
|
+
StorageErrorCode.SERVER_BUSY,
|
92
|
+
]:
|
93
|
+
return True
|
86
94
|
return False
|
87
95
|
if status >= 500:
|
88
96
|
# Response codes above 500 with the exception of 501 Not Implemented and
|
@@ -22,6 +22,7 @@ from .models import get_enum_value, StorageErrorCode, UserDelegationKey
|
|
22
22
|
from .parser import _to_utc_datetime
|
23
23
|
|
24
24
|
|
25
|
+
SV_DOCS_URL = "https://learn.microsoft.com/rest/api/storageservices/versioning-for-the-azure-storage-services"
|
25
26
|
_LOGGER = logging.getLogger(__name__)
|
26
27
|
|
27
28
|
|
@@ -174,6 +175,10 @@ def process_storage_error(storage_error) -> NoReturn: # type: ignore [misc] # p
|
|
174
175
|
for name, info in additional_data.items():
|
175
176
|
error_message += f"\n{name}:{info}"
|
176
177
|
|
178
|
+
if additional_data.get("headername") == "x-ms-version" and error_code == StorageErrorCode.INVALID_HEADER_VALUE:
|
179
|
+
error_message = ("The provided service version is not enabled on this storage account." +
|
180
|
+
f"Please see {SV_DOCS_URL} for additional information.\n" + error_message)
|
181
|
+
|
177
182
|
# No need to create an instance if it has already been serialized by the generated layer
|
178
183
|
if serialized:
|
179
184
|
storage_error.message = error_message
|
azure/storage/blob/_version.py
CHANGED