azure-storage-blob 12.25.1__py3-none-any.whl → 12.27.0b1__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.
Files changed (67) hide show
  1. azure/storage/blob/__init__.py +3 -2
  2. azure/storage/blob/_blob_client.py +94 -41
  3. azure/storage/blob/_blob_client_helpers.py +19 -4
  4. azure/storage/blob/_blob_service_client.py +16 -13
  5. azure/storage/blob/_container_client.py +25 -22
  6. azure/storage/blob/_deserialize.py +1 -1
  7. azure/storage/blob/_download.py +7 -7
  8. azure/storage/blob/_encryption.py +177 -184
  9. azure/storage/blob/_generated/_azure_blob_storage.py +3 -2
  10. azure/storage/blob/_generated/_configuration.py +2 -2
  11. azure/storage/blob/_generated/_utils/__init__.py +6 -0
  12. azure/storage/blob/_generated/{_serialization.py → _utils/serialization.py} +7 -25
  13. azure/storage/blob/_generated/aio/_azure_blob_storage.py +3 -2
  14. azure/storage/blob/_generated/aio/_configuration.py +2 -2
  15. azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +11 -14
  16. azure/storage/blob/_generated/aio/operations/_blob_operations.py +40 -64
  17. azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +18 -20
  18. azure/storage/blob/_generated/aio/operations/_container_operations.py +21 -43
  19. azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +18 -27
  20. azure/storage/blob/_generated/aio/operations/_service_operations.py +11 -22
  21. azure/storage/blob/_generated/models/__init__.py +2 -0
  22. azure/storage/blob/_generated/models/_azure_blob_storage_enums.py +6 -0
  23. azure/storage/blob/_generated/models/_models_py3.py +30 -9
  24. azure/storage/blob/_generated/operations/_append_blob_operations.py +19 -20
  25. azure/storage/blob/_generated/operations/_blob_operations.py +68 -89
  26. azure/storage/blob/_generated/operations/_block_blob_operations.py +31 -27
  27. azure/storage/blob/_generated/operations/_container_operations.py +40 -62
  28. azure/storage/blob/_generated/operations/_page_blob_operations.py +31 -37
  29. azure/storage/blob/_generated/operations/_service_operations.py +20 -32
  30. azure/storage/blob/_lease.py +1 -0
  31. azure/storage/blob/_list_blobs_helper.py +1 -1
  32. azure/storage/blob/_quick_query_helper.py +20 -24
  33. azure/storage/blob/_serialize.py +2 -0
  34. azure/storage/blob/_shared/__init__.py +7 -7
  35. azure/storage/blob/_shared/authentication.py +49 -32
  36. azure/storage/blob/_shared/avro/avro_io.py +44 -42
  37. azure/storage/blob/_shared/avro/avro_io_async.py +42 -41
  38. azure/storage/blob/_shared/avro/datafile.py +24 -21
  39. azure/storage/blob/_shared/avro/datafile_async.py +15 -15
  40. azure/storage/blob/_shared/avro/schema.py +196 -217
  41. azure/storage/blob/_shared/base_client.py +82 -59
  42. azure/storage/blob/_shared/base_client_async.py +58 -51
  43. azure/storage/blob/_shared/constants.py +1 -1
  44. azure/storage/blob/_shared/models.py +94 -92
  45. azure/storage/blob/_shared/parser.py +3 -3
  46. azure/storage/blob/_shared/policies.py +186 -147
  47. azure/storage/blob/_shared/policies_async.py +53 -65
  48. azure/storage/blob/_shared/request_handlers.py +50 -45
  49. azure/storage/blob/_shared/response_handlers.py +54 -45
  50. azure/storage/blob/_shared/shared_access_signature.py +67 -71
  51. azure/storage/blob/_shared/uploads.py +56 -49
  52. azure/storage/blob/_shared/uploads_async.py +70 -58
  53. azure/storage/blob/_shared_access_signature.py +3 -1
  54. azure/storage/blob/_version.py +1 -1
  55. azure/storage/blob/aio/__init__.py +3 -2
  56. azure/storage/blob/aio/_blob_client_async.py +241 -44
  57. azure/storage/blob/aio/_blob_service_client_async.py +13 -11
  58. azure/storage/blob/aio/_container_client_async.py +28 -25
  59. azure/storage/blob/aio/_download_async.py +7 -7
  60. azure/storage/blob/aio/_lease_async.py +1 -0
  61. azure/storage/blob/aio/_quick_query_helper_async.py +194 -0
  62. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/METADATA +4 -5
  63. azure_storage_blob-12.27.0b1.dist-info/RECORD +86 -0
  64. azure_storage_blob-12.25.1.dist-info/RECORD +0 -84
  65. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/LICENSE +0 -0
  66. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/WHEEL +0 -0
  67. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.27.0b1.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,8 @@ import warnings
