azure-storage-blob 12.26.0b1__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 +6 -5
- azure/storage/blob/_blob_client.py +59 -38
- azure/storage/blob/_blob_client.pyi +780 -0
- azure/storage/blob/_blob_client_helpers.py +4 -3
- azure/storage/blob/_blob_service_client.py +57 -17
- azure/storage/blob/_blob_service_client.pyi +182 -0
- azure/storage/blob/_container_client.py +47 -22
- azure/storage/blob/_container_client.pyi +380 -0
- azure/storage/blob/_deserialize.py +1 -1
- azure/storage/blob/_download.py +7 -7
- azure/storage/blob/_encryption.py +177 -184
- 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 +3 -2
- azure/storage/blob/_lease.pyi +81 -0
- azure/storage/blob/_list_blobs_helper.py +1 -1
- azure/storage/blob/_quick_query_helper.py +3 -3
- azure/storage/blob/_serialize.py +1 -0
- azure/storage/blob/_shared/__init__.py +7 -7
- azure/storage/blob/_shared/authentication.py +49 -32
- azure/storage/blob/_shared/avro/avro_io.py +44 -42
- azure/storage/blob/_shared/avro/avro_io_async.py +42 -41
- azure/storage/blob/_shared/avro/datafile.py +24 -21
- azure/storage/blob/_shared/avro/datafile_async.py +15 -15
- azure/storage/blob/_shared/avro/schema.py +196 -217
- azure/storage/blob/_shared/base_client.py +79 -70
- azure/storage/blob/_shared/base_client_async.py +53 -68
- azure/storage/blob/_shared/constants.py +1 -1
- azure/storage/blob/_shared/models.py +94 -92
- azure/storage/blob/_shared/parser.py +3 -3
- azure/storage/blob/_shared/policies.py +186 -147
- azure/storage/blob/_shared/policies_async.py +58 -69
- azure/storage/blob/_shared/request_handlers.py +50 -45
- azure/storage/blob/_shared/response_handlers.py +54 -45
- azure/storage/blob/_shared/shared_access_signature.py +65 -73
- azure/storage/blob/_shared/uploads.py +56 -49
- azure/storage/blob/_shared/uploads_async.py +70 -58
- azure/storage/blob/_version.py +1 -1
- azure/storage/blob/aio/__init__.py +8 -10
- azure/storage/blob/aio/_blob_client_async.py +81 -48
- azure/storage/blob/aio/_blob_client_async.pyi +763 -0
- azure/storage/blob/aio/_blob_service_client_async.py +54 -15
- azure/storage/blob/aio/_blob_service_client_async.pyi +187 -0
- azure/storage/blob/aio/_container_client_async.py +55 -26
- azure/storage/blob/aio/_container_client_async.pyi +384 -0
- azure/storage/blob/aio/_download_async.py +15 -11
- azure/storage/blob/aio/_lease_async.py +3 -2
- azure/storage/blob/aio/_lease_async.pyi +81 -0
- azure/storage/blob/aio/_quick_query_helper_async.py +3 -3
- {azure_storage_blob-12.26.0b1.dist-info → azure_storage_blob-12.27.0.dist-info}/METADATA +18 -6
- azure_storage_blob-12.27.0.dist-info/RECORD +94 -0
- {azure_storage_blob-12.26.0b1.dist-info → azure_storage_blob-12.27.0.dist-info}/WHEEL +1 -1
- azure_storage_blob-12.26.0b1.dist-info/RECORD +0 -85
- {azure_storage_blob-12.26.0b1.dist-info → azure_storage_blob-12.27.0.dist-info/licenses}/LICENSE +0 -0
- {azure_storage_blob-12.26.0b1.dist-info → azure_storage_blob-12.27.0.dist-info}/top_level.txt +0 -0
@@ -139,13 +139,29 @@ class BlobServiceClient( # type: ignore [misc]
|
|
139
139
|
self._client._config.version = get_api_version(kwargs) # type: ignore [assignment]
|
140
140
|
self._configure_encryption(kwargs)
|
141
141
|
|
142
|
-
def
|
142
|
+
async def __aenter__(self) -> Self:
|
143
|
+
await self._client.__aenter__()
|
144
|
+
return self
|
145
|
+
|
146
|
+
async def __aexit__(self, *args) -> None:
|
147
|
+
await self._client.__aexit__(*args)
|
148
|
+
|
149
|
+
async def close(self) -> None:
|
150
|
+
"""This method is to close the sockets opened by the client.
|
151
|
+
It need not be used when using with a context manager.
|
152
|
+
|
153
|
+
:return: None
|
154
|
+
:rtype: None
|
155
|
+
"""
|
156
|
+
await self._client.close()
|
157
|
+
|
158
|
+
def _format_url(self, hostname: str) -> str:
|
143
159
|
"""Format the endpoint URL according to the current location
|
144
160
|
mode hostname.
|
145
161
|
|
146
162
|
:param str hostname:
|
147
163
|
The hostname of the current location mode.
|
148
|
-
:
|
164
|
+
:return: A formatted endpoint URL including current location mode hostname.
|
149
165
|
:rtype: str
|
150
166
|
"""
|
151
167
|
return f"{self.scheme}://{hostname}/{self._query_str}"
|
@@ -174,10 +190,31 @@ class BlobServiceClient( # type: ignore [misc]
|
|
174
190
|
~azure.core.credentials.AzureSasCredential or
|
175
191
|
~azure.core.credentials_async.AsyncTokenCredential or
|
176
192
|
str or dict[str, str] or None
|
193
|
+
:keyword str api_version:
|
194
|
+
The Storage API version to use for requests. Default value is the most recent service version that is
|
195
|
+
compatible with the current SDK. Setting to an older version may result in reduced feature compatibility.
|
196
|
+
|
197
|
+
.. versionadded:: 12.2.0
|
198
|
+
|
199
|
+
:keyword str secondary_hostname:
|
200
|
+
The hostname of the secondary endpoint.
|
201
|
+
:keyword int max_block_size: The maximum chunk size for uploading a block blob in chunks.
|
202
|
+
Defaults to 4*1024*1024, or 4MB.
|
203
|
+
:keyword int max_single_put_size: If the blob size is less than or equal max_single_put_size, then the blob will
|
204
|
+
be uploaded with only one http PUT request. If the blob size is larger than max_single_put_size,
|
205
|
+
the blob will be uploaded in chunks. Defaults to 64*1024*1024, or 64MB.
|
206
|
+
:keyword int min_large_block_upload_threshold: The minimum chunk size required to use the memory efficient
|
207
|
+
algorithm when uploading a block blob. Defaults to 4*1024*1024+1.
|
208
|
+
:keyword bool use_byte_buffer: Use a byte buffer for block blob uploads. Defaults to False.
|
209
|
+
:keyword int max_page_size: The maximum chunk size for uploading a page blob. Defaults to 4*1024*1024, or 4MB.
|
210
|
+
:keyword int max_single_get_size: The maximum size for a blob to be downloaded in a single call,
|
211
|
+
the exceeded part will be downloaded in chunks (could be parallel). Defaults to 32*1024*1024, or 32MB.
|
212
|
+
:keyword int max_chunk_get_size: The maximum chunk size used for downloading a blob. Defaults to 4*1024*1024,
|
213
|
+
or 4MB.
|
177
214
|
:keyword str audience: The audience to use when requesting tokens for Azure Active Directory
|
178
215
|
authentication. Only has an effect when credential is of type TokenCredential. The value could be
|
179
216
|
https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
|
180
|
-
:
|
217
|
+
:return: A Blob service client.
|
181
218
|
:rtype: ~azure.storage.blob.BlobServiceClient
|
182
219
|
|
183
220
|
.. admonition:: Example:
|
@@ -235,8 +272,8 @@ class BlobServiceClient( # type: ignore [misc]
|
|
235
272
|
The information can also be retrieved if the user has a SAS to a container or blob.
|
236
273
|
The keys in the returned dictionary include 'sku_name' and 'account_kind'.
|
237
274
|
|
238
|
-
:
|
239
|
-
:rtype:
|
275
|
+
:return: A dict of account information (SKU and account type).
|
276
|
+
:rtype: Dict[str, str]
|
240
277
|
|
241
278
|
.. admonition:: Example:
|
242
279
|
|
@@ -309,7 +346,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
309
346
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
310
347
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
311
348
|
#other-client--per-operation-configuration>`__.
|
312
|
-
:
|
349
|
+
:return: An object containing blob service properties such as
|
313
350
|
analytics logging, hour/minute metrics, cors rules, etc.
|
314
351
|
:rtype: Dict[str, Any]
|
315
352
|
|
@@ -379,6 +416,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
379
416
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
380
417
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
381
418
|
#other-client--per-operation-configuration>`__.
|
419
|
+
:return: None
|
382
420
|
:rtype: None
|
383
421
|
|
384
422
|
.. admonition:: Example:
|
@@ -443,7 +481,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
443
481
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
444
482
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
445
483
|
#other-client--per-operation-configuration>`__.
|
446
|
-
:
|
484
|
+
:return: An iterable (auto-paging) of ContainerProperties.
|
447
485
|
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.ContainerProperties]
|
448
486
|
|
449
487
|
.. admonition:: Example:
|
@@ -496,7 +534,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
496
534
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
497
535
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
498
536
|
#other-client--per-operation-configuration>`__.
|
499
|
-
:
|
537
|
+
:return: An iterable (auto-paging) response of BlobProperties.
|
500
538
|
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.FilteredBlob]
|
501
539
|
"""
|
502
540
|
|
@@ -528,7 +566,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
528
566
|
:param metadata:
|
529
567
|
A dict with name-value pairs to associate with the
|
530
568
|
container as metadata. Example: `{'Category':'test'}`
|
531
|
-
:type metadata:
|
569
|
+
:type metadata: Dict[str, str]
|
532
570
|
:param public_access:
|
533
571
|
Possible values include: 'container', 'blob'.
|
534
572
|
:type public_access: str or ~azure.storage.blob.PublicAccess
|
@@ -545,7 +583,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
545
583
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
546
584
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
547
585
|
#other-client--per-operation-configuration>`__.
|
548
|
-
:
|
586
|
+
:return: A container client to interact with the newly created container.
|
549
587
|
:rtype: ~azure.storage.blob.aio.ContainerClient
|
550
588
|
|
551
589
|
.. admonition:: Example:
|
@@ -607,6 +645,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
607
645
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
608
646
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
609
647
|
#other-client--per-operation-configuration>`__.
|
648
|
+
:return: None
|
610
649
|
:rtype: None
|
611
650
|
|
612
651
|
.. admonition:: Example:
|
@@ -646,7 +685,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
646
685
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
647
686
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
648
687
|
#other-client--per-operation-configuration>`__.
|
649
|
-
:
|
688
|
+
:return: A container client for the renamed container.
|
650
689
|
:rtype: ~azure.storage.blob.ContainerClient
|
651
690
|
"""
|
652
691
|
renamed_container = self.get_container_client(new_name)
|
@@ -685,7 +724,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
685
724
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
686
725
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
687
726
|
#other-client--per-operation-configuration>`__.
|
688
|
-
:
|
727
|
+
:return: The recovered soft-deleted ContainerClient.
|
689
728
|
:rtype: ~azure.storage.blob.aio.ContainerClient
|
690
729
|
"""
|
691
730
|
new_name = kwargs.pop('new_name', None)
|
@@ -709,7 +748,7 @@ class BlobServiceClient( # type: ignore [misc]
|
|
709
748
|
The container. This can either be the name of the container,
|
710
749
|
or an instance of ContainerProperties.
|
711
750
|
:type container: str or ~azure.storage.blob.ContainerProperties
|
712
|
-
:
|
751
|
+
:return: A ContainerClient.
|
713
752
|
:rtype: ~azure.storage.blob.aio.ContainerClient
|
714
753
|
|
715
754
|
.. admonition:: Example:
|
@@ -757,10 +796,10 @@ class BlobServiceClient( # type: ignore [misc]
|
|
757
796
|
The optional blob snapshot on which to operate. This can either be the ID of the snapshot,
|
758
797
|
or a dictionary output returned by
|
759
798
|
:func:`~azure.storage.blob.aio.BlobClient.create_snapshot()`.
|
760
|
-
:type snapshot: str or
|
799
|
+
:type snapshot: str or Dict[str, Any]
|
761
800
|
:keyword str version_id: The version id parameter is an opaque DateTime value that, when present,
|
762
801
|
specifies the version of the blob to operate on.
|
763
|
-
:
|
802
|
+
:return: A BlobClient.
|
764
803
|
:rtype: ~azure.storage.blob.aio.BlobClient
|
765
804
|
|
766
805
|
.. admonition:: Example:
|
@@ -0,0 +1,187 @@
|
|
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 types import TracebackType
|
10
|
+
from typing import (
|
11
|
+
Any,
|
12
|
+
Dict,
|
13
|
+
List,
|
14
|
+
Optional,
|
15
|
+
Union,
|
16
|
+
)
|
17
|
+
from typing_extensions import Self
|
18
|
+
|
19
|
+
from azure.core import MatchConditions
|
20
|
+
from azure.core.async_paging import AsyncItemPaged
|
21
|
+
from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
|
22
|
+
from azure.core.credentials_async import AsyncTokenCredential
|
23
|
+
from azure.core.tracing.decorator import distributed_trace
|
24
|
+
from azure.core.tracing.decorator_async import distributed_trace_async
|
25
|
+
|
26
|
+
from ._blob_client_async import BlobClient
|
27
|
+
from ._container_client_async import ContainerClient
|
28
|
+
from ._lease_async import BlobLeaseClient
|
29
|
+
from .._encryption import StorageEncryptionMixin
|
30
|
+
from .._models import (
|
31
|
+
BlobAnalyticsLogging,
|
32
|
+
ContainerEncryptionScope,
|
33
|
+
ContainerProperties,
|
34
|
+
CorsRule,
|
35
|
+
FilteredBlob,
|
36
|
+
Metrics,
|
37
|
+
PublicAccess,
|
38
|
+
RetentionPolicy,
|
39
|
+
StaticWebsite,
|
40
|
+
)
|
41
|
+
from .._shared.base_client import StorageAccountHostsMixin
|
42
|
+
from .._shared.base_client_async import AsyncStorageAccountHostsMixin
|
43
|
+
from .._shared.models import UserDelegationKey
|
44
|
+
|
45
|
+
class BlobServiceClient( # type: ignore [misc]
|
46
|
+
AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, StorageEncryptionMixin
|
47
|
+
):
|
48
|
+
def __init__(
|
49
|
+
self,
|
50
|
+
account_url: str,
|
51
|
+
credential: Optional[
|
52
|
+
Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential]
|
53
|
+
] = None,
|
54
|
+
*,
|
55
|
+
api_version: Optional[str] = None,
|
56
|
+
secondary_hostname: Optional[str] = None,
|
57
|
+
max_block_size: int = 4 * 1024 * 1024,
|
58
|
+
max_single_put_size: int = 64 * 1024 * 1024,
|
59
|
+
min_large_block_upload_threshold: int = 4 * 1024 * 1024 + 1,
|
60
|
+
use_byte_buffer: bool = False,
|
61
|
+
max_page_size: int = 4 * 1024 * 1024,
|
62
|
+
max_single_get_size: int = 32 * 1024 * 1024,
|
63
|
+
max_chunk_get_size: int = 4 * 1024 * 1024,
|
64
|
+
audience: Optional[str] = None,
|
65
|
+
**kwargs: Any
|
66
|
+
) -> None: ...
|
67
|
+
async def __aenter__(self) -> Self: ...
|
68
|
+
async def __aexit__(
|
69
|
+
self, typ: Optional[type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]
|
70
|
+
) -> None: ...
|
71
|
+
async def close(self) -> None: ...
|
72
|
+
@classmethod
|
73
|
+
def from_connection_string(
|
74
|
+
cls,
|
75
|
+
conn_str: str,
|
76
|
+
credential: Optional[
|
77
|
+
Union[str, Dict[str, str], AzureNamedKeyCredential, AzureSasCredential, AsyncTokenCredential]
|
78
|
+
] = None,
|
79
|
+
*,
|
80
|
+
api_version: Optional[str] = None,
|
81
|
+
secondary_hostname: Optional[str] = None,
|
82
|
+
max_block_size: int = 4 * 1024 * 1024,
|
83
|
+
max_single_put_size: int = 64 * 1024 * 1024,
|
84
|
+
min_large_block_upload_threshold: int = 4 * 1024 * 1024 + 1,
|
85
|
+
use_byte_buffer: bool = False,
|
86
|
+
max_page_size: int = 4 * 1024 * 1024,
|
87
|
+
max_single_get_size: int = 32 * 1024 * 1024,
|
88
|
+
max_chunk_get_size: int = 4 * 1024 * 1024,
|
89
|
+
audience: Optional[str] = None,
|
90
|
+
**kwargs: Any
|
91
|
+
) -> Self: ...
|
92
|
+
@distributed_trace_async
|
93
|
+
async def get_user_delegation_key(
|
94
|
+
self, key_start_time: datetime, key_expiry_time: datetime, *, timeout: Optional[int] = None, **kwargs: Any
|
95
|
+
) -> UserDelegationKey: ...
|
96
|
+
@distributed_trace_async
|
97
|
+
async def get_account_information(self, **kwargs: Any) -> Dict[str, str]: ...
|
98
|
+
@distributed_trace_async
|
99
|
+
async def get_service_stats(self, *, timeout: Optional[int] = None, **kwargs: Any) -> Dict[str, Any]: ...
|
100
|
+
@distributed_trace_async
|
101
|
+
async def get_service_properties(self, *, timeout: Optional[int] = None, **kwargs: Any) -> Dict[str, Any]: ...
|
102
|
+
@distributed_trace_async
|
103
|
+
async def set_service_properties(
|
104
|
+
self,
|
105
|
+
analytics_logging: Optional[BlobAnalyticsLogging] = None,
|
106
|
+
hour_metrics: Optional[Metrics] = None,
|
107
|
+
minute_metrics: Optional[Metrics] = None,
|
108
|
+
cors: Optional[List[CorsRule]] = None,
|
109
|
+
target_version: Optional[str] = None,
|
110
|
+
delete_retention_policy: Optional[RetentionPolicy] = None,
|
111
|
+
static_website: Optional[StaticWebsite] = None,
|
112
|
+
**kwargs: Any
|
113
|
+
) -> None: ...
|
114
|
+
@distributed_trace
|
115
|
+
def list_containers(
|
116
|
+
self,
|
117
|
+
name_starts_with: Optional[str] = None,
|
118
|
+
include_metadata: bool = False,
|
119
|
+
*,
|
120
|
+
include_deleted: Optional[bool] = None,
|
121
|
+
include_system: Optional[bool] = None,
|
122
|
+
results_per_page: Optional[int] = None,
|
123
|
+
timeout: Optional[int] = None,
|
124
|
+
**kwargs: Any
|
125
|
+
) -> AsyncItemPaged[ContainerProperties]: ...
|
126
|
+
@distributed_trace
|
127
|
+
def find_blobs_by_tags(
|
128
|
+
self,
|
129
|
+
filter_expression: str,
|
130
|
+
*,
|
131
|
+
results_per_page: Optional[int] = None,
|
132
|
+
timeout: Optional[int] = None,
|
133
|
+
**kwargs: Any
|
134
|
+
) -> AsyncItemPaged[FilteredBlob]: ...
|
135
|
+
@distributed_trace_async
|
136
|
+
async def create_container(
|
137
|
+
self,
|
138
|
+
name: str,
|
139
|
+
metadata: Optional[Dict[str, str]] = None,
|
140
|
+
public_access: Optional[Union[PublicAccess, str]] = None,
|
141
|
+
*,
|
142
|
+
container_encryption_scope: Optional[Union[dict, ContainerEncryptionScope]] = None,
|
143
|
+
timeout: Optional[int] = None,
|
144
|
+
**kwargs: Any
|
145
|
+
) -> ContainerClient: ...
|
146
|
+
@distributed_trace_async
|
147
|
+
async def delete_container(
|
148
|
+
self,
|
149
|
+
container: Union[ContainerProperties, str],
|
150
|
+
lease: Optional[Union[BlobLeaseClient, str]] = None,
|
151
|
+
*,
|
152
|
+
if_modified_since: Optional[datetime] = None,
|
153
|
+
if_unmodified_since: Optional[datetime] = None,
|
154
|
+
etag: Optional[str] = None,
|
155
|
+
match_condition: Optional[MatchConditions] = None,
|
156
|
+
timeout: Optional[int] = None,
|
157
|
+
**kwargs: Any
|
158
|
+
) -> None: ...
|
159
|
+
@distributed_trace_async
|
160
|
+
async def _rename_container(
|
161
|
+
self,
|
162
|
+
name: str,
|
163
|
+
new_name: str,
|
164
|
+
*,
|
165
|
+
lease: Optional[Union[BlobLeaseClient, str]] = None,
|
166
|
+
timeout: Optional[int] = None,
|
167
|
+
**kwargs: Any
|
168
|
+
) -> ContainerClient: ...
|
169
|
+
@distributed_trace_async
|
170
|
+
async def undelete_container(
|
171
|
+
self,
|
172
|
+
deleted_container_name: str,
|
173
|
+
deleted_container_version: str,
|
174
|
+
*,
|
175
|
+
timeout: Optional[int] = None,
|
176
|
+
**kwargs: Any
|
177
|
+
) -> ContainerClient: ...
|
178
|
+
def get_container_client(self, container: Union[ContainerProperties, str]) -> ContainerClient: ...
|
179
|
+
def get_blob_client(
|
180
|
+
self,
|
181
|
+
container: Union[ContainerProperties, str],
|
182
|
+
blob: str,
|
183
|
+
snapshot: Optional[Union[Dict[str, Any], str]] = None,
|
184
|
+
*,
|
185
|
+
version_id: Optional[str] = None,
|
186
|
+
**kwargs: Any
|
187
|
+
) -> BlobClient: ...
|
@@ -62,7 +62,11 @@ if TYPE_CHECKING:
|
|
62
62
|
)
|
63
63
|
|
64
64
|
|
65
|
-
class ContainerClient(
|
65
|
+
class ContainerClient( # type: ignore [misc] # pylint: disable=too-many-public-methods
|
66
|
+
AsyncStorageAccountHostsMixin,
|
67
|
+
StorageAccountHostsMixin,
|
68
|
+
StorageEncryptionMixin
|
69
|
+
):
|
66
70
|
"""A client to interact with a specific container, although that container
|
67
71
|
may not yet exist.
|
68
72
|
|
@@ -143,6 +147,22 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
143
147
|
self._client = self._build_generated_client()
|
144
148
|
self._configure_encryption(kwargs)
|
145
149
|
|
150
|
+
async def __aenter__(self) -> Self:
|
151
|
+
await self._client.__aenter__()
|
152
|
+
return self
|
153
|
+
|
154
|
+
async def __aexit__(self, *args) -> None:
|
155
|
+
await self._client.__aexit__(*args)
|
156
|
+
|
157
|
+
async def close(self) -> None:
|
158
|
+
"""This method is to close the sockets opened by the client.
|
159
|
+
It need not be used when using with a context manager.
|
160
|
+
|
161
|
+
:return: None
|
162
|
+
:rtype: None
|
163
|
+
"""
|
164
|
+
await self._client.close()
|
165
|
+
|
146
166
|
def _build_generated_client(self) -> AzureBlobStorage:
|
147
167
|
client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline)
|
148
168
|
client._config.version = self._api_version # type: ignore [assignment] # pylint: disable=protected-access
|
@@ -186,7 +206,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
186
206
|
:keyword str audience: The audience to use when requesting tokens for Azure Active Directory
|
187
207
|
authentication. Only has an effect when credential is of type TokenCredential. The value could be
|
188
208
|
https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
|
189
|
-
:
|
209
|
+
:return: A container client.
|
190
210
|
:rtype: ~azure.storage.blob.ContainerClient
|
191
211
|
"""
|
192
212
|
try:
|
@@ -239,7 +259,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
239
259
|
:keyword str audience: The audience to use when requesting tokens for Azure Active Directory
|
240
260
|
authentication. Only has an effect when credential is of type TokenCredential. The value could be
|
241
261
|
https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
|
242
|
-
:
|
262
|
+
:return: A container client.
|
243
263
|
:rtype: ~azure.storage.blob.ContainerClient
|
244
264
|
|
245
265
|
.. admonition:: Example:
|
@@ -286,7 +306,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
286
306
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
287
307
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
288
308
|
#other-client--per-operation-configuration>`__.
|
289
|
-
:
|
309
|
+
:return: A dictionary of response headers.
|
290
310
|
:rtype: Dict[str, Union[str, datetime]]
|
291
311
|
|
292
312
|
.. admonition:: Example:
|
@@ -331,7 +351,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
331
351
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
332
352
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
333
353
|
#other-client--per-operation-configuration>`__.
|
334
|
-
:
|
354
|
+
:return: The renamed container.
|
335
355
|
:rtype: ~azure.storage.blob.ContainerClient
|
336
356
|
"""
|
337
357
|
lease = kwargs.pop('lease', None)
|
@@ -385,6 +405,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
385
405
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
386
406
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
387
407
|
#other-client--per-operation-configuration>`__.
|
408
|
+
:return: None
|
388
409
|
:rtype: None
|
389
410
|
|
390
411
|
.. admonition:: Example:
|
@@ -451,7 +472,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
451
472
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
452
473
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
453
474
|
#other-client--per-operation-configuration>`__.
|
454
|
-
:
|
475
|
+
:return: A BlobLeaseClient object, that can be run in a context manager.
|
455
476
|
:rtype: ~azure.storage.blob.aio.BlobLeaseClient
|
456
477
|
|
457
478
|
.. admonition:: Example:
|
@@ -476,7 +497,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
476
497
|
The information can also be retrieved if the user has a SAS to a container or blob.
|
477
498
|
The keys in the returned dictionary include 'sku_name' and 'account_kind'.
|
478
499
|
|
479
|
-
:
|
500
|
+
:return: A dict of account information (SKU and account type).
|
480
501
|
:rtype: dict(str, str)
|
481
502
|
"""
|
482
503
|
try:
|
@@ -536,7 +557,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
536
557
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
537
558
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
538
559
|
#other-client--per-operation-configuration>`__.
|
539
|
-
:
|
560
|
+
:return: boolean
|
540
561
|
:rtype: bool
|
541
562
|
"""
|
542
563
|
try:
|
@@ -578,7 +599,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
578
599
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
579
600
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
580
601
|
#other-client--per-operation-configuration>`__.
|
581
|
-
:
|
602
|
+
:return: Container-updated property dict (Etag and last modified).
|
582
603
|
:rtype: Dict[str, Union[str, datetime]]
|
583
604
|
|
584
605
|
.. admonition:: Example:
|
@@ -613,7 +634,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
613
634
|
|
614
635
|
Defaults to current container's credentials.
|
615
636
|
|
616
|
-
:
|
637
|
+
:return: A BlobServiceClient.
|
617
638
|
:rtype: ~azure.storage.blob.BlobServiceClient
|
618
639
|
|
619
640
|
.. admonition:: Example:
|
@@ -656,7 +677,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
656
677
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
657
678
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
658
679
|
#other-client--per-operation-configuration>`__.
|
659
|
-
:
|
680
|
+
:return: Access policy information in a dict.
|
660
681
|
:rtype: dict[str, Any]
|
661
682
|
|
662
683
|
.. admonition:: Example:
|
@@ -723,7 +744,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
723
744
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
724
745
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
725
746
|
#other-client--per-operation-configuration>`__.
|
726
|
-
:
|
747
|
+
:return: Container-updated property dict (Etag and last modified).
|
727
748
|
:rtype: dict[str, str or ~datetime.datetime]
|
728
749
|
|
729
750
|
.. admonition:: Example:
|
@@ -781,13 +802,16 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
781
802
|
Options include: 'snapshots', 'metadata', 'uncommittedblobs', 'copy', 'deleted', 'deletedwithversions',
|
782
803
|
'tags', 'versions', 'immutabilitypolicy', 'legalhold'.
|
783
804
|
:type include: list[str] or str
|
805
|
+
:keyword int results_per_page:
|
806
|
+
Controls the maximum number of Blobs that will be included in each page of results if using
|
807
|
+
`AsyncItemPaged.by_page()`.
|
784
808
|
:keyword int timeout:
|
785
809
|
Sets the server-side timeout for the operation in seconds. For more details see
|
786
810
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
787
811
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
788
812
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
789
813
|
#other-client--per-operation-configuration>`__.
|
790
|
-
:
|
814
|
+
:return: An iterable (auto-paging) response of BlobProperties.
|
791
815
|
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties]
|
792
816
|
|
793
817
|
.. admonition:: Example:
|
@@ -834,13 +858,16 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
834
858
|
:keyword str name_starts_with:
|
835
859
|
Filters the results to return only blobs whose names
|
836
860
|
begin with the specified prefix.
|
861
|
+
:keyword int results_per_page:
|
862
|
+
Controls the maximum number of Blobs that will be included in each page of results if using
|
863
|
+
`AsyncItemPaged.by_page()`.
|
837
864
|
:keyword int timeout:
|
838
865
|
Sets the server-side timeout for the operation in seconds. For more details see
|
839
866
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
840
867
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
841
868
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
842
869
|
#other-client--per-operation-configuration>`__.
|
843
|
-
:
|
870
|
+
:return: An iterable (auto-paging) response of blob names as strings.
|
844
871
|
:rtype: ~azure.core.async_paging.AsyncItemPaged[str]
|
845
872
|
"""
|
846
873
|
if kwargs.pop('prefix', None):
|
@@ -873,7 +900,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
873
900
|
include: Optional[Union[List[str], str]] = None,
|
874
901
|
delimiter: str = "/",
|
875
902
|
**kwargs: Any
|
876
|
-
) -> AsyncItemPaged[BlobProperties]:
|
903
|
+
) -> AsyncItemPaged[Union[BlobProperties, BlobPrefix]]:
|
877
904
|
"""Returns a generator to list the blobs under the specified container.
|
878
905
|
The generator will lazily follow the continuation tokens returned by
|
879
906
|
the service. This operation will list blobs in accordance with a hierarchy,
|
@@ -898,8 +925,9 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
898
925
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
899
926
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
900
927
|
#other-client--per-operation-configuration>`__.
|
901
|
-
:
|
902
|
-
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties
|
928
|
+
:return: An iterable (auto-paging) response of BlobProperties.
|
929
|
+
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties or
|
930
|
+
~azure.storage.blob.aio.BlobPrefix]
|
903
931
|
"""
|
904
932
|
if kwargs.pop('prefix', None):
|
905
933
|
raise ValueError("Passing 'prefix' has no effect on filtering, " +
|
@@ -944,7 +972,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
944
972
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
945
973
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
946
974
|
#other-client--per-operation-configuration>`__.
|
947
|
-
:
|
975
|
+
:return: An iterable (auto-paging) response of FilteredBlob.
|
948
976
|
:rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.BlobProperties]
|
949
977
|
"""
|
950
978
|
results_per_page = kwargs.pop('results_per_page', None)
|
@@ -1071,7 +1099,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1071
1099
|
function(current: int, total: Optional[int]) where current is the number of bytes transferred
|
1072
1100
|
so far, and total is the size of the blob or None if the size is unknown.
|
1073
1101
|
:paramtype progress_hook: Callable[[int, Optional[int]], Awaitable[None]]
|
1074
|
-
:
|
1102
|
+
:return: A BlobClient to interact with the newly uploaded blob.
|
1075
1103
|
:rtype: ~azure.storage.blob.aio.BlobClient
|
1076
1104
|
|
1077
1105
|
.. admonition:: Example:
|
@@ -1121,7 +1149,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1121
1149
|
and retains the blob or snapshot for specified number of days.
|
1122
1150
|
After specified number of days, blob's data is removed from the service during garbage collection.
|
1123
1151
|
Soft deleted blobs or snapshots are accessible through :func:`list_blobs()` specifying `include=["deleted"]`
|
1124
|
-
Soft-deleted blob or snapshot can be restored using :func:`~azure.storage.blob.aio.BlobClient.
|
1152
|
+
Soft-deleted blob or snapshot can be restored using :func:`~azure.storage.blob.aio.BlobClient.undelete_blob()`
|
1125
1153
|
|
1126
1154
|
:param str blob: The blob with which to interact.
|
1127
1155
|
:param str delete_snapshots:
|
@@ -1169,6 +1197,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1169
1197
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
1170
1198
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
1171
1199
|
#other-client--per-operation-configuration>`__.
|
1200
|
+
:return: None
|
1172
1201
|
:rtype: None
|
1173
1202
|
"""
|
1174
1203
|
if isinstance(blob, BlobProperties):
|
@@ -1295,7 +1324,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1295
1324
|
the timeout will apply to each call individually.
|
1296
1325
|
multiple calls to the Azure service and the timeout will apply to
|
1297
1326
|
each call individually.
|
1298
|
-
:
|
1327
|
+
:return: A streaming object. (StorageStreamDownloader)
|
1299
1328
|
:rtype: ~azure.storage.blob.aio.StorageStreamDownloader
|
1300
1329
|
"""
|
1301
1330
|
if isinstance(blob, BlobProperties):
|
@@ -1327,7 +1356,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1327
1356
|
and retains the blobs or snapshots for specified number of days.
|
1328
1357
|
After specified number of days, blobs' data is removed from the service during garbage collection.
|
1329
1358
|
Soft deleted blobs or snapshots are accessible through :func:`list_blobs()` specifying `include=["deleted"]`
|
1330
|
-
Soft-deleted blobs or snapshots can be restored using :func:`~azure.storage.blob.aio.BlobClient.
|
1359
|
+
Soft-deleted blobs or snapshots can be restored using :func:`~azure.storage.blob.aio.BlobClient.undelete_blob()`
|
1331
1360
|
|
1332
1361
|
The maximum number of blobs that can be deleted in a single request is 256.
|
1333
1362
|
|
@@ -1393,7 +1422,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1393
1422
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
1394
1423
|
#other-client--per-operation-configuration>`__.
|
1395
1424
|
:return: An async iterator of responses, one for each blob in order
|
1396
|
-
:rtype:
|
1425
|
+
:rtype: AsyncIterator[~azure.core.pipeline.transport.AsyncHttpResponse]
|
1397
1426
|
|
1398
1427
|
.. admonition:: Example:
|
1399
1428
|
|
@@ -1485,7 +1514,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1485
1514
|
is raised even if there is a single operation failure. For optimal performance,
|
1486
1515
|
this should be set to False.
|
1487
1516
|
:return: An async iterator of responses, one for each blob in order
|
1488
|
-
:rtype:
|
1517
|
+
:rtype: AsyncIterator[~azure.core.pipeline.transport.AsyncHttpResponse]
|
1489
1518
|
"""
|
1490
1519
|
if self._is_localhost:
|
1491
1520
|
kwargs['url_prepend'] = self.account_name
|
@@ -1546,7 +1575,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1546
1575
|
is raised even if there is a single operation failure. For optimal performance,
|
1547
1576
|
this should be set to False.
|
1548
1577
|
:return: An async iterator of responses, one for each blob in order
|
1549
|
-
:rtype:
|
1578
|
+
:rtype: AsyncIterator[~azure.core.pipeline.transport.AsyncHttpResponse]
|
1550
1579
|
"""
|
1551
1580
|
if self._is_localhost:
|
1552
1581
|
kwargs['url_prepend'] = self.account_name
|
@@ -1577,7 +1606,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, S
|
|
1577
1606
|
or the response returned from :func:`~BlobClient.create_snapshot()`.
|
1578
1607
|
:keyword str version_id: The version id parameter is an opaque DateTime value that, when present,
|
1579
1608
|
specifies the version of the blob to operate on.
|
1580
|
-
:
|
1609
|
+
:return: A BlobClient.
|
1581
1610
|
:rtype: ~azure.storage.blob.aio.BlobClient
|
1582
1611
|
|
1583
1612
|
.. admonition:: Example:
|