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
@@ -5,49 +5,55 @@
|
|
5
5
|
# --------------------------------------------------------------------------
|
6
6
|
# pylint: disable=invalid-overridden-method, docstring-keyword-should-match-keyword-only
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
TypeVar, TYPE_CHECKING
|
11
|
-
)
|
8
|
+
import uuid
|
9
|
+
from typing import Any, Optional, Union, TYPE_CHECKING
|
12
10
|
|
13
11
|
from azure.core.exceptions import HttpResponseError
|
14
12
|
from azure.core.tracing.decorator_async import distributed_trace_async
|
15
13
|
|
16
|
-
from .._shared.response_handlers import
|
14
|
+
from .._shared.response_handlers import process_storage_error, return_response_headers
|
17
15
|
from .._serialize import get_modify_conditions
|
18
|
-
from .._lease import BlobLeaseClient as LeaseClientBase
|
19
16
|
|
20
17
|
if TYPE_CHECKING:
|
18
|
+
from azure.storage.blob.aio import BlobClient, ContainerClient
|
21
19
|
from datetime import datetime
|
22
|
-
from .._generated.operations import BlobOperations, ContainerOperations
|
23
|
-
BlobClient = TypeVar("BlobClient")
|
24
|
-
ContainerClient = TypeVar("ContainerClient")
|
25
20
|
|
26
21
|
|
27
|
-
class BlobLeaseClient(
|
22
|
+
class BlobLeaseClient(): # pylint: disable=client-accepts-api-version-keyword
|
28
23
|
"""Creates a new BlobLeaseClient.
|
29
24
|
|
30
25
|
This client provides lease operations on a BlobClient or ContainerClient.
|
31
|
-
|
32
|
-
:
|
33
|
-
|
34
|
-
|
35
|
-
:
|
36
|
-
The ETag of the lease currently being maintained. This will be `None` if no
|
37
|
-
lease has yet been acquired or modified.
|
38
|
-
:ivar ~datetime.datetime last_modified:
|
39
|
-
The last modified timestamp of the lease currently being maintained.
|
40
|
-
This will be `None` if no lease has yet been acquired or modified.
|
41
|
-
|
42
|
-
:param client:
|
43
|
-
The client of the blob or container to lease.
|
44
|
-
:type client: ~azure.storage.blob.aio.BlobClient or
|
45
|
-
~azure.storage.blob.aio.ContainerClient
|
46
|
-
:param str lease_id:
|
47
|
-
A string representing the lease ID of an existing lease. This value does not
|
48
|
-
need to be specified in order to acquire a new lease, or break one.
|
26
|
+
:param client: The client of the blob or container to lease.
|
27
|
+
:type client: Union[BlobClient, ContainerClient]
|
28
|
+
:param lease_id: A string representing the lease ID of an existing lease. This value does not need to be
|
29
|
+
specified in order to acquire a new lease, or break one.
|
30
|
+
:type lease_id: Optional[str]
|
49
31
|
"""
|
50
32
|
|
33
|
+
id: str
|
34
|
+
"""The ID of the lease currently being maintained. This will be `None` if no
|
35
|
+
lease has yet been acquired."""
|
36
|
+
etag: Optional[str]
|
37
|
+
"""The ETag of the lease currently being maintained. This will be `None` if no
|
38
|
+
lease has yet been acquired or modified."""
|
39
|
+
last_modified: Optional["datetime"]
|
40
|
+
"""The last modified timestamp of the lease currently being maintained.
|
41
|
+
This will be `None` if no lease has yet been acquired or modified."""
|
42
|
+
|
43
|
+
def __init__( # pylint: disable=missing-client-constructor-parameter-credential, missing-client-constructor-parameter-kwargs
|
44
|
+
self, client: Union["BlobClient", "ContainerClient"],
|
45
|
+
lease_id: Optional[str] = None
|
46
|
+
) -> None:
|
47
|
+
self.id = lease_id or str(uuid.uuid4())
|
48
|
+
self.last_modified = None
|
49
|
+
self.etag = None
|
50
|
+
if hasattr(client, 'blob_name'):
|
51
|
+
self._client = client._client.blob
|
52
|
+
elif hasattr(client, 'container_name'):
|
53
|
+
self._client = client._client.container
|
54
|
+
else:
|
55
|
+
raise TypeError("Lease must use either BlobClient or ContainerClient.")
|
56
|
+
|
51
57
|
def __enter__(self):
|
52
58
|
raise TypeError("Async lease must use 'async with'.")
|
53
59
|
|
@@ -61,8 +67,7 @@ class BlobLeaseClient(LeaseClientBase):
|
|
61
67
|
await self.release()
|
62
68
|
|
63
69
|
@distributed_trace_async
|
64
|
-
async def acquire(self, lease_duration
|
65
|
-
# type: (int, Any) -> None
|
70
|
+
async def acquire(self, lease_duration: int = -1, **kwargs: Any) -> None:
|
66
71
|
"""Requests a new lease.
|
67
72
|
|
68
73
|
If the container does not have an active lease, the Blob service creates a
|
@@ -101,12 +106,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
101
106
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
102
107
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
103
108
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
104
|
-
#other-client--per-operation-configuration>`
|
109
|
+
#other-client--per-operation-configuration>`__.
|
105
110
|
:rtype: None
|
106
111
|
"""
|
107
112
|
mod_conditions = get_modify_conditions(kwargs)
|
108
113
|
try:
|
109
|
-
response = await self._client.acquire_lease(
|
114
|
+
response: Any = await self._client.acquire_lease(
|
110
115
|
timeout=kwargs.pop('timeout', None),
|
111
116
|
duration=lease_duration,
|
112
117
|
proposed_lease_id=self.id,
|
@@ -115,13 +120,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
115
120
|
**kwargs)
|
116
121
|
except HttpResponseError as error:
|
117
122
|
process_storage_error(error)
|
118
|
-
self.id = response.get('lease_id')
|
119
|
-
self.last_modified = response.get('last_modified')
|
120
|
-
self.etag = response.get('etag')
|
123
|
+
self.id = response.get('lease_id')
|
124
|
+
self.last_modified = response.get('last_modified')
|
125
|
+
self.etag = response.get('etag')
|
121
126
|
|
122
127
|
@distributed_trace_async
|
123
|
-
async def renew(self, **kwargs):
|
124
|
-
# type: (Any) -> None
|
128
|
+
async def renew(self, **kwargs: Any) -> None:
|
125
129
|
"""Renews the lease.
|
126
130
|
|
127
131
|
The lease can be renewed if the lease ID specified in the
|
@@ -158,12 +162,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
158
162
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
159
163
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
160
164
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
161
|
-
#other-client--per-operation-configuration>`
|
165
|
+
#other-client--per-operation-configuration>`__.
|
162
166
|
:return: None
|
163
167
|
"""
|
164
168
|
mod_conditions = get_modify_conditions(kwargs)
|
165
169
|
try:
|
166
|
-
response = await self._client.renew_lease(
|
170
|
+
response: Any = await self._client.renew_lease(
|
167
171
|
lease_id=self.id,
|
168
172
|
timeout=kwargs.pop('timeout', None),
|
169
173
|
modified_access_conditions=mod_conditions,
|
@@ -171,13 +175,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
171
175
|
**kwargs)
|
172
176
|
except HttpResponseError as error:
|
173
177
|
process_storage_error(error)
|
174
|
-
self.etag = response.get('etag')
|
175
|
-
self.id = response.get('lease_id')
|
176
|
-
self.last_modified = response.get('last_modified')
|
178
|
+
self.etag = response.get('etag')
|
179
|
+
self.id = response.get('lease_id')
|
180
|
+
self.last_modified = response.get('last_modified')
|
177
181
|
|
178
182
|
@distributed_trace_async
|
179
|
-
async def release(self, **kwargs):
|
180
|
-
# type: (Any) -> None
|
183
|
+
async def release(self, **kwargs: Any) -> None:
|
181
184
|
"""Release the lease.
|
182
185
|
|
183
186
|
The lease may be released if the client lease id specified matches
|
@@ -212,12 +215,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
212
215
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
213
216
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
214
217
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
215
|
-
#other-client--per-operation-configuration>`
|
218
|
+
#other-client--per-operation-configuration>`__.
|
216
219
|
:return: None
|
217
220
|
"""
|
218
221
|
mod_conditions = get_modify_conditions(kwargs)
|
219
222
|
try:
|
220
|
-
response = await self._client.release_lease(
|
223
|
+
response: Any = await self._client.release_lease(
|
221
224
|
lease_id=self.id,
|
222
225
|
timeout=kwargs.pop('timeout', None),
|
223
226
|
modified_access_conditions=mod_conditions,
|
@@ -225,13 +228,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
225
228
|
**kwargs)
|
226
229
|
except HttpResponseError as error:
|
227
230
|
process_storage_error(error)
|
228
|
-
self.etag = response.get('etag')
|
229
|
-
self.id = response.get('lease_id')
|
230
|
-
self.last_modified = response.get('last_modified')
|
231
|
+
self.etag = response.get('etag')
|
232
|
+
self.id = response.get('lease_id')
|
233
|
+
self.last_modified = response.get('last_modified')
|
231
234
|
|
232
235
|
@distributed_trace_async
|
233
|
-
async def change(self, proposed_lease_id, **kwargs):
|
234
|
-
# type: (str, Any) -> None
|
236
|
+
async def change(self, proposed_lease_id: str, **kwargs: Any) -> None:
|
235
237
|
"""Change the lease ID of an active lease.
|
236
238
|
|
237
239
|
:param str proposed_lease_id:
|
@@ -265,12 +267,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
265
267
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
266
268
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
267
269
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
268
|
-
#other-client--per-operation-configuration>`
|
270
|
+
#other-client--per-operation-configuration>`__.
|
269
271
|
:return: None
|
270
272
|
"""
|
271
273
|
mod_conditions = get_modify_conditions(kwargs)
|
272
274
|
try:
|
273
|
-
response = await self._client.change_lease(
|
275
|
+
response: Any = await self._client.change_lease(
|
274
276
|
lease_id=self.id,
|
275
277
|
proposed_lease_id=proposed_lease_id,
|
276
278
|
timeout=kwargs.pop('timeout', None),
|
@@ -279,13 +281,12 @@ class BlobLeaseClient(LeaseClientBase):
|
|
279
281
|
**kwargs)
|
280
282
|
except HttpResponseError as error:
|
281
283
|
process_storage_error(error)
|
282
|
-
self.etag = response.get('etag')
|
283
|
-
self.id = response.get('lease_id')
|
284
|
-
self.last_modified = response.get('last_modified')
|
284
|
+
self.etag = response.get('etag')
|
285
|
+
self.id = response.get('lease_id')
|
286
|
+
self.last_modified = response.get('last_modified')
|
285
287
|
|
286
288
|
@distributed_trace_async
|
287
|
-
async def break_lease(self, lease_break_period=None, **kwargs):
|
288
|
-
# type: (Optional[int], Any) -> int
|
289
|
+
async def break_lease(self, lease_break_period: Optional[int] = None, **kwargs: Any) -> int:
|
289
290
|
"""Break the lease, if the container or blob has an active lease.
|
290
291
|
|
291
292
|
Once a lease is broken, it cannot be renewed. Any authorized request can break the lease;
|
@@ -328,13 +329,13 @@ class BlobLeaseClient(LeaseClientBase):
|
|
328
329
|
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
|
329
330
|
This value is not tracked or validated on the client. To configure client-side network timesouts
|
330
331
|
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
|
331
|
-
#other-client--per-operation-configuration>`
|
332
|
+
#other-client--per-operation-configuration>`__.
|
332
333
|
:return: Approximate time remaining in the lease period, in seconds.
|
333
334
|
:rtype: int
|
334
335
|
"""
|
335
336
|
mod_conditions = get_modify_conditions(kwargs)
|
336
337
|
try:
|
337
|
-
response = await self._client.break_lease(
|
338
|
+
response: Any = await self._client.break_lease(
|
338
339
|
timeout=kwargs.pop('timeout', None),
|
339
340
|
break_period=lease_break_period,
|
340
341
|
modified_access_conditions=mod_conditions,
|
@@ -5,64 +5,62 @@
|
|
5
5
|
# license information.
|
6
6
|
# --------------------------------------------------------------------------
|
7
7
|
|
8
|
+
from typing import Callable, List, Optional
|
8
9
|
from urllib.parse import unquote
|
9
10
|
|
10
|
-
from azure.core.async_paging import
|
11
|
+
from azure.core.async_paging import AsyncItemPaged, AsyncPageIterator
|
11
12
|
from azure.core.exceptions import HttpResponseError
|
12
13
|
|
13
14
|
from .._deserialize import (
|
14
15
|
get_blob_properties_from_generated_code,
|
15
16
|
load_many_xml_nodes,
|
16
17
|
load_xml_int,
|
17
|
-
load_xml_string
|
18
|
+
load_xml_string
|
18
19
|
)
|
19
20
|
from .._generated.models import BlobItemInternal, BlobPrefix as GenBlobPrefix
|
20
21
|
from .._models import BlobProperties
|
21
22
|
from .._shared.models import DictMixin
|
22
23
|
from .._shared.response_handlers import (
|
23
|
-
return_context_and_deserialized,
|
24
|
-
return_raw_deserialized,
|
25
24
|
process_storage_error,
|
25
|
+
return_context_and_deserialized,
|
26
|
+
return_raw_deserialized
|
26
27
|
)
|
27
28
|
|
28
29
|
|
29
30
|
class BlobPropertiesPaged(AsyncPageIterator):
|
30
|
-
"""An Iterable of Blob properties.
|
31
|
+
"""An Iterable of Blob properties."""
|
32
|
+
|
33
|
+
service_endpoint: Optional[str]
|
34
|
+
"""The service URL."""
|
35
|
+
prefix: Optional[str]
|
36
|
+
"""A blob name prefix being used to filter the list."""
|
37
|
+
marker: Optional[str]
|
38
|
+
"""The continuation token of the current page of results."""
|
39
|
+
results_per_page: Optional[int]
|
40
|
+
"""The maximum number of results retrieved per API call."""
|
41
|
+
continuation_token: Optional[str]
|
42
|
+
"""The continuation token to retrieve the next page of results."""
|
43
|
+
location_mode: Optional[str]
|
44
|
+
"""The location mode being used to list results. The available
|
45
|
+
options include "primary" and "secondary"."""
|
46
|
+
current_page: Optional[List[BlobProperties]]
|
47
|
+
"""The current page of listed results."""
|
48
|
+
container: Optional[str]
|
49
|
+
"""The container that the blobs are listed from."""
|
50
|
+
delimiter: Optional[str]
|
51
|
+
"""A delimiting character used for hierarchy listing."""
|
52
|
+
command: Callable
|
53
|
+
"""Function to retrieve the next page of items."""
|
31
54
|
|
32
|
-
:ivar str service_endpoint: The service URL.
|
33
|
-
:ivar str prefix: A blob name prefix being used to filter the list.
|
34
|
-
:ivar str marker: The continuation token of the current page of results.
|
35
|
-
:ivar int results_per_page: The maximum number of results retrieved per API call.
|
36
|
-
:ivar str location_mode: The location mode being used to list results. The available
|
37
|
-
options include "primary" and "secondary".
|
38
|
-
:ivar current_page: The current page of listed results.
|
39
|
-
:vartype current_page: list(~azure.storage.blob.models.BlobProperties)
|
40
|
-
:ivar str container: The container that the blobs are listed from.
|
41
|
-
:ivar str delimiter: A delimiting character used for hierarchy listing.
|
42
|
-
|
43
|
-
:param callable command: Function to retrieve the next page of items.
|
44
|
-
:param str container: The container that the blobs are listed from.
|
45
|
-
:param str prefix: Filters the results to return only blobs whose names
|
46
|
-
begin with the specified prefix.
|
47
|
-
:param int results_per_page: The maximum number of blobs to retrieve per
|
48
|
-
call.
|
49
|
-
:param str continuation_token: An opaque continuation token.
|
50
|
-
:param str delimiter:
|
51
|
-
Used to capture blobs whose names begin with the same substring up to
|
52
|
-
the appearance of the delimiter character. The delimiter may be a single
|
53
|
-
character or a string.
|
54
|
-
:param location_mode: Specifies the location the request should be sent to.
|
55
|
-
This mode only applies for RA-GRS accounts which allow secondary read access.
|
56
|
-
Options include 'primary' or 'secondary'.
|
57
|
-
"""
|
58
55
|
def __init__(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
56
|
+
self, command: Callable,
|
57
|
+
container: Optional[str] = None,
|
58
|
+
prefix: Optional[str] = None,
|
59
|
+
results_per_page: Optional[int] = None,
|
60
|
+
continuation_token: Optional[str] = None,
|
61
|
+
delimiter: Optional[str] = None,
|
62
|
+
location_mode: Optional[str] = None,
|
63
|
+
) -> None:
|
66
64
|
super(BlobPropertiesPaged, self).__init__(
|
67
65
|
get_next=self._get_next_cb,
|
68
66
|
extract_data=self._extract_data_cb,
|
@@ -105,44 +103,44 @@ class BlobPropertiesPaged(AsyncPageIterator):
|
|
105
103
|
return item
|
106
104
|
if isinstance(item, BlobItemInternal):
|
107
105
|
blob = get_blob_properties_from_generated_code(item) # pylint: disable=protected-access
|
108
|
-
blob.container = self.container
|
106
|
+
blob.container = self.container # type: ignore [assignment]
|
109
107
|
return blob
|
110
108
|
return item
|
111
109
|
|
112
110
|
|
113
111
|
class BlobNamesPaged(AsyncPageIterator):
|
114
|
-
"""An Iterable of Blob names.
|
115
|
-
|
116
|
-
:
|
117
|
-
|
118
|
-
:
|
119
|
-
|
120
|
-
:
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
:
|
125
|
-
|
126
|
-
:
|
127
|
-
|
128
|
-
|
129
|
-
:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
:
|
136
|
-
|
137
|
-
|
138
|
-
"""
|
112
|
+
"""An Iterable of Blob names."""
|
113
|
+
|
114
|
+
service_endpoint: Optional[str]
|
115
|
+
"""The service URL."""
|
116
|
+
prefix: Optional[str]
|
117
|
+
"""A blob name prefix being used to filter the list."""
|
118
|
+
marker: Optional[str]
|
119
|
+
"""The continuation token of the current page of results."""
|
120
|
+
results_per_page: Optional[int]
|
121
|
+
"""The maximum number of blobs to retrieve per call."""
|
122
|
+
continuation_token: Optional[str]
|
123
|
+
"""The continuation token to retrieve the next page of results."""
|
124
|
+
location_mode: Optional[str]
|
125
|
+
"""The location mode being used to list results. The available
|
126
|
+
options include "primary" and "secondary"."""
|
127
|
+
current_page: Optional[List[BlobProperties]]
|
128
|
+
"""The current page of listed results."""
|
129
|
+
container: Optional[str]
|
130
|
+
"""The container that the blobs are listed from."""
|
131
|
+
delimiter: Optional[str]
|
132
|
+
"""A delimiting character used for hierarchy listing."""
|
133
|
+
command: Callable
|
134
|
+
"""Function to retrieve the next page of items."""
|
135
|
+
|
139
136
|
def __init__(
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
137
|
+
self, command: Callable,
|
138
|
+
container: Optional[str] = None,
|
139
|
+
prefix: Optional[str] = None,
|
140
|
+
results_per_page: Optional[int] = None,
|
141
|
+
continuation_token: Optional[str] = None,
|
142
|
+
location_mode: Optional[str] = None
|
143
|
+
) -> None:
|
146
144
|
super(BlobNamesPaged, self).__init__(
|
147
145
|
get_next=self._get_next_cb,
|
148
146
|
extract_data=self._extract_data_cb,
|
@@ -187,32 +185,32 @@ class BlobPrefix(AsyncItemPaged, DictMixin):
|
|
187
185
|
"""An Iterable of Blob properties.
|
188
186
|
|
189
187
|
Returned from walk_blobs when a delimiter is used.
|
190
|
-
Can be thought of as a virtual blob directory.
|
191
|
-
|
192
|
-
:
|
193
|
-
|
194
|
-
:
|
195
|
-
|
196
|
-
:
|
197
|
-
|
198
|
-
:
|
199
|
-
|
200
|
-
:
|
201
|
-
|
202
|
-
:
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
:
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
188
|
+
Can be thought of as a virtual blob directory."""
|
189
|
+
|
190
|
+
name: str
|
191
|
+
"""The prefix, or "directory name" of the blob."""
|
192
|
+
service_endpoint: Optional[str]
|
193
|
+
"""The service URL."""
|
194
|
+
prefix: str
|
195
|
+
"""A blob name prefix being used to filter the list."""
|
196
|
+
marker: Optional[str]
|
197
|
+
"""The continuation token of the current page of results."""
|
198
|
+
results_per_page: Optional[int]
|
199
|
+
"""The maximum number of results retrieved per API call."""
|
200
|
+
next_marker: Optional[str]
|
201
|
+
"""The continuation token to retrieve the next page of results."""
|
202
|
+
location_mode: str
|
203
|
+
"""The location mode being used to list results. The available
|
204
|
+
options include "primary" and "secondary"."""
|
205
|
+
current_page: Optional[List[BlobProperties]]
|
206
|
+
"""The current page of listed results."""
|
207
|
+
delimiter: str
|
208
|
+
"""A delimiting character used for hierarchy listing."""
|
209
|
+
command: Callable
|
210
|
+
"""Function to retrieve the next page of items."""
|
211
|
+
container: str
|
212
|
+
"""The name of the container."""
|
213
|
+
|
216
214
|
def __init__(self, *args, **kwargs):
|
217
215
|
super(BlobPrefix, self).__init__(*args, page_iterator_class=BlobPrefixPaged, **kwargs)
|
218
216
|
self.name = kwargs.get('prefix')
|
@@ -6,35 +6,47 @@
|
|
6
6
|
# pylint: disable=too-few-public-methods, too-many-instance-attributes
|
7
7
|
# pylint: disable=super-init-not-called, too-many-lines
|
8
8
|
|
9
|
+
from typing import Callable, List, Optional, TYPE_CHECKING
|
10
|
+
|
9
11
|
from azure.core.async_paging import AsyncPageIterator
|
10
12
|
from azure.core.exceptions import HttpResponseError
|
11
|
-
from .._deserialize import parse_tags
|
12
13
|
|
14
|
+
from .._deserialize import parse_tags
|
15
|
+
from .._generated.models import FilterBlobItem
|
13
16
|
from .._models import ContainerProperties, FilteredBlob, parse_page_list
|
14
|
-
from .._shared.response_handlers import
|
17
|
+
from .._shared.response_handlers import process_storage_error, return_context_and_deserialized
|
15
18
|
|
16
|
-
|
19
|
+
if TYPE_CHECKING:
|
20
|
+
from .._models import BlobProperties
|
17
21
|
|
18
22
|
|
19
23
|
class ContainerPropertiesPaged(AsyncPageIterator):
|
20
24
|
"""An Iterable of Container properties.
|
21
25
|
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:ivar str marker: The continuation token of the current page of results.
|
25
|
-
:ivar int results_per_page: The maximum number of results retrieved per API call.
|
26
|
-
:ivar str location_mode: The location mode being used to list results. The available
|
27
|
-
options include "primary" and "secondary".
|
28
|
-
:ivar current_page: The current page of listed results.
|
29
|
-
:vartype current_page: list(~azure.storage.blob.models.ContainerProperties)
|
30
|
-
|
31
|
-
:param callable command: Function to retrieve the next page of items.
|
32
|
-
:param str prefix: Filters the results to return only containers whose names
|
26
|
+
:param Callable command: Function to retrieve the next page of items.
|
27
|
+
:param Optional[str] prefix: Filters the results to return only containers whose names
|
33
28
|
begin with the specified prefix.
|
34
|
-
:param int results_per_page: The maximum number of container names to retrieve per
|
29
|
+
:param Optional[int] results_per_page: The maximum number of container names to retrieve per
|
35
30
|
call.
|
36
|
-
:param str continuation_token: An opaque continuation token.
|
31
|
+
:param Optional[str] continuation_token: An opaque continuation token.
|
37
32
|
"""
|
33
|
+
|
34
|
+
service_endpoint: Optional[str]
|
35
|
+
"""The service URL."""
|
36
|
+
prefix: Optional[str]
|
37
|
+
"""A container name prefix being used to filter the list."""
|
38
|
+
marker: Optional[str]
|
39
|
+
"""The continuation token of the current page of results."""
|
40
|
+
results_per_page: Optional[int]
|
41
|
+
"""The maximum number of results retrieved per API call."""
|
42
|
+
continuation_token: Optional[str]
|
43
|
+
"""The continuation token to retrieve the next page of results."""
|
44
|
+
location_mode: Optional[str]
|
45
|
+
"""The location mode being used to list results. The available
|
46
|
+
options include "primary" and "secondary"."""
|
47
|
+
current_page: List[ContainerProperties]
|
48
|
+
"""The current page of listed results."""
|
49
|
+
|
38
50
|
def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None):
|
39
51
|
super(ContainerPropertiesPaged, self).__init__(
|
40
52
|
get_next=self._get_next_cb,
|
@@ -77,31 +89,41 @@ class ContainerPropertiesPaged(AsyncPageIterator):
|
|
77
89
|
class FilteredBlobPaged(AsyncPageIterator):
|
78
90
|
"""An Iterable of Blob properties.
|
79
91
|
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:ivar int results_per_page: The maximum number of results retrieved per API call.
|
84
|
-
:ivar str continuation_token: The continuation token to retrieve the next page of results.
|
85
|
-
:ivar str location_mode: The location mode being used to list results. The available
|
86
|
-
options include "primary" and "secondary".
|
87
|
-
:ivar current_page: The current page of listed results.
|
88
|
-
:vartype current_page: list(~azure.storage.blob.BlobProperties)
|
89
|
-
:ivar str container: The container that the blobs are listed from.
|
90
|
-
:param callable command: Function to retrieve the next page of items.
|
91
|
-
:param str container: The name of the container.
|
92
|
-
:param int results_per_page: The maximum number of blobs to retrieve per
|
92
|
+
:param Callable command: Function to retrieve the next page of items.
|
93
|
+
:param Optional[str] container: The name of the container.
|
94
|
+
:param Optional[int] results_per_page: The maximum number of blobs to retrieve per
|
93
95
|
call.
|
94
|
-
:param str continuation_token: An opaque continuation token.
|
95
|
-
:param location_mode:
|
96
|
-
|
97
|
-
Options include 'primary' or 'secondary'.
|
96
|
+
:param Optional[str] continuation_token: An opaque continuation token.
|
97
|
+
:param Optional[str] location_mode:
|
98
|
+
Specifies the location the request should be sent to. This mode only applies for RA-GRS accounts
|
99
|
+
which allow secondary read access. Options include 'primary' or 'secondary'.
|
98
100
|
"""
|
101
|
+
|
102
|
+
service_endpoint: Optional[str]
|
103
|
+
"""The service URL."""
|
104
|
+
prefix: Optional[str]
|
105
|
+
"""A blob name prefix being used to filter the list."""
|
106
|
+
marker: Optional[str]
|
107
|
+
"""The continuation token of the current page of results."""
|
108
|
+
results_per_page: Optional[int]
|
109
|
+
"""The maximum number of results retrieved per API call."""
|
110
|
+
continuation_token: Optional[str]
|
111
|
+
"""The continuation token to retrieve the next page of results."""
|
112
|
+
location_mode: Optional[str]
|
113
|
+
"""The location mode being used to list results. The available
|
114
|
+
options include "primary" and "secondary"."""
|
115
|
+
current_page: Optional[List["BlobProperties"]]
|
116
|
+
"""The current page of listed results."""
|
117
|
+
container: Optional[str]
|
118
|
+
"""The container that the blobs are listed from."""
|
119
|
+
|
99
120
|
def __init__(
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
121
|
+
self, command: Callable,
|
122
|
+
container: Optional[str] = None,
|
123
|
+
results_per_page: Optional[int] = None,
|
124
|
+
continuation_token: Optional[str] = None,
|
125
|
+
location_mode: Optional[str] = None
|
126
|
+
) -> None:
|
105
127
|
super(FilteredBlobPaged, self).__init__(
|
106
128
|
get_next=self._get_next_cb,
|
107
129
|
extract_data=self._extract_data_cb,
|