azure-storage-blob 12.21.0b1__py3-none-any.whl → 12.23.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 +19 -18
- azure/storage/blob/_blob_client.py +470 -1555
- azure/storage/blob/_blob_client_helpers.py +1242 -0
- azure/storage/blob/_blob_service_client.py +93 -112
- azure/storage/blob/_blob_service_client_helpers.py +27 -0
- azure/storage/blob/_container_client.py +176 -377
- azure/storage/blob/_container_client_helpers.py +266 -0
- azure/storage/blob/_deserialize.py +68 -44
- azure/storage/blob/_download.py +375 -241
- azure/storage/blob/_encryption.py +14 -7
- azure/storage/blob/_generated/_azure_blob_storage.py +2 -1
- azure/storage/blob/_generated/_serialization.py +2 -0
- azure/storage/blob/_generated/aio/_azure_blob_storage.py +2 -1
- azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +1 -7
- azure/storage/blob/_generated/aio/operations/_blob_operations.py +21 -47
- azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +2 -10
- azure/storage/blob/_generated/aio/operations/_container_operations.py +13 -26
- azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +3 -14
- azure/storage/blob/_generated/aio/operations/_service_operations.py +14 -17
- azure/storage/blob/_generated/operations/_append_blob_operations.py +1 -7
- azure/storage/blob/_generated/operations/_blob_operations.py +21 -47
- azure/storage/blob/_generated/operations/_block_blob_operations.py +2 -10
- azure/storage/blob/_generated/operations/_container_operations.py +13 -26
- azure/storage/blob/_generated/operations/_page_blob_operations.py +3 -14
- azure/storage/blob/_generated/operations/_service_operations.py +14 -17
- azure/storage/blob/_generated/py.typed +1 -0
- azure/storage/blob/_lease.py +52 -63
- azure/storage/blob/_list_blobs_helper.py +129 -135
- azure/storage/blob/_models.py +480 -277
- azure/storage/blob/_quick_query_helper.py +30 -31
- azure/storage/blob/_serialize.py +39 -56
- azure/storage/blob/_shared/avro/datafile.py +1 -1
- azure/storage/blob/_shared/avro/datafile_async.py +1 -1
- azure/storage/blob/_shared/base_client.py +3 -1
- azure/storage/blob/_shared/base_client_async.py +1 -1
- azure/storage/blob/_shared/policies.py +16 -15
- azure/storage/blob/_shared/policies_async.py +21 -6
- azure/storage/blob/_shared/response_handlers.py +6 -2
- azure/storage/blob/_shared/shared_access_signature.py +21 -3
- azure/storage/blob/_shared/uploads.py +1 -1
- azure/storage/blob/_shared/uploads_async.py +1 -1
- azure/storage/blob/_shared_access_signature.py +110 -52
- azure/storage/blob/_upload_helpers.py +75 -68
- azure/storage/blob/_version.py +1 -1
- azure/storage/blob/aio/__init__.py +19 -11
- azure/storage/blob/aio/_blob_client_async.py +554 -301
- azure/storage/blob/aio/_blob_service_client_async.py +148 -97
- azure/storage/blob/aio/_container_client_async.py +289 -140
- azure/storage/blob/aio/_download_async.py +485 -337
- azure/storage/blob/aio/_lease_async.py +61 -60
- azure/storage/blob/aio/_list_blobs_helper.py +94 -96
- azure/storage/blob/aio/_models.py +60 -38
- azure/storage/blob/aio/_upload_helpers.py +75 -66
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/METADATA +7 -7
- azure_storage_blob-12.23.0.dist-info/RECORD +84 -0
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/WHEEL +1 -1
- azure/storage/blob/_generated/_vendor.py +0 -16
- azure_storage_blob-12.21.0b1.dist-info/RECORD +0 -81
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/LICENSE +0 -0
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/top_level.txt +0 -0
@@ -7,52 +7,62 @@
|
|
7
7
|
|
8
8
|
import functools
|
9
9
|
import warnings
|
10
|
-
from
|
11
|
-
|
10
|
+
from datetime import datetime
|
11
|
+
from typing import (
|
12
|
+
Any, AnyStr, AsyncIterable, AsyncIterator, cast, Dict, List, IO, Iterable, Optional, overload, Union,
|
12
13
|
TYPE_CHECKING
|
13
14
|
)
|
15
|
+
from urllib.parse import unquote, urlparse
|
16
|
+
from typing_extensions import Self
|
14
17
|
|
15
|
-
from azure.core.async_paging import AsyncItemPaged
|
18
|
+
from azure.core.async_paging import AsyncItemPaged, AsyncList
|
16
19
|
from azure.core.exceptions import HttpResponseError, ResourceNotFoundError
|
17
20
|
from azure.core.pipeline import AsyncPipeline
|
21
|
+
from azure.core.pipeline.transport import AsyncHttpResponse # pylint: disable=C4756
|
18
22
|
from azure.core.tracing.decorator import distributed_trace
|
19
23
|
from azure.core.tracing.decorator_async import distributed_trace_async
|
20
24
|
|
21
|
-
from
|
22
|
-
from
|
23
|
-
from
|
24
|
-
from
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
from ._blob_client_async import BlobClient
|
26
|
+
from ._download_async import StorageStreamDownloader
|
27
|
+
from ._lease_async import BlobLeaseClient
|
28
|
+
from ._list_blobs_helper import BlobNamesPaged, BlobPropertiesPaged, BlobPrefix
|
29
|
+
from ._models import FilteredBlobPaged
|
30
|
+
from .._container_client_helpers import (
|
31
|
+
_format_url,
|
32
|
+
_generate_delete_blobs_options,
|
33
|
+
_generate_set_tiers_options,
|
34
|
+
_parse_url
|
28
35
|
)
|
29
|
-
from .._generated.aio import AzureBlobStorage
|
30
|
-
from .._generated.models import SignedIdentifier
|
31
|
-
from .._container_client import ContainerClient as ContainerClientBase, _get_blob_name
|
32
36
|
from .._deserialize import deserialize_container_properties
|
33
|
-
from ._download_async import StorageStreamDownloader
|
34
37
|
from .._encryption import StorageEncryptionMixin
|
38
|
+
from .._generated.aio import AzureBlobStorage
|
39
|
+
from .._generated.models import SignedIdentifier
|
40
|
+
from .._list_blobs_helper import IgnoreListBlobsDeserializer
|
35
41
|
from .._models import ContainerProperties, BlobType, BlobProperties, FilteredBlob
|
36
42
|
from .._serialize import get_modify_conditions, get_container_cpk_scope_info, get_api_version, get_access_conditions
|
37
|
-
from .
|
38
|
-
from .
|
39
|
-
from .
|
40
|
-
from ..
|
41
|
-
from .
|
43
|
+
from .._shared.base_client import StorageAccountHostsMixin
|
44
|
+
from .._shared.base_client_async import AsyncStorageAccountHostsMixin, AsyncTransportWrapper, parse_connection_str
|
45
|
+
from .._shared.policies_async import ExponentialRetry
|
46
|
+
from .._shared.request_handlers import add_metadata_headers, serialize_iso
|
47
|
+
from .._shared.response_handlers import (
|
48
|
+
process_storage_error,
|
49
|
+
return_headers_and_deserialized,
|
50
|
+
return_response_headers
|
51
|
+
)
|
42
52
|
|
43
53
|
if TYPE_CHECKING:
|
44
54
|
from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
|
45
55
|
from azure.core.credentials_async import AsyncTokenCredential
|
46
|
-
from
|
47
|
-
from
|
48
|
-
from .._models import ( # pylint: disable=unused-import
|
56
|
+
from ._blob_service_client_async import BlobServiceClient
|
57
|
+
from .._models import (
|
49
58
|
AccessPolicy,
|
50
59
|
StandardBlobTier,
|
51
60
|
PremiumPageBlobTier,
|
52
|
-
PublicAccess
|
61
|
+
PublicAccess
|
62
|
+
)
|
53
63
|
|
54
64
|
|
55
|
-
class ContainerClient(AsyncStorageAccountHostsMixin,
|
65
|
+
class ContainerClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, StorageEncryptionMixin): # type: ignore [misc] # pylint: disable=too-many-public-methods
|
56
66
|
"""A client to interact with a specific container, although that container
|
57
67
|
may not yet exist.
|
58
68
|
|
@@ -116,29 +126,143 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
116
126
|
:caption: Creating the container client directly.
|
117
127
|
"""
|
118
128
|
def __init__(
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
129
|
+
self, account_url: str,
|
130
|
+
container_name: str,
|
131
|
+
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] = None, # pylint: disable=line-too-long
|
132
|
+
**kwargs: Any
|
133
|
+
) -> None:
|
124
134
|
kwargs['retry_policy'] = kwargs.get('retry_policy') or ExponentialRetry(**kwargs)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
135
|
+
parsed_url, sas_token = _parse_url(account_url=account_url, container_name=container_name)
|
136
|
+
|
137
|
+
self.container_name = container_name
|
138
|
+
# This parameter is used for the hierarchy traversal. Give precedence to credential.
|
139
|
+
self._raw_credential = credential if credential else sas_token
|
140
|
+
self._query_str, credential = self._format_query_string(sas_token, credential)
|
141
|
+
super(ContainerClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs)
|
130
142
|
self._api_version = get_api_version(kwargs)
|
131
143
|
self._client = self._build_generated_client()
|
132
144
|
self._configure_encryption(kwargs)
|
133
145
|
|
134
|
-
def _build_generated_client(self):
|
146
|
+
def _build_generated_client(self) -> AzureBlobStorage:
|
135
147
|
client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline)
|
136
|
-
client._config.version = self._api_version # pylint: disable=protected-access
|
148
|
+
client._config.version = self._api_version # type: ignore [assignment] # pylint: disable=protected-access
|
137
149
|
return client
|
138
150
|
|
151
|
+
def _format_url(self, hostname):
|
152
|
+
return _format_url(
|
153
|
+
container_name=self.container_name,
|
154
|
+
hostname=hostname,
|
155
|
+
scheme=self.scheme,
|
156
|
+
query_str=self._query_str
|
157
|
+
)
|
158
|
+
|
159
|
+
@classmethod
|
160
|
+
def from_container_url(
|
161
|
+
cls, container_url: str,
|
162
|
+
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] = None, # pylint: disable=line-too-long
|
163
|
+
**kwargs: Any
|
164
|
+
) -> Self:
|
165
|
+
"""Create ContainerClient from a container url.
|
166
|
+
|
167
|
+
:param str container_url:
|
168
|
+
The full endpoint URL to the Container, including SAS token if used. This could be
|
169
|
+
either the primary endpoint, or the secondary endpoint depending on the current `location_mode`.
|
170
|
+
:type container_url: str
|
171
|
+
:param credential:
|
172
|
+
The credentials with which to authenticate. This is optional if the
|
173
|
+
account URL already has a SAS token, or the connection string already has shared
|
174
|
+
access key values. The value can be a SAS token string,
|
175
|
+
an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
|
176
|
+
an account shared access key, or an instance of a TokenCredentials class from azure.identity.
|
177
|
+
If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
|
178
|
+
- except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.
|
179
|
+
If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"
|
180
|
+
should be the storage account key.
|
181
|
+
:type credential:
|
182
|
+
~azure.core.credentials.AzureNamedKeyCredential or
|
183
|
+
~azure.core.credentials.AzureSasCredential or
|
184
|
+
~azure.core.credentials_async.AsyncTokenCredential or
|
185
|
+
str or dict[str, str] or None
|
186
|
+
:keyword str audience: The audience to use when requesting tokens for Azure Active Directory
|
187
|
+
authentication. Only has an effect when credential is of type TokenCredential. The value could be
|
188
|
+
https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
|
189
|
+
:returns: A container client.
|
190
|
+
:rtype: ~azure.storage.blob.ContainerClient
|
191
|
+
"""
|
192
|
+
try:
|
193
|
+
if not container_url.lower().startswith('http'):
|
194
|
+
container_url = "https://" + container_url
|
195
|
+
except AttributeError as exc:
|
196
|
+
raise ValueError("Container URL must be a string.") from exc
|
197
|
+
parsed_url = urlparse(container_url)
|
198
|
+
if not parsed_url.netloc:
|
199
|
+
raise ValueError(f"Invalid URL: {container_url}")
|
200
|
+
|
201
|
+
container_path = parsed_url.path.strip('/').split('/')
|
202
|
+
account_path = ""
|
203
|
+
if len(container_path) > 1:
|
204
|
+
account_path = "/" + "/".join(container_path[:-1])
|
205
|
+
account_url = f"{parsed_url.scheme}://{parsed_url.netloc.rstrip('/')}{account_path}?{parsed_url.query}"
|
206
|
+
container_name = unquote(container_path[-1])
|
207
|
+
if not container_name:
|
208
|
+
raise ValueError("Invalid URL. Please provide a URL with a valid container name")
|
209
|
+
return cls(account_url, container_name=container_name, credential=credential, **kwargs)
|
210
|
+
|
211
|
+
@classmethod
|
212
|
+
def from_connection_string(
|
213
|
+
cls, conn_str: str,
|
214
|
+
container_name: str,
|
215
|
+
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] = None, # pylint: disable=line-too-long
|
216
|
+
**kwargs: Any
|
217
|
+
) -> Self:
|
218
|
+
"""Create ContainerClient from a Connection String.
|
219
|
+
|
220
|
+
:param str conn_str:
|
221
|
+
A connection string to an Azure Storage account.
|
222
|
+
:param container_name:
|
223
|
+
The container name for the blob.
|
224
|
+
:type container_name: str
|
225
|
+
:param credential:
|
226
|
+
The credentials with which to authenticate. This is optional if the
|
227
|
+
account URL already has a SAS token, or the connection string already has shared
|
228
|
+
access key values. The value can be a SAS token string,
|
229
|
+
an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials,
|
230
|
+
an account shared access key, or an instance of a TokenCredentials class from azure.identity.
|
231
|
+
Credentials provided here will take precedence over those in the connection string.
|
232
|
+
If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"
|
233
|
+
should be the storage account key.
|
234
|
+
:type credential:
|
235
|
+
~azure.core.credentials.AzureNamedKeyCredential or
|
236
|
+
~azure.core.credentials.AzureSasCredential or
|
237
|
+
~azure.core.credentials_async.AsyncTokenCredential or
|
238
|
+
str or dict[str, str] or None
|
239
|
+
:keyword str audience: The audience to use when requesting tokens for Azure Active Directory
|
240
|
+
authentication. Only has an effect when credential is of type TokenCredential. The value could be
|
241
|
+
https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
|
242
|
+
:returns: A container client.
|
243
|
+
:rtype: ~azure.storage.blob.ContainerClient
|
244
|
+
|
245
|
+
.. admonition:: Example:
|
246
|
+
|
247
|
+
.. literalinclude:: ../samples/blob_samples_authentication.py
|
248
|
+
:start-after: [START auth_from_connection_string_container]
|
249
|
+
:end-before: [END auth_from_connection_string_container]
|
250
|
+
:language: python
|
251
|
+
:dedent: 8
|
252
|
+
:caption: Creating the ContainerClient from a connection string.
|
253
|
+
"""
|
254
|
+
account_url, secondary, credential = parse_connection_str(conn_str, credential, 'blob')
|
255
|
+
if 'secondary_hostname' not in kwargs:
|
256
|
+
kwargs['secondary_hostname'] = secondary
|
257
|
+
return cls(
|
258
|
+
account_url, container_name=container_name, credential=credential, **kwargs)
|
259
|
+
|
139
260
|
@distributed_trace_async
|
140
|
-
async def create_container(
|
141
|
-
|
261
|
+
async def create_container(
|
262
|
+
self, metadata: Optional[Dict[str, str]] = None,
|
263
|
+
public_access: Optional[Union["PublicAccess", str]] = None,
|
264
|
+
**kwargs: Any
|
265
|
+
) -> Dict[str, Union[str, datetime]]:
|
142
266
|
"""
|
143
267
|
Creates a new container under the specified account. If the container
|
144
268
|
with the same name already exists, the operation fails.
|
@@ -161,7 +285,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
161
285
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
162
286
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
163
287
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
164
|
-
#other-client--per-operation-configuration>`
|
288
|
+
#other-client--per-operation-configuration>`__.
|
165
289
|
:returns: A dictionary of response headers.
|
166
290
|
:rtype: Dict[str, Union[str, datetime]]
|
167
291
|
|
@@ -190,8 +314,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
190
314
|
process_storage_error(error)
|
191
315
|
|
192
316
|
@distributed_trace_async
|
193
|
-
async def _rename_container(self, new_name, **kwargs):
|
194
|
-
# type: (str, **Any) -> ContainerClient
|
317
|
+
async def _rename_container(self, new_name: str, **kwargs: Any) -> "ContainerClient":
|
195
318
|
"""Renames a container.
|
196
319
|
|
197
320
|
Operation is successful only if the source container exists.
|
@@ -207,7 +330,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
207
330
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
208
331
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
209
332
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
210
|
-
#other-client--per-operation-configuration>`
|
333
|
+
#other-client--per-operation-configuration>`__.
|
211
334
|
:returns: The renamed container.
|
212
335
|
:rtype: ~azure.storage.blob.ContainerClient
|
213
336
|
"""
|
@@ -229,9 +352,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
229
352
|
process_storage_error(error)
|
230
353
|
|
231
354
|
@distributed_trace_async
|
232
|
-
async def delete_container(
|
233
|
-
self, **kwargs):
|
234
|
-
# type: (Any) -> None
|
355
|
+
async def delete_container(self, **kwargs: Any) -> None:
|
235
356
|
"""
|
236
357
|
Marks the specified container for deletion. The container and any blobs
|
237
358
|
contained within it are later deleted during garbage collection.
|
@@ -263,7 +384,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
263
384
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
264
385
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
265
386
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
266
|
-
#other-client--per-operation-configuration>`
|
387
|
+
#other-client--per-operation-configuration>`__.
|
267
388
|
:rtype: None
|
268
389
|
|
269
390
|
.. admonition:: Example:
|
@@ -290,10 +411,10 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
290
411
|
|
291
412
|
@distributed_trace_async
|
292
413
|
async def acquire_lease(
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
414
|
+
self, lease_duration: int =-1,
|
415
|
+
lease_id: Optional[str] = None,
|
416
|
+
**kwargs: Any
|
417
|
+
) -> BlobLeaseClient:
|
297
418
|
"""
|
298
419
|
Requests a new lease. If the container does not have an active lease,
|
299
420
|
the Blob service creates a lease on the container and returns a new
|
@@ -329,7 +450,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
329
450
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
330
451
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
331
452
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
332
|
-
#other-client--per-operation-configuration>`
|
453
|
+
#other-client--per-operation-configuration>`__.
|
333
454
|
:returns: A BlobLeaseClient object, that can be run in a context manager.
|
334
455
|
:rtype: ~azure.storage.blob.aio.BlobLeaseClient
|
335
456
|
|
@@ -349,8 +470,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
349
470
|
return lease
|
350
471
|
|
351
472
|
@distributed_trace_async
|
352
|
-
async def get_account_information(self, **kwargs):
|
353
|
-
# type: (**Any) -> Dict[str, str]
|
473
|
+
async def get_account_information(self, **kwargs: Any) -> Dict[str, str]:
|
354
474
|
"""Gets information related to the storage account.
|
355
475
|
|
356
476
|
The information can also be retrieved if the user has a SAS to a container or blob.
|
@@ -365,8 +485,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
365
485
|
process_storage_error(error)
|
366
486
|
|
367
487
|
@distributed_trace_async
|
368
|
-
async def get_container_properties(self, **kwargs):
|
369
|
-
# type: (**Any) -> ContainerProperties
|
488
|
+
async def get_container_properties(self, **kwargs: Any) -> ContainerProperties:
|
370
489
|
"""Returns all user-defined metadata and system properties for the specified
|
371
490
|
container. The data returned does not include the container's list of blobs.
|
372
491
|
|
@@ -379,7 +498,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
379
498
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
380
499
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
381
500
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
382
|
-
#other-client--per-operation-configuration>`
|
501
|
+
#other-client--per-operation-configuration>`__.
|
383
502
|
:return: Properties for the specified container within a container object.
|
384
503
|
:rtype: ~azure.storage.blob.ContainerProperties
|
385
504
|
|
@@ -407,8 +526,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
407
526
|
return response # type: ignore
|
408
527
|
|
409
528
|
@distributed_trace_async
|
410
|
-
async def exists(self, **kwargs):
|
411
|
-
# type: (**Any) -> bool
|
529
|
+
async def exists(self, **kwargs: Any) -> bool:
|
412
530
|
"""
|
413
531
|
Returns True if a container exists and returns False otherwise.
|
414
532
|
|
@@ -417,7 +535,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
417
535
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
418
536
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
419
537
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
420
|
-
#other-client--per-operation-configuration>`
|
538
|
+
#other-client--per-operation-configuration>`__.
|
421
539
|
:returns: boolean
|
422
540
|
:rtype: bool
|
423
541
|
"""
|
@@ -431,11 +549,10 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
431
549
|
return False
|
432
550
|
|
433
551
|
@distributed_trace_async
|
434
|
-
async def set_container_metadata(
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
# type: (...) -> Dict[str, Union[str, datetime]]
|
552
|
+
async def set_container_metadata(
|
553
|
+
self, metadata: Optional[Dict[str, str]] = None,
|
554
|
+
**kwargs: Any
|
555
|
+
) -> Dict[str, Union[str, datetime]]:
|
439
556
|
"""Sets one or more user-defined name-value pairs for the specified
|
440
557
|
container. Each call to this operation replaces all existing metadata
|
441
558
|
attached to the container. To remove all metadata from the container,
|
@@ -460,7 +577,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
460
577
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
461
578
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
462
579
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
463
|
-
#other-client--per-operation-configuration>`
|
580
|
+
#other-client--per-operation-configuration>`__.
|
464
581
|
:returns: Container-updated property dict (Etag and last modified).
|
465
582
|
:rtype: Dict[str, Union[str, datetime]]
|
466
583
|
|
@@ -491,8 +608,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
491
608
|
process_storage_error(error)
|
492
609
|
|
493
610
|
@distributed_trace
|
494
|
-
def _get_blob_service_client(self): # pylint: disable=client-method-missing-kwargs
|
495
|
-
# type: (...) -> BlobServiceClient
|
611
|
+
def _get_blob_service_client(self) -> "BlobServiceClient": # pylint: disable=client-method-missing-kwargs
|
496
612
|
"""Get a client to interact with the container's parent service account.
|
497
613
|
|
498
614
|
Defaults to current container's credentials.
|
@@ -513,7 +629,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
513
629
|
if not isinstance(self._pipeline._transport, AsyncTransportWrapper): # pylint: disable = protected-access
|
514
630
|
_pipeline = AsyncPipeline(
|
515
631
|
transport=AsyncTransportWrapper(self._pipeline._transport), # pylint: disable = protected-access
|
516
|
-
policies=self._pipeline._impl_policies # pylint: disable = protected-access
|
632
|
+
policies=self._pipeline._impl_policies #type: ignore [arg-type] # pylint: disable = protected-access
|
517
633
|
)
|
518
634
|
else:
|
519
635
|
_pipeline = self._pipeline # pylint: disable = protected-access
|
@@ -526,8 +642,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
526
642
|
|
527
643
|
|
528
644
|
@distributed_trace_async
|
529
|
-
async def get_container_access_policy(self, **kwargs):
|
530
|
-
# type: (Any) -> Dict[str, Any]
|
645
|
+
async def get_container_access_policy(self, **kwargs: Any) -> Dict[str, Any]:
|
531
646
|
"""Gets the permissions for the specified container.
|
532
647
|
The permissions indicate whether container data may be accessed publicly.
|
533
648
|
|
@@ -540,7 +655,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
540
655
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
541
656
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
542
657
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
543
|
-
#other-client--per-operation-configuration>`
|
658
|
+
#other-client--per-operation-configuration>`__.
|
544
659
|
:returns: Access policy information in a dict.
|
545
660
|
:rtype: dict[str, Any]
|
546
661
|
|
@@ -571,10 +686,10 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
571
686
|
|
572
687
|
@distributed_trace_async
|
573
688
|
async def set_container_access_policy(
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
689
|
+
self, signed_identifiers: Dict[str, "AccessPolicy"],
|
690
|
+
public_access: Optional[Union[str, "PublicAccess"]] = None,
|
691
|
+
**kwargs: Any
|
692
|
+
) -> Dict[str, Union[str, datetime]]:
|
578
693
|
"""Sets the permissions for the specified container or stored access
|
579
694
|
policies that may be used with Shared Access Signatures. The permissions
|
580
695
|
indicate whether blobs in a container may be accessed publicly.
|
@@ -607,7 +722,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
607
722
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
608
723
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
609
724
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
610
|
-
#other-client--per-operation-configuration>`
|
725
|
+
#other-client--per-operation-configuration>`__.
|
611
726
|
:returns: Container-updated property dict (Etag and last modified).
|
612
727
|
:rtype: dict[str, str or ~datetime.datetime]
|
613
728
|
|
@@ -637,14 +752,14 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
637
752
|
mod_conditions = get_modify_conditions(kwargs)
|
638
753
|
access_conditions = get_access_conditions(lease)
|
639
754
|
try:
|
640
|
-
return await self._client.container.set_access_policy(
|
755
|
+
return cast(Dict[str, Union[str, datetime]], await self._client.container.set_access_policy(
|
641
756
|
container_acl=signed_identifiers or None,
|
642
757
|
timeout=timeout,
|
643
758
|
access=public_access,
|
644
759
|
lease_access_conditions=access_conditions,
|
645
760
|
modified_access_conditions=mod_conditions,
|
646
761
|
cls=return_response_headers,
|
647
|
-
**kwargs)
|
762
|
+
**kwargs))
|
648
763
|
except HttpResponseError as error:
|
649
764
|
process_storage_error(error)
|
650
765
|
|
@@ -671,7 +786,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
671
786
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
672
787
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
673
788
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
674
|
-
#other-client--per-operation-configuration>`
|
789
|
+
#other-client--per-operation-configuration>`__.
|
675
790
|
:returns: An iterable (auto-paging) response of BlobProperties.
|
676
791
|
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties]
|
677
792
|
|
@@ -702,6 +817,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
702
817
|
command,
|
703
818
|
prefix=name_starts_with,
|
704
819
|
results_per_page=results_per_page,
|
820
|
+
container=self.container_name,
|
705
821
|
page_iterator_class=BlobPropertiesPaged
|
706
822
|
)
|
707
823
|
|
@@ -723,7 +839,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
723
839
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
724
840
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
725
841
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
726
|
-
#other-client--per-operation-configuration>`
|
842
|
+
#other-client--per-operation-configuration>`__.
|
727
843
|
:returns: An iterable (auto-paging) response of blob names as strings.
|
728
844
|
:rtype: ~azure.core.async_paging.AsyncItemPaged[str]
|
729
845
|
"""
|
@@ -748,6 +864,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
748
864
|
command,
|
749
865
|
prefix=name_starts_with,
|
750
866
|
results_per_page=results_per_page,
|
867
|
+
container=self.container_name,
|
751
868
|
page_iterator_class=BlobNamesPaged)
|
752
869
|
|
753
870
|
@distributed_trace
|
@@ -756,7 +873,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
756
873
|
include: Optional[Union[List[str], str]] = None,
|
757
874
|
delimiter: str = "/",
|
758
875
|
**kwargs: Any
|
759
|
-
|
876
|
+
) -> AsyncItemPaged[BlobProperties]:
|
760
877
|
"""Returns a generator to list the blobs under the specified container.
|
761
878
|
The generator will lazily follow the continuation tokens returned by
|
762
879
|
the service. This operation will list blobs in accordance with a hierarchy,
|
@@ -780,7 +897,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
780
897
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
781
898
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
782
899
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
783
|
-
#other-client--per-operation-configuration>`
|
900
|
+
#other-client--per-operation-configuration>`__.
|
784
901
|
:returns: An iterable (auto-paging) response of BlobProperties.
|
785
902
|
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.blob.BlobProperties]
|
786
903
|
"""
|
@@ -803,14 +920,14 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
803
920
|
command,
|
804
921
|
prefix=name_starts_with,
|
805
922
|
results_per_page=results_per_page,
|
923
|
+
container=self.container_name,
|
806
924
|
delimiter=delimiter)
|
807
925
|
|
808
926
|
@distributed_trace
|
809
927
|
def find_blobs_by_tags(
|
810
|
-
self, filter_expression
|
811
|
-
**kwargs
|
812
|
-
):
|
813
|
-
# type: (...) -> AsyncItemPaged[FilteredBlob]
|
928
|
+
self, filter_expression: str,
|
929
|
+
**kwargs: Any
|
930
|
+
) -> AsyncItemPaged[FilteredBlob]:
|
814
931
|
"""Returns a generator to list the blobs under the specified container whose tags
|
815
932
|
match the given search expression.
|
816
933
|
The generator will lazily follow the continuation tokens returned by
|
@@ -826,7 +943,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
826
943
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
827
944
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
828
945
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
829
|
-
#other-client--per-operation-configuration>`
|
946
|
+
#other-client--per-operation-configuration>`__.
|
830
947
|
:returns: An iterable (auto-paging) response of FilteredBlob.
|
831
948
|
:rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.BlobProperties]
|
832
949
|
"""
|
@@ -839,17 +956,18 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
839
956
|
**kwargs)
|
840
957
|
return AsyncItemPaged(
|
841
958
|
command, results_per_page=results_per_page,
|
959
|
+
container=self.container_name,
|
842
960
|
page_iterator_class=FilteredBlobPaged)
|
843
961
|
|
844
962
|
@distributed_trace_async
|
845
963
|
async def upload_blob(
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
964
|
+
self, name: str,
|
965
|
+
data: Union[bytes, str, Iterable[AnyStr], AsyncIterable[AnyStr], IO[AnyStr]],
|
966
|
+
blob_type: Union[str, BlobType] = BlobType.BLOCKBLOB,
|
967
|
+
length: Optional[int] = None,
|
968
|
+
metadata: Optional[Dict[str, str]] = None,
|
969
|
+
**kwargs
|
970
|
+
) -> BlobClient:
|
853
971
|
"""Creates a new blob from a data source with automatic chunking.
|
854
972
|
|
855
973
|
:param str name: The blob with which to interact.
|
@@ -913,7 +1031,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
913
1031
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
914
1032
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
915
1033
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
916
|
-
#other-client--per-operation-configuration>`
|
1034
|
+
#other-client--per-operation-configuration>`__. This method may make multiple calls to the service and
|
917
1035
|
the timeout will apply to each call individually.
|
918
1036
|
multiple calls to the Azure service and the timeout will apply to
|
919
1037
|
each call individually.
|
@@ -988,9 +1106,9 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
988
1106
|
|
989
1107
|
@distributed_trace_async
|
990
1108
|
async def delete_blob(
|
991
|
-
|
992
|
-
|
993
|
-
|
1109
|
+
self, blob: str,
|
1110
|
+
delete_snapshots: Optional[str] = None,
|
1111
|
+
**kwargs: Any
|
994
1112
|
) -> None:
|
995
1113
|
"""Marks the specified blob or snapshot for deletion.
|
996
1114
|
|
@@ -1015,6 +1133,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1015
1133
|
value that, when present, specifies the version of the blob to delete.
|
1016
1134
|
|
1017
1135
|
.. versionadded:: 12.4.0
|
1136
|
+
|
1018
1137
|
This keyword argument was introduced in API version '2019-12-12'.
|
1019
1138
|
|
1020
1139
|
:keyword lease:
|
@@ -1049,7 +1168,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1049
1168
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
1050
1169
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
1051
1170
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
1052
|
-
#other-client--per-operation-configuration>`
|
1171
|
+
#other-client--per-operation-configuration>`__.
|
1053
1172
|
:rtype: None
|
1054
1173
|
"""
|
1055
1174
|
if isinstance(blob, BlobProperties):
|
@@ -1068,35 +1187,35 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1068
1187
|
|
1069
1188
|
@overload
|
1070
1189
|
async def download_blob(
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1190
|
+
self, blob: str,
|
1191
|
+
offset: Optional[int] = None,
|
1192
|
+
length: Optional[int] = None,
|
1193
|
+
*,
|
1194
|
+
encoding: str,
|
1195
|
+
**kwargs: Any
|
1077
1196
|
) -> StorageStreamDownloader[str]:
|
1078
1197
|
...
|
1079
1198
|
|
1080
1199
|
@overload
|
1081
1200
|
async def download_blob(
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1201
|
+
self, blob: str,
|
1202
|
+
offset: Optional[int] = None,
|
1203
|
+
length: Optional[int] = None,
|
1204
|
+
*,
|
1205
|
+
encoding: None = None,
|
1206
|
+
**kwargs: Any
|
1088
1207
|
) -> StorageStreamDownloader[bytes]:
|
1089
1208
|
...
|
1090
1209
|
|
1091
1210
|
@distributed_trace_async
|
1092
1211
|
async def download_blob(
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
) -> StorageStreamDownloader:
|
1212
|
+
self, blob: str,
|
1213
|
+
offset: Optional[int] = None,
|
1214
|
+
length: Optional[int] = None,
|
1215
|
+
*,
|
1216
|
+
encoding: Union[str, None] = None,
|
1217
|
+
**kwargs: Any
|
1218
|
+
) -> Union[StorageStreamDownloader[str], StorageStreamDownloader[bytes]]:
|
1100
1219
|
"""Downloads a blob to the StorageStreamDownloader. The readall() method must
|
1101
1220
|
be used to read all the content or readinto() must be used to download the blob into
|
1102
1221
|
a stream. Using chunks() returns an async iterator which allows the user to iterate over the content in chunks.
|
@@ -1113,6 +1232,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1113
1232
|
value that, when present, specifies the version of the blob to download.
|
1114
1233
|
|
1115
1234
|
.. versionadded:: 12.4.0
|
1235
|
+
|
1116
1236
|
This keyword argument was introduced in API version '2019-12-12'.
|
1117
1237
|
|
1118
1238
|
:keyword bool validate_content:
|
@@ -1171,7 +1291,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1171
1291
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
1172
1292
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
1173
1293
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
1174
|
-
#other-client--per-operation-configuration>`
|
1294
|
+
#other-client--per-operation-configuration>`__. This method may make multiple calls to the service and
|
1175
1295
|
the timeout will apply to each call individually.
|
1176
1296
|
multiple calls to the Azure service and the timeout will apply to
|
1177
1297
|
each call individually.
|
@@ -1196,7 +1316,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1196
1316
|
async def delete_blobs(
|
1197
1317
|
self, *blobs: Union[str, Dict[str, Any], BlobProperties],
|
1198
1318
|
**kwargs: Any
|
1199
|
-
) -> AsyncIterator[
|
1319
|
+
) -> AsyncIterator[AsyncHttpResponse]:
|
1200
1320
|
"""Marks the specified blobs or snapshots for deletion.
|
1201
1321
|
|
1202
1322
|
The blobs are later deleted during garbage collection.
|
@@ -1222,6 +1342,8 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1222
1342
|
key: 'name', value type: str
|
1223
1343
|
snapshot you want to delete:
|
1224
1344
|
key: 'snapshot', value type: str
|
1345
|
+
version id:
|
1346
|
+
key: 'version_id', value type: str
|
1225
1347
|
whether to delete snapshots when deleting blob:
|
1226
1348
|
key: 'delete_snapshots', value: 'include' or 'only'
|
1227
1349
|
if the blob modified or not:
|
@@ -1237,7 +1359,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1237
1359
|
timeout for subrequest:
|
1238
1360
|
key: 'timeout', value type: int
|
1239
1361
|
|
1240
|
-
:type blobs: str
|
1362
|
+
:type blobs: Union[str, Dict[str, Any], BlobProperties]
|
1241
1363
|
:keyword str delete_snapshots:
|
1242
1364
|
Required if a blob has associated snapshots. Values include:
|
1243
1365
|
- "only": Deletes only the blobs snapshots.
|
@@ -1269,7 +1391,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1269
1391
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
1270
1392
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
1271
1393
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
1272
|
-
#other-client--per-operation-configuration>`
|
1394
|
+
#other-client--per-operation-configuration>`__.
|
1273
1395
|
:return: An async iterator of responses, one for each blob in order
|
1274
1396
|
:rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse]
|
1275
1397
|
|
@@ -1283,18 +1405,26 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1283
1405
|
:caption: Deleting multiple blobs.
|
1284
1406
|
"""
|
1285
1407
|
if len(blobs) == 0:
|
1286
|
-
return
|
1287
|
-
|
1288
|
-
|
1408
|
+
return AsyncList([])
|
1409
|
+
if self._is_localhost:
|
1410
|
+
kwargs['url_prepend'] = self.account_name
|
1411
|
+
|
1412
|
+
reqs, options = _generate_delete_blobs_options(
|
1413
|
+
self._query_str,
|
1414
|
+
self.container_name,
|
1415
|
+
self._client,
|
1416
|
+
*blobs,
|
1417
|
+
**kwargs
|
1418
|
+
)
|
1289
1419
|
|
1290
|
-
return await self._batch_send(*reqs, **options)
|
1420
|
+
return cast(AsyncIterator[AsyncHttpResponse], await self._batch_send(*reqs, **options))
|
1291
1421
|
|
1292
1422
|
@distributed_trace_async
|
1293
1423
|
async def set_standard_blob_tier_blobs(
|
1294
1424
|
self, standard_blob_tier: Union[str, 'StandardBlobTier'],
|
1295
1425
|
*blobs: Union[str, Dict[str, Any], BlobProperties],
|
1296
1426
|
**kwargs: Any
|
1297
|
-
) -> AsyncIterator[
|
1427
|
+
) -> AsyncIterator[AsyncHttpResponse]:
|
1298
1428
|
"""This operation sets the tier on block blobs.
|
1299
1429
|
|
1300
1430
|
A block blob's tier determines Hot/Cool/Archive storage type.
|
@@ -1321,6 +1451,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1321
1451
|
|
1322
1452
|
.. note::
|
1323
1453
|
When the blob type is dict, here's a list of keys, value rules.
|
1454
|
+
|
1324
1455
|
blob name:
|
1325
1456
|
key: 'name', value type: str
|
1326
1457
|
standard blob tier:
|
@@ -1348,7 +1479,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1348
1479
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
1349
1480
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
1350
1481
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
1351
|
-
#other-client--per-operation-configuration>`
|
1482
|
+
#other-client--per-operation-configuration>`__.
|
1352
1483
|
:keyword bool raise_on_any_failure:
|
1353
1484
|
This is a boolean param which defaults to True. When this is set, an exception
|
1354
1485
|
is raised even if there is a single operation failure. For optimal performance,
|
@@ -1356,16 +1487,24 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1356
1487
|
:return: An async iterator of responses, one for each blob in order
|
1357
1488
|
:rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse]
|
1358
1489
|
"""
|
1359
|
-
|
1490
|
+
if self._is_localhost:
|
1491
|
+
kwargs['url_prepend'] = self.account_name
|
1492
|
+
reqs, options = _generate_set_tiers_options(
|
1493
|
+
self._query_str,
|
1494
|
+
self.container_name,
|
1495
|
+
standard_blob_tier,
|
1496
|
+
self._client,
|
1497
|
+
*blobs,
|
1498
|
+
**kwargs)
|
1360
1499
|
|
1361
|
-
return await self._batch_send(*reqs, **options)
|
1500
|
+
return cast(AsyncIterator[AsyncHttpResponse], await self._batch_send(*reqs, **options))
|
1362
1501
|
|
1363
1502
|
@distributed_trace_async
|
1364
1503
|
async def set_premium_page_blob_tier_blobs(
|
1365
1504
|
self, premium_page_blob_tier: Union[str, 'PremiumPageBlobTier'],
|
1366
1505
|
*blobs: Union[str, Dict[str, Any], BlobProperties],
|
1367
1506
|
**kwargs: Any
|
1368
|
-
) -> AsyncIterator[
|
1507
|
+
) -> AsyncIterator[AsyncHttpResponse]:
|
1369
1508
|
"""Sets the page blob tiers on the blobs. This API is only supported for page blobs on premium accounts.
|
1370
1509
|
|
1371
1510
|
The maximum number of blobs that can be updated in a single request is 256.
|
@@ -1401,7 +1540,7 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1401
1540
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
1402
1541
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
1403
1542
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
1404
|
-
#other-client--per-operation-configuration>`
|
1543
|
+
#other-client--per-operation-configuration>`__.
|
1405
1544
|
:keyword bool raise_on_any_failure:
|
1406
1545
|
This is a boolean param which defaults to True. When this is set, an exception
|
1407
1546
|
is raised even if there is a single operation failure. For optimal performance,
|
@@ -1409,15 +1548,23 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1409
1548
|
:return: An async iterator of responses, one for each blob in order
|
1410
1549
|
:rtype: asynciterator[~azure.core.pipeline.transport.AsyncHttpResponse]
|
1411
1550
|
"""
|
1412
|
-
|
1551
|
+
if self._is_localhost:
|
1552
|
+
kwargs['url_prepend'] = self.account_name
|
1553
|
+
reqs, options = _generate_set_tiers_options(
|
1554
|
+
self._query_str,
|
1555
|
+
self.container_name,
|
1556
|
+
premium_page_blob_tier,
|
1557
|
+
self._client,
|
1558
|
+
*blobs,
|
1559
|
+
**kwargs)
|
1413
1560
|
|
1414
|
-
return await self._batch_send(*reqs, **options)
|
1561
|
+
return cast(AsyncIterator[AsyncHttpResponse], await self._batch_send(*reqs, **options))
|
1415
1562
|
|
1416
1563
|
def get_blob_client(
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1564
|
+
self, blob: str,
|
1565
|
+
snapshot: Optional[str] = None,
|
1566
|
+
*,
|
1567
|
+
version_id: Optional[str] = None
|
1421
1568
|
) -> BlobClient:
|
1422
1569
|
"""Get a client to interact with the specified blob.
|
1423
1570
|
|
@@ -1448,10 +1595,12 @@ class ContainerClient(AsyncStorageAccountHostsMixin, ContainerClientBase, Storag
|
|
1448
1595
|
"Please use 'BlobProperties.name' or any other str input type instead.",
|
1449
1596
|
DeprecationWarning
|
1450
1597
|
)
|
1451
|
-
|
1598
|
+
blob_name = blob.get('name')
|
1599
|
+
else:
|
1600
|
+
blob_name = blob
|
1452
1601
|
_pipeline = AsyncPipeline(
|
1453
1602
|
transport=AsyncTransportWrapper(self._pipeline._transport), # pylint: disable = protected-access
|
1454
|
-
policies=self._pipeline._impl_policies # pylint: disable = protected-access
|
1603
|
+
policies=self._pipeline._impl_policies # type: ignore [arg-type] # pylint: disable = protected-access
|
1455
1604
|
)
|
1456
1605
|
return BlobClient(
|
1457
1606
|
self.url, container_name=self.container_name, blob_name=blob_name, snapshot=snapshot,
|