9
9
  from datetime import datetime
10
10
  from functools import partial
11
11
  from typing import (
12
- Any, AnyStr, AsyncIterable, cast, Dict, IO, Iterable, List, Optional, overload, Tuple, Union,
12
+ Any, AnyStr, AsyncIterable, Callable, cast, Dict, IO,
13
+ Iterable, List, Optional, overload, Tuple, Union,
13
14
  TYPE_CHECKING
14
15
  )
15
16
  from typing_extensions import Self
@@ -23,6 +24,7 @@ from azure.core.tracing.decorator_async import distributed_trace_async
23
24
  from ._download_async import StorageStreamDownloader
24
25
  from ._lease_async import BlobLeaseClient
25
26
  from ._models import PageRangePaged
27
+ from ._quick_query_helper_async import BlobQueryReader
26
28
  from ._upload_helpers import (
27
29
  upload_append_blob,
28
30
  upload_block_blob,
@@ -46,6 +48,7 @@ from .._blob_client_helpers import (
46
48
  _get_block_list_result,
47
49
  _get_page_ranges_options,
48
50
  _parse_url,
51
+ _quick_query_options,
49
52
  _resize_blob_options,
50
53
  _seal_append_blob_options,
51
54
  _set_blob_metadata_options,
@@ -69,21 +72,27 @@ from .._deserialize import (
69
72
  from .._encryption import StorageEncryptionMixin, _ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION
70
73
  from .._generated.aio import AzureBlobStorage
71
74
  from .._generated.models import CpkInfo
72
- from .._models import BlobType, BlobBlock, BlobProperties, PageRange
75
+ from .._models import BlobType, BlobBlock, BlobProperties, BlobQueryError, PageRange
73
76
  from .._serialize import get_access_conditions, get_api_version, get_modify_conditions, get_version_id
74
77
  from .._shared.base_client_async import AsyncStorageAccountHostsMixin, AsyncTransportWrapper, parse_connection_str
75
78
  from .._shared.policies_async import ExponentialRetry
76
79
  from .._shared.response_handlers import process_storage_error, return_response_headers
77
80
 
78
81
  if TYPE_CHECKING:
82
+ from azure.core import MatchConditions
79
83
  from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
80
84
  from azure.core.credentials_async import AsyncTokenCredential
81
85
  from azure.core.pipeline.policies import AsyncHTTPPolicy
86
+ from azure.storage.blob import CustomerProvidedEncryptionKey
82
87
  from azure.storage.blob.aio import ContainerClient
83
88
  from .._models import (
89
+ ArrowDialect,
84
90
  ContentSettings,
91
+ DelimitedJsonDialect,
92
+ DelimitedTextDialect,
85
93
  ImmutabilityPolicy,
86
94
  PremiumPageBlobTier,
95
+ QuickQueryDialect,
87
96
  SequenceNumberAction,
88
97
  StandardBlobTier
89
98
  )
@@ -219,7 +228,11 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
219
228
  - except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.
220
229
  If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"
221
230
  should be the storage account key.
222
- :type credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] # pylint: disable=line-too-long
231
+ :type credential:
232
+ ~azure.core.credentials.AzureNamedKeyCredential or
233
+ ~azure.core.credentials.AzureSasCredential or
234
+ ~azure.core.credentials_async.AsyncTokenCredential or
235
+ str or dict[str, str] or None
223
236
  :param str snapshot:
224
237
  The optional blob snapshot on which to operate. This can be the snapshot ID string
225
238
  or the response returned from :func:`create_snapshot`. If specified, this will override
@@ -229,7 +242,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
229
242
  :keyword str audience: The audience to use when requesting tokens for Azure Active Directory
230
243
  authentication. Only has an effect when credential is of type TokenCredential. The value could be
231
244
  https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
232
- :returns: A Blob client.
245
+ :return: A Blob client.
233
246
  :rtype: ~azure.storage.blob.BlobClient
234
247
  """
235
248
  account_url, container_name, blob_name, path_snapshot = _from_blob_url(blob_url=blob_url, snapshot=snapshot)
@@ -267,13 +280,17 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
267
280
  Credentials provided here will take precedence over those in the connection string.
268
281
  If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"
269
282
  should be the storage account key.
270
- :type credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] # pylint: disable=line-too-long
283
+ :type credential:
284
+ ~azure.core.credentials.AzureNamedKeyCredential or
285
+ ~azure.core.credentials.AzureSasCredential or
286
+ ~azure.core.credentials_async.AsyncTokenCredential or
287
+ str or dict[str, str] or None
271
288
  :keyword str version_id: The version id parameter is an opaque DateTime value that, when present,
272
289
  specifies the version of the blob to operate on.
273
290
  :keyword str audience: The audience to use when requesting tokens for Azure Active Directory
274
291
  authentication. Only has an effect when credential is of type TokenCredential. The value could be
275
292
  https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
276
- :returns: A Blob client.
293
+ :return: A Blob client.
277
294
  :rtype: ~azure.storage.blob.BlobClient
278
295
 
279
296
  .. admonition:: Example:
@@ -300,7 +317,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
300
317
  The information can also be retrieved if the user has a SAS to a container or blob.
301
318
  The keys in the returned dictionary include 'sku_name' and 'account_kind'.
302
319
 
303
- :returns: A dict of account information (SKU and account type).
320
+ :return: A dict of account information (SKU and account type).
304
321
  :rtype: dict(str, str)
305
322
  """
306
323
  try:
@@ -412,7 +429,16 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
412
429
  :keyword str source_authorization:
413
430
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
414
431
  the prefix of the source_authorization string.
415
- :returns: Response from creating a new block blob for a given URL.
432
+ :keyword source_token_intent:
433
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
434
+ This is ignored for other forms of authentication.
435
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
436
+
437
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
438
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
439
+
440
+ :paramtype source_token_intent: Literal['backup']
441
+ :return: Response from creating a new block blob for a given URL.
416
442
  :rtype: Dict[str, Any]
417
443
  """
418
444
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -420,7 +446,8 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
420
446
  options = _upload_blob_from_url_options(
421
447
  source_url=source_url,
422
448
  metadata=metadata,
423
- **kwargs)
449
+ **kwargs
450
+ )
424
451
  try:
425
452
  return cast(Dict[str, Any], await self._client.block_blob.put_blob_from_url(**options))
426
453
  except HttpResponseError as error:
@@ -562,7 +589,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
562
589
  the timeout will apply to each call individually.
563
590
  multiple calls to the Azure service and the timeout will apply to
564
591
  each call individually.
565
- :returns: Blob-updated property dict (Etag and last modified)
592
+ :return: Blob-updated property dict (Etag and last modified)
566
593
  :rtype: dict[str, Any]
567
594
 
568
595
  .. admonition:: Example:
@@ -707,7 +734,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
707
734
  the timeout will apply to each call individually.
708
735
  multiple calls to the Azure service and the timeout will apply to
709
736
  each call individually.
710
- :returns: A streaming object (StorageStreamDownloader)
737
+ :return: A streaming object (StorageStreamDownloader)
711
738
  :rtype: ~azure.storage.blob.aio.StorageStreamDownloader
712
739
 
713
740
  .. admonition:: Example:
@@ -746,6 +773,133 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
746
773
  await downloader._setup() # pylint: disable=protected-access
747
774
  return downloader
748
775
 
776
+ @distributed_trace_async
777
+ async def query_blob(
778
+ self, query_expression: str,
779
+ *,
780
+ on_error: Optional[Callable[[BlobQueryError], None]] = None,
781
+ blob_format: Optional[Union["DelimitedTextDialect", "DelimitedJsonDialect", "QuickQueryDialect", str]] = None,
782
+ output_format: Optional[Union["DelimitedTextDialect", "DelimitedJsonDialect", "QuickQueryDialect", List["ArrowDialect"], str]] = None, # pylint: disable=line-too-long
783
+ lease: Optional[Union[BlobLeaseClient, str]] = None,
784
+ if_modified_since: Optional[datetime] = None,
785
+ if_unmodified_since: Optional[datetime] = None,
786
+ etag: Optional[str] = None,
787
+ match_condition: Optional["MatchConditions"] = None,
788
+ if_tags_match_condition: Optional[str] = None,
789
+ cpk: Optional["CustomerProvidedEncryptionKey"] = None,
790
+ timeout: Optional[int] = None,
791
+ **kwargs: Any
792
+ ) -> BlobQueryReader:
793
+ """Enables users to select/project on blob/or blob snapshot data by providing simple query expressions.
794
+ This operation returns a BlobQueryReader, users need to use readall() or readinto() to get query data.
795
+
796
+ :param str query_expression:
797
+ Required. a query statement. For more details see
798
+ https://learn.microsoft.com/azure/storage/blobs/query-acceleration-sql-reference.
799
+ :keyword Callable[~azure.storage.blob.BlobQueryError] on_error:
800
+ A function to be called on any processing errors returned by the service.
801
+ :keyword blob_format:
802
+ Optional. Defines the serialization of the data currently stored in the blob. The default is to
803
+ treat the blob data as CSV data formatted in the default dialect. This can be overridden with
804
+ a custom DelimitedTextDialect, or DelimitedJsonDialect or "ParquetDialect" (passed as a string or enum).
805
+ These dialects can be passed through their respective classes, the QuickQueryDialect enum or as a string.
806
+
807
+ .. note::
808
+ "ParquetDialect" is in preview, so some features may not work as intended.
809
+
810
+ :paramtype blob_format:
811
+ ~azure.storage.blob.DelimitedTextDialect or
812
+ ~azure.storage.blob.DelimitedJsonDialect or
813
+ ~azure.storage.blob.QuickQueryDialect or
814
+ str
815
+ :keyword output_format:
816
+ Optional. Defines the output serialization for the data stream. By default the data will be returned
817
+ as it is represented in the blob (Parquet formats default to DelimitedTextDialect).
818
+ By providing an output format, the blob data will be reformatted according to that profile.
819
+ This value can be a DelimitedTextDialect or a DelimitedJsonDialect or ArrowDialect.
820
+ These dialects can be passed through their respective classes, the QuickQueryDialect enum or as a string.
821
+ :paramtype output_format:
822
+ ~azure.storage.blob.DelimitedTextDialect or
823
+ ~azure.storage.blob.DelimitedJsonDialect or
824
+ ~azure.storage.blob.QuickQueryDialect or
825
+ List[~azure.storage.blob.ArrowDialect] or
826
+ str
827
+ :keyword lease:
828
+ Required if the blob has an active lease. Value can be a BlobLeaseClient object
829
+ or the lease ID as a string.
830
+ :keyword ~datetime.datetime if_modified_since:
831
+ A DateTime value. Azure expects the date value passed in to be UTC.
832
+ If timezone is included, any non-UTC datetime will be converted to UTC.
833
+ If a date is passed in without timezone info, it is assumed to be UTC.
834
+ Specify this header to perform the operation only if
835
+ the resource has been modified since the specified date/time.
836
+ :keyword ~datetime.datetime if_unmodified_since:
837
+ A DateTime value. Azure expects the date value passed in to be UTC.
838
+ If timezone is included, any non-UTC datetime will be converted to UTC.
839
+ If a date is passed in without timezone info, it is assumed to be UTC.
840
+ Specify this header to perform the operation only if
841
+ the resource has not been modified since the specified date/time.
842
+ :keyword str etag:
843
+ An ETag value, or the wildcard character (*). Used to check if the resource has changed,
844
+ and act according to the condition specified by the `match_condition` parameter.
845
+ :keyword ~azure.core.MatchConditions match_condition:
846
+ The match condition to use upon the etag.
847
+ :keyword str if_tags_match_condition:
848
+ Specify a SQL where clause on blob tags to operate only on blob with a matching value.
849
+ eg. ``\"\\\"tagname\\\"='my tag'\"``
850
+
851
+ .. versionadded:: 12.4.0
852
+
853
+ :keyword ~azure.storage.blob.CustomerProvidedEncryptionKey cpk:
854
+ Encrypts the data on the service-side with the given key.
855
+ Use of customer-provided keys must be done over HTTPS.
856
+ As the encryption key itself is provided in the request,
857
+ a secure connection must be established to transfer the key.
858
+ :keyword int timeout:
859
+ Sets the server-side timeout for the operation in seconds. For more details see
860
+ https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
861
+ This value is not tracked or validated on the client. To configure client-side network timeouts
862
+ see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
863
+ #other-client--per-operation-configuration>`__.
864
+ :return: A streaming object (BlobQueryReader)
865
+ :rtype: ~azure.storage.blob.aio.BlobQueryReader
866
+ """
867
+ error_cls = kwargs.pop("error_cls", BlobQueryError)
868
+ encoding = kwargs.pop("encoding", None)
869
+ if cpk and self.scheme.lower() != 'https':
870
+ raise ValueError("Customer provided encryption key must be used over HTTPS.")
871
+ options, delimiter = _quick_query_options(
872
+ self.snapshot,
873
+ query_expression,
874
+ blob_format=blob_format,
875
+ output_format=output_format,
876
+ lease=lease,
877
+ if_modified_since=if_modified_since,
878
+ if_unmodified_since=if_unmodified_since,
879
+ etag=etag,
880
+ match_condition=match_condition,
881
+ if_tags_match_condition=if_tags_match_condition,
882
+ cpk=cpk,
883
+ timeout=timeout,
884
+ **kwargs
885
+ )
886
+ try:
887
+ headers, raw_response_body = await self._client.blob.query(**options)
888
+ except HttpResponseError as error:
889
+ process_storage_error(error)
890
+ blob_query_reader = BlobQueryReader(
891
+ name=self.blob_name,
892
+ container=self.container_name,
893
+ errors=on_error,
894
+ record_delimiter=delimiter,
895
+ encoding=encoding,
896
+ headers=headers,
897
+ response=raw_response_body,
898
+ error_cls=error_cls
899
+ )
900
+ await blob_query_reader._setup() # pylint: disable=protected-access
901
+ return blob_query_reader
902
+
749
903
  @distributed_trace_async
750
904
  async def delete_blob(self, delete_snapshots: Optional[str] = None, **kwargs: Any) -> None:
751
905
  """Marks the specified blob for deletion.
@@ -759,7 +913,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
759
913
  and retains the blob for a specified number of days.
760
914
  After the specified number of days, the blob's data is removed from the service during garbage collection.
761
915
  Soft deleted blob is accessible through :func:`~ContainerClient.list_blobs()` specifying `include=['deleted']`
762
- option. Soft-deleted blob can be restored using :func:`undelete` operation.
916
+ option. Soft-deleted blob can be restored using :func:`~BlobClient.undelete_blob()` operation.
763
917
 
764
918
  :param str delete_snapshots:
765
919
  Required if the blob has associated snapshots. Values include:
@@ -807,6 +961,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
807
961
  This value is not tracked or validated on the client. To configure client-side network timesouts
808
962
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
809
963
  #other-client--per-operation-configuration>`__.
964
+ :return: None
810
965
  :rtype: None
811
966
 
812
967
  .. admonition:: Example:
@@ -845,6 +1000,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
845
1000
  This value is not tracked or validated on the client. To configure client-side network timesouts
846
1001
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
847
1002
  #other-client--per-operation-configuration>`__.
1003
+ :return: None
848
1004
  :rtype: None
849
1005
 
850
1006
  .. admonition:: Example:
@@ -876,7 +1032,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
876
1032
  This value is not tracked or validated on the client. To configure client-side network timesouts
877
1033
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
878
1034
  #other-client--per-operation-configuration>`__.
879
- :returns: boolean
1035
+ :return: boolean
880
1036
  :rtype: bool
881
1037
  """
882
1038
  version_id = get_version_id(self.version_id, kwargs)
@@ -946,7 +1102,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
946
1102
  This value is not tracked or validated on the client. To configure client-side network timesouts
947
1103
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
948
1104
  #other-client--per-operation-configuration>`__.
949
- :returns: BlobProperties
1105
+ :return: BlobProperties
950
1106
  :rtype: ~azure.storage.blob.BlobProperties
951
1107
 
952
1108
  .. admonition:: Example:
@@ -1034,7 +1190,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1034
1190
  This value is not tracked or validated on the client. To configure client-side network timesouts
1035
1191
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1036
1192
  #other-client--per-operation-configuration>`__.
1037
- :returns: Blob-updated property dict (Etag and last modified)
1193
+ :return: Blob-updated property dict (Etag and last modified)
1038
1194
  :rtype: Dict[str, Any]
1039
1195
  """
1040
1196
  options = _set_http_headers_options(content_settings=content_settings, **kwargs)
@@ -1101,7 +1257,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1101
1257
  This value is not tracked or validated on the client. To configure client-side network timesouts
1102
1258
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1103
1259
  #other-client--per-operation-configuration>`__.
1104
- :returns: Blob-updated property dict (Etag and last modified)
1260
+ :return: Blob-updated property dict (Etag and last modified)
1105
1261
  :rtype: Dict[str, Union[str, datetime]]
1106
1262
  """
1107
1263
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -1137,7 +1293,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1137
1293
  This value is not tracked or validated on the client. To configure client-side network timesouts
1138
1294
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1139
1295
  #other-client--per-operation-configuration>`__.
1140
- :returns: Key value pairs of blob tags.
1296
+ :return: Key value pairs of blob tags.
1141
1297
  :rtype: Dict[str, str]
1142
1298
  """
1143
1299
 
@@ -1163,7 +1319,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1163
1319
  This value is not tracked or validated on the client. To configure client-side network timesouts
1164
1320
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1165
1321
  #other-client--per-operation-configuration>`__.
1166
- :returns: Key value pairs of blob tags.
1322
+ :return: Key value pairs of blob tags.
1167
1323
  :rtype: Dict[str, str]
1168
1324
  """
1169
1325
 
@@ -1188,7 +1344,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1188
1344
  This value is not tracked or validated on the client. To configure client-side network timesouts
1189
1345
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1190
1346
  #other-client--per-operation-configuration>`__.
1191
- :returns: Key value pairs of blob tags.
1347
+ :return: Key value pairs of blob tags.
1192
1348
  :rtype: Dict[str, Union[str, datetime, bool]]
1193
1349
  """
1194
1350
 
@@ -1285,7 +1441,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1285
1441
  This value is not tracked or validated on the client. To configure client-side network timesouts
1286
1442
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1287
1443
  #other-client--per-operation-configuration>`__.
1288
- :returns: Blob-updated property dict (Etag and last modified).
1444
+ :return: Blob-updated property dict (Etag and last modified).
1289
1445
  :rtype: dict[str, Any]
1290
1446
  """
1291
1447
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -1381,7 +1537,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1381
1537
  This value is not tracked or validated on the client. To configure client-side network timesouts
1382
1538
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1383
1539
  #other-client--per-operation-configuration>`__.
1384
- :returns: Blob-updated property dict (Etag and last modified).
1540
+ :return: Blob-updated property dict (Etag and last modified).
1385
1541
  :rtype: dict[str, Any]
1386
1542
  """
1387
1543
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -1461,7 +1617,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1461
1617
  This value is not tracked or validated on the client. To configure client-side network timesouts
1462
1618
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1463
1619
  #other-client--per-operation-configuration>`__.
1464
- :returns: Blob-updated property dict (Snapshot ID, Etag, and last modified).
1620
+ :return: Blob-updated property dict (Snapshot ID, Etag, and last modified).
1465
1621
  :rtype: dict[str, Any]
1466
1622
 
1467
1623
  .. admonition:: Example:
@@ -1650,6 +1806,15 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1650
1806
 
1651
1807
  .. versionadded:: 12.9.0
1652
1808
 
1809
+ :keyword source_token_intent:
1810
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
1811
+ This is ignored for other forms of authentication.
1812
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
1813
+
1814
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
1815
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
1816
+
1817
+ :paramtype source_token_intent: Literal['backup']
1653
1818
  :keyword str encryption_scope:
1654
1819
  A predefined encryption scope used to encrypt the data on the sync copied blob. An encryption
1655
1820
  scope can be created using the Management API and referenced here by name. If a default
@@ -1658,7 +1823,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1658
1823
 
1659
1824
  .. versionadded:: 12.10.0
1660
1825
 
1661
- :returns: A dictionary of copy properties (etag, last_modified, copy_id, copy_status).
1826
+ :return: A dictionary of copy properties (etag, last_modified, copy_id, copy_status).
1662
1827
  :rtype: dict[str, Union[str, ~datetime.datetime]]
1663
1828
 
1664
1829
  .. admonition:: Example:
@@ -1674,7 +1839,8 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1674
1839
  source_url=source_url,
1675
1840
  metadata=metadata,
1676
1841
  incremental_copy=incremental_copy,
1677
- **kwargs)
1842
+ **kwargs
1843
+ )
1678
1844
  try:
1679
1845
  if incremental_copy:
1680
1846
  return cast(Dict[str, Union[str, datetime]], await self._client.page_blob.copy_incremental(**options))
@@ -1696,6 +1862,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1696
1862
  The copy operation to abort. This can be either an ID, or an
1697
1863
  instance of BlobProperties.
1698
1864
  :type copy_id: str or ~azure.storage.blob.BlobProperties
1865
+ :return: None
1699
1866
  :rtype: None
1700
1867
 
1701
1868
  .. admonition:: Example:
@@ -1762,7 +1929,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1762
1929
  This value is not tracked or validated on the client. To configure client-side network timesouts
1763
1930
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1764
1931
  #other-client--per-operation-configuration>`__.
1765
- :returns: A BlobLeaseClient object.
1932
+ :return: A BlobLeaseClient object.
1766
1933
  :rtype: ~azure.storage.blob.aio.BlobLeaseClient
1767
1934
 
1768
1935
  .. admonition:: Example:
@@ -1811,6 +1978,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1811
1978
  Required if the blob has an active lease. Value can be a BlobLeaseClient object
1812
1979
  or the lease ID as a string.
1813
1980
  :paramtype lease: ~azure.storage.blob.aio.BlobLeaseClient or str
1981
+ :return: None
1814
1982
  :rtype: None
1815
1983
  """
1816
1984
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
@@ -1878,7 +2046,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1878
2046
  This value is not tracked or validated on the client. To configure client-side network timesouts
1879
2047
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1880
2048
  #other-client--per-operation-configuration>`__.
1881
- :returns: Blob property dict.
2049
+ :return: Blob property dict.
1882
2050
  :rtype: Dict[str, Any]
1883
2051
  """
1884
2052
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -1944,7 +2112,16 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1944
2112
  :keyword str source_authorization:
1945
2113
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
1946
2114
  the prefix of the source_authorization string.
1947
- :returns: Blob property dict.
2115
+ :keyword source_token_intent:
2116
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
2117
+ This is ignored for other forms of authentication.
2118
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
2119
+
2120
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
2121
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
2122
+
2123
+ :paramtype source_token_intent: Literal['backup']
2124
+ :return: Blob property dict.
1948
2125
  :rtype: Dict[str, Any]
1949
2126
  """
1950
2127
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -1955,7 +2132,8 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1955
2132
  source_offset=source_offset,
1956
2133
  source_length=source_length,
1957
2134
  source_content_md5=source_content_md5,
1958
- **kwargs)
2135
+ **kwargs
2136
+ )
1959
2137
  try:
1960
2138
  return cast(Dict[str, Any], await self._client.block_blob.stage_block_from_url(**options))
1961
2139
  except HttpResponseError as error:
@@ -1989,7 +2167,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
1989
2167
  This value is not tracked or validated on the client. To configure client-side network timesouts
1990
2168
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1991
2169
  #other-client--per-operation-configuration>`__.
1992
- :returns: A tuple of two lists - committed and uncommitted blocks
2170
+ :return: A tuple of two lists - committed and uncommitted blocks
1993
2171
  :rtype: Tuple[List[BlobBlock], List[BlobBlock]]
1994
2172
  """
1995
2173
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
@@ -2102,7 +2280,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2102
2280
  This value is not tracked or validated on the client. To configure client-side network timesouts
2103
2281
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2104
2282
  #other-client--per-operation-configuration>`__.
2105
- :returns: Blob-updated property dict (Etag and last modified).
2283
+ :return: Blob-updated property dict (Etag and last modified).
2106
2284
  :rtype: dict(str, Any)
2107
2285
  """
2108
2286
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -2144,6 +2322,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2144
2322
  Required if the blob has an active lease. Value can be a BlobLeaseClient object
2145
2323
  or the lease ID as a string.
2146
2324
  :paramtype lease: ~azure.storage.blob.aio.BlobLeaseClient or str
2325
+ :return: None
2147
2326
  :rtype: None
2148
2327
  """
2149
2328
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
@@ -2199,7 +2378,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2199
2378
  This value is not tracked or validated on the client. To configure client-side network timesouts
2200
2379
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2201
2380
  #other-client--per-operation-configuration>`__.
2202
- :returns: Blob-updated property dict (Etag and last modified)
2381
+ :return: Blob-updated property dict (Etag and last modified)
2203
2382
  :rtype: Dict[str, Any]
2204
2383
  """
2205
2384
  version_id = get_version_id(self.version_id, kwargs)
@@ -2232,7 +2411,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2232
2411
  This value is not tracked or validated on the client. To configure client-side network timesouts
2233
2412
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2234
2413
  #other-client--per-operation-configuration>`__.
2235
- :returns: Key value pairs of blob tags.
2414
+ :return: Key value pairs of blob tags.
2236
2415
  :rtype: Dict[str, str]
2237
2416
  """
2238
2417
  version_id = get_version_id(self.version_id, kwargs)
@@ -2304,7 +2483,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2304
2483
  This value is not tracked or validated on the client. To configure client-side network timesouts
2305
2484
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2306
2485
  #other-client--per-operation-configuration>`__.
2307
- :returns:
2486
+ :return:
2308
2487
  A tuple of two lists of page ranges as dictionaries with 'start' and 'end' keys.
2309
2488
  The first element are filled page ranges, the 2nd element is cleared page ranges.
2310
2489
  :rtype: tuple(list(dict(str, str), list(dict(str, str))
@@ -2397,7 +2576,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2397
2576
  This value is not tracked or validated on the client. To configure client-side network timesouts
2398
2577
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2399
2578
  #other-client--per-operation-configuration>`__.
2400
- :returns: An iterable (auto-paging) of PageRange.
2579
+ :return: An iterable (auto-paging) of PageRange.
2401
2580
  :rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.PageRange]
2402
2581
  """
2403
2582
  results_per_page = kwargs.pop('results_per_page', None)
@@ -2480,7 +2659,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2480
2659
  This value is not tracked or validated on the client. To configure client-side network timesouts
2481
2660
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2482
2661
  #other-client--per-operation-configuration>`__.
2483
- :returns:
2662
+ :return:
2484
2663
  A tuple of two lists of page ranges as dictionaries with 'start' and 'end' keys.
2485
2664
  The first element are filled page ranges, the 2nd element is cleared page ranges.
2486
2665
  :rtype: tuple(list(dict(str, str), list(dict(str, str))
@@ -2545,7 +2724,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2545
2724
  This value is not tracked or validated on the client. To configure client-side network timesouts
2546
2725
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2547
2726
  #other-client--per-operation-configuration>`__.
2548
- :returns: Blob-updated property dict (Etag and last modified).
2727
+ :return: Blob-updated property dict (Etag and last modified).
2549
2728
  :rtype: dict(str, Any)
2550
2729
  """
2551
2730
  options = _set_sequence_number_options(sequence_number_action, sequence_number=sequence_number, **kwargs)
@@ -2601,7 +2780,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2601
2780
  This value is not tracked or validated on the client. To configure client-side network timesouts
2602
2781
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2603
2782
  #other-client--per-operation-configuration>`__.
2604
- :returns: Blob-updated property dict (Etag and last modified).
2783
+ :return: Blob-updated property dict (Etag and last modified).
2605
2784
  :rtype: dict(str, Any)
2606
2785
  """
2607
2786
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -2697,7 +2876,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2697
2876
  This value is not tracked or validated on the client. To configure client-side network timesouts
2698
2877
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2699
2878
  #other-client--per-operation-configuration>`__.
2700
- :returns: Blob-updated property dict (Etag and last modified).
2879
+ :return: Blob-updated property dict (Etag and last modified).
2701
2880
  :rtype: dict(str, Any)
2702
2881
  """
2703
2882
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -2819,7 +2998,16 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2819
2998
  :keyword str source_authorization:
2820
2999
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
2821
3000
  the prefix of the source_authorization string.
2822
- :returns: Response after uploading pages from specified URL.
3001
+ :keyword source_token_intent:
3002
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
3003
+ This is ignored for other forms of authentication.
3004
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
3005
+
3006
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
3007
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
3008
+
3009
+ :paramtype source_token_intent: Literal['backup']
3010
+ :return: Response after uploading pages from specified URL.
2823
3011
  :rtype: Dict[str, Any]
2824
3012
  """
2825
3013
 
@@ -2900,7 +3088,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2900
3088
  This value is not tracked or validated on the client. To configure client-side network timesouts
2901
3089
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2902
3090
  #other-client--per-operation-configuration>`__.
2903
- :returns: Blob-updated property dict (Etag and last modified).
3091
+ :return: Blob-updated property dict (Etag and last modified).
2904
3092
  :rtype: dict(str, Any)
2905
3093
  """
2906
3094
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -2997,7 +3185,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
2997
3185
  This value is not tracked or validated on the client. To configure client-side network timesouts
2998
3186
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2999
3187
  #other-client--per-operation-configuration>`__.
3000
- :returns: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3188
+ :return: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3001
3189
  :rtype: dict(str, Any)
3002
3190
  """
3003
3191
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -3112,7 +3300,16 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
3112
3300
  :keyword str source_authorization:
3113
3301
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
3114
3302
  the prefix of the source_authorization string.
3115
- :returns: Result after appending a new block.
3303
+ :keyword source_token_intent:
3304
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
3305
+ This is ignored for other forms of authentication.
3306
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
3307
+
3308
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
3309
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
3310
+
3311
+ :paramtype source_token_intent: Literal['backup']
3312
+ :return: Result after appending a new block.
3116
3313
  :rtype: Dict[str, Union[str, datetime, int]]
3117
3314
  """
3118
3315
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -3170,7 +3367,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
3170
3367
  This value is not tracked or validated on the client. To configure client-side network timesouts
3171
3368
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
3172
3369
  #other-client--per-operation-configuration>`__.
3173
- :returns: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3370
+ :return: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3174
3371
  :rtype: dict(str, Any)
3175
3372
  """
3176
3373
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -3186,7 +3383,7 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
3186
3383
 
3187
3384
  The container need not already exist. Defaults to current blob's credentials.
3188
3385
 
3189
- :returns: A ContainerClient.
3386
+ :return: A ContainerClient.
3190
3387
  :rtype: ~azure.storage.blob.ContainerClient
3191
3388
 
3192
3389
  .. admonition:: Example: