azure-storage-blob 12.25.1__py3-none-any.whl → 12.26.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.
Files changed (64) 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 +1 -1
  10. azure/storage/blob/_generated/_configuration.py +2 -2
  11. azure/storage/blob/_generated/_serialization.py +3 -3
  12. azure/storage/blob/_generated/aio/_azure_blob_storage.py +1 -1
  13. azure/storage/blob/_generated/aio/_configuration.py +2 -2
  14. azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +5 -4
  15. azure/storage/blob/_generated/aio/operations/_blob_operations.py +5 -25
  16. azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +9 -7
  17. azure/storage/blob/_generated/aio/operations/_container_operations.py +1 -19
  18. azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +5 -10
  19. azure/storage/blob/_generated/aio/operations/_service_operations.py +1 -8
  20. azure/storage/blob/_generated/models/__init__.py +2 -0
  21. azure/storage/blob/_generated/models/_azure_blob_storage_enums.py +6 -0
  22. azure/storage/blob/_generated/operations/_append_blob_operations.py +12 -9
  23. azure/storage/blob/_generated/operations/_blob_operations.py +32 -49
  24. azure/storage/blob/_generated/operations/_block_blob_operations.py +21 -13
  25. azure/storage/blob/_generated/operations/_container_operations.py +19 -37
  26. azure/storage/blob/_generated/operations/_page_blob_operations.py +17 -19
  27. azure/storage/blob/_generated/operations/_service_operations.py +9 -17
  28. azure/storage/blob/_lease.py +1 -0
  29. azure/storage/blob/_quick_query_helper.py +20 -24
  30. azure/storage/blob/_serialize.py +1 -0
  31. azure/storage/blob/_shared/__init__.py +7 -7
  32. azure/storage/blob/_shared/authentication.py +49 -32
  33. azure/storage/blob/_shared/avro/avro_io.py +44 -42
  34. azure/storage/blob/_shared/avro/avro_io_async.py +42 -41
  35. azure/storage/blob/_shared/avro/datafile.py +24 -21
  36. azure/storage/blob/_shared/avro/datafile_async.py +15 -15
  37. azure/storage/blob/_shared/avro/schema.py +196 -217
  38. azure/storage/blob/_shared/base_client.py +82 -59
  39. azure/storage/blob/_shared/base_client_async.py +58 -51
  40. azure/storage/blob/_shared/constants.py +1 -1
  41. azure/storage/blob/_shared/models.py +93 -92
  42. azure/storage/blob/_shared/parser.py +3 -3
  43. azure/storage/blob/_shared/policies.py +176 -145
  44. azure/storage/blob/_shared/policies_async.py +58 -69
  45. azure/storage/blob/_shared/request_handlers.py +50 -45
  46. azure/storage/blob/_shared/response_handlers.py +49 -45
  47. azure/storage/blob/_shared/shared_access_signature.py +67 -71
  48. azure/storage/blob/_shared/uploads.py +56 -49
  49. azure/storage/blob/_shared/uploads_async.py +70 -58
  50. azure/storage/blob/_shared_access_signature.py +3 -1
  51. azure/storage/blob/_version.py +1 -1
  52. azure/storage/blob/aio/__init__.py +3 -2
  53. azure/storage/blob/aio/_blob_client_async.py +241 -44
  54. azure/storage/blob/aio/_blob_service_client_async.py +13 -11
  55. azure/storage/blob/aio/_container_client_async.py +28 -25
  56. azure/storage/blob/aio/_download_async.py +15 -11
  57. azure/storage/blob/aio/_lease_async.py +1 -0
  58. azure/storage/blob/aio/_quick_query_helper_async.py +194 -0
  59. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/METADATA +1 -1
  60. azure_storage_blob-12.26.0.dist-info/RECORD +85 -0
  61. azure_storage_blob-12.25.1.dist-info/RECORD +0 -84
  62. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/LICENSE +0 -0
  63. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/WHEEL +0 -0
  64. {azure_storage_blob-12.25.1.dist-info → azure_storage_blob-12.26.0.dist-info}/top_level.txt +0 -0
@@ -122,7 +122,7 @@ def upload_blob_to_url(
122
122
  entire blocks, and doing so defeats the purpose of the memory-efficient algorithm.
123
123
  :keyword str encoding:
124
124
  Encoding to use if text is supplied as input. Defaults to UTF-8.
125
- :returns: Blob-updated property dict (Etag and last modified)
125
+ :return: Blob-updated property dict (Etag and last modified)
126
126
  :rtype: dict(str, Any)
127
127
  """
128
128
  with BlobClient.from_blob_url(blob_url, credential=credential) as client:
@@ -153,7 +153,7 @@ def download_blob_from_url(
153
153
  :param output:
154
154
  Where the data should be downloaded to. This could be either a file path to write to,
155
155
  or an open IO handle to write to.
156
- :type output: str or writable stream.
156
+ :type output: str or IO.
157
157
  :param credential:
158
158
  The credentials with which to authenticate. This is optional if the
159
159
  blob URL already has a SAS token or the blob is public. The value can be a SAS token string,
@@ -190,6 +190,7 @@ def download_blob_from_url(
190
190
  blob. Also note that if enabled, the memory-efficient upload algorithm
191
191
  will not be used, because computing the MD5 hash requires buffering
192
192
  entire blocks, and doing so defeats the purpose of the memory-efficient algorithm.
193
+ :return: None
193
194
  :rtype: None
194
195
  """
195
196
  overwrite = kwargs.pop('overwrite', False)
@@ -236,7 +236,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
236
236
  :keyword str audience: The audience to use when requesting tokens for Azure Active Directory
237
237
  authentication. Only has an effect when credential is of type TokenCredential. The value could be
238
238
  https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
239
- :returns: A Blob client.
239
+ :return: A Blob client.
240
240
  :rtype: ~azure.storage.blob.BlobClient
241
241
  """
242
242
  account_url, container_name, blob_name, path_snapshot = _from_blob_url(blob_url=blob_url, snapshot=snapshot)
@@ -284,7 +284,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
284
284
  :keyword str audience: The audience to use when requesting tokens for Azure Active Directory
285
285
  authentication. Only has an effect when credential is of type TokenCredential. The value could be
286
286
  https://storage.azure.com/ (default) or https://<account>.blob.core.windows.net.
287
- :returns: A Blob client.
287
+ :return: A Blob client.
288
288
  :rtype: ~azure.storage.blob.BlobClient
289
289
 
290
290
  .. admonition:: Example:
@@ -311,7 +311,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
311
311
  The information can also be retrieved if the user has a SAS to a container or blob.
312
312
  The keys in the returned dictionary include 'sku_name' and 'account_kind'.
313
313
 
314
- :returns: A dict of account information (SKU and account type).
314
+ :return: A dict of account information (SKU and account type).
315
315
  :rtype: dict(str, str)
316
316
  """
317
317
  try:
@@ -422,7 +422,16 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
422
422
  :keyword str source_authorization:
423
423
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
424
424
  the prefix of the source_authorization string.
425
- :returns: Blob-updated property Dict (Etag and last modified)
425
+ :keyword source_token_intent:
426
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
427
+ This is ignored for other forms of authentication.
428
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
429
+
430
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
431
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
432
+
433
+ :paramtype source_token_intent: Literal['backup']
434
+ :return: Blob-updated property Dict (Etag and last modified)
426
435
  :rtype: Dict[str, Any]
427
436
  """
428
437
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -430,7 +439,8 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
430
439
  options = _upload_blob_from_url_options(
431
440
  source_url=source_url,
432
441
  metadata=metadata,
433
- **kwargs)
442
+ **kwargs
443
+ )
434
444
  try:
435
445
  return cast(Dict[str, Any], self._client.block_blob.put_blob_from_url(**options))
436
446
  except HttpResponseError as error:
@@ -570,7 +580,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
570
580
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
571
581
  #other-client--per-operation-configuration>`__. This method may make multiple calls to the service and
572
582
  the timeout will apply to each call individually.
573
- :returns: Blob-updated property Dict (Etag and last modified)
583
+ :return: Blob-updated property Dict (Etag and last modified)
574
584
  :rtype: Dict[str, Any]
575
585
 
576
586
  .. admonition:: Example:
@@ -715,7 +725,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
715
725
  the timeout will apply to each call individually.
716
726
  multiple calls to the Azure service and the timeout will apply to
717
727
  each call individually.
718
- :returns: A streaming object (StorageStreamDownloader)
728
+ :return: A streaming object (StorageStreamDownloader)
719
729
  :rtype: ~azure.storage.blob.StorageStreamDownloader
720
730
 
721
731
  .. admonition:: Example:
@@ -819,7 +829,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
819
829
  This value is not tracked or validated on the client. To configure client-side network timesouts
820
830
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
821
831
  #other-client--per-operation-configuration>`__.
822
- :returns: A streaming object (BlobQueryReader)
832
+ :return: A streaming object (BlobQueryReader)
823
833
  :rtype: ~azure.storage.blob.BlobQueryReader
824
834
 
825
835
  .. admonition:: Example:
@@ -864,7 +874,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
864
874
  and retains the blob for a specified number of days.
865
875
  After the specified number of days, the blob's data is removed from the service during garbage collection.
866
876
  Soft deleted blob is accessible through :func:`~ContainerClient.list_blobs()` specifying `include=['deleted']`
867
- option. Soft-deleted blob can be restored using :func:`undelete` operation.
877
+ option. Soft-deleted blob can be restored using :func:`~BlobClient.undelete_blob()` operation.
868
878
 
869
879
  :param Optional[str] delete_snapshots:
870
880
  Required if the blob has associated snapshots. Values include:
@@ -912,6 +922,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
912
922
  This value is not tracked or validated on the client. To configure client-side network timesouts
913
923
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
914
924
  #other-client--per-operation-configuration>`__.
925
+ :return: None
915
926
  :rtype: None
916
927
 
917
928
  .. admonition:: Example:
@@ -950,6 +961,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
950
961
  This value is not tracked or validated on the client. To configure client-side network timesouts
951
962
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
952
963
  #other-client--per-operation-configuration>`__.
964
+ :return: None
953
965
  :rtype: None
954
966
 
955
967
  .. admonition:: Example:
@@ -981,7 +993,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
981
993
  This value is not tracked or validated on the client. To configure client-side network timesouts
982
994
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
983
995
  #other-client--per-operation-configuration>`__.
984
- :returns: boolean
996
+ :return: boolean
985
997
  :rtype: bool
986
998
  """
987
999
  version_id = get_version_id(self.version_id, kwargs)
@@ -1051,7 +1063,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1051
1063
  This value is not tracked or validated on the client. To configure client-side network timesouts
1052
1064
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1053
1065
  #other-client--per-operation-configuration>`__.
1054
- :returns: BlobProperties
1066
+ :return: BlobProperties
1055
1067
  :rtype: ~azure.storage.blob.BlobProperties
1056
1068
 
1057
1069
  .. admonition:: Example:
@@ -1137,7 +1149,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1137
1149
  This value is not tracked or validated on the client. To configure client-side network timesouts
1138
1150
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1139
1151
  #other-client--per-operation-configuration>`__.
1140
- :returns: Blob-updated property dict (Etag and last modified)
1152
+ :return: Blob-updated property dict (Etag and last modified)
1141
1153
  :rtype: Dict[str, Any]
1142
1154
  """
1143
1155
  options = _set_http_headers_options(content_settings=content_settings, **kwargs)
@@ -1204,7 +1216,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1204
1216
  This value is not tracked or validated on the client. To configure client-side network timesouts
1205
1217
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1206
1218
  #other-client--per-operation-configuration>`__.
1207
- :returns: Blob-updated property dict (Etag and last modified)
1219
+ :return: Blob-updated property dict (Etag and last modified)
1208
1220
  :rtype: Dict[str, Union[str, datetime]]
1209
1221
  """
1210
1222
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -1240,7 +1252,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1240
1252
  This value is not tracked or validated on the client. To configure client-side network timesouts
1241
1253
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1242
1254
  #other-client--per-operation-configuration>`__.
1243
- :returns: Key value pairs of blob tags.
1255
+ :return: Key value pairs of blob tags.
1244
1256
  :rtype: Dict[str, str]
1245
1257
  """
1246
1258
 
@@ -1266,7 +1278,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1266
1278
  This value is not tracked or validated on the client. To configure client-side network timesouts
1267
1279
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1268
1280
  #other-client--per-operation-configuration>`__.
1269
- :returns: Key value pairs of blob tags.
1281
+ :return: Key value pairs of blob tags.
1270
1282
  :rtype: Dict[str, str]
1271
1283
  """
1272
1284
 
@@ -1291,7 +1303,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1291
1303
  This value is not tracked or validated on the client. To configure client-side network timesouts
1292
1304
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1293
1305
  #other-client--per-operation-configuration>`__.
1294
- :returns: Key value pairs of blob tags.
1306
+ :return: Key value pairs of blob tags.
1295
1307
  :rtype: Dict[str, Union[str, datetime, bool]]
1296
1308
  """
1297
1309
 
@@ -1388,7 +1400,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1388
1400
  This value is not tracked or validated on the client. To configure client-side network timesouts
1389
1401
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1390
1402
  #other-client--per-operation-configuration>`__.
1391
- :returns: Blob-updated property dict (Etag and last modified).
1403
+ :return: Blob-updated property dict (Etag and last modified).
1392
1404
  :rtype: dict[str, Any]
1393
1405
  """
1394
1406
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -1484,7 +1496,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1484
1496
  This value is not tracked or validated on the client. To configure client-side network timesouts
1485
1497
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1486
1498
  #other-client--per-operation-configuration>`__.
1487
- :returns: Blob-updated property dict (Etag and last modified).
1499
+ :return: Blob-updated property dict (Etag and last modified).
1488
1500
  :rtype: dict[str, Any]
1489
1501
  """
1490
1502
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -1563,7 +1575,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1563
1575
  This value is not tracked or validated on the client. To configure client-side network timesouts
1564
1576
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1565
1577
  #other-client--per-operation-configuration>`__.
1566
- :returns: Blob-updated property dict (Snapshot ID, Etag, and last modified).
1578
+ :return: Blob-updated property dict (Snapshot ID, Etag, and last modified).
1567
1579
  :rtype: dict[str, Any]
1568
1580
 
1569
1581
  .. admonition:: Example:
@@ -1746,6 +1758,15 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1746
1758
 
1747
1759
  .. versionadded:: 12.9.0
1748
1760
 
1761
+ :keyword source_token_intent:
1762
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
1763
+ This is ignored for other forms of authentication.
1764
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
1765
+
1766
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
1767
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
1768
+
1769
+ :paramtype source_token_intent: Literal['backup']
1749
1770
  :keyword str encryption_scope:
1750
1771
  A predefined encryption scope used to encrypt the data on the sync copied blob. An encryption
1751
1772
  scope can be created using the Management API and referenced here by name. If a default
@@ -1754,7 +1775,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1754
1775
 
1755
1776
  .. versionadded:: 12.10.0
1756
1777
 
1757
- :returns: A dictionary of copy properties (etag, last_modified, copy_id, copy_status).
1778
+ :return: A dictionary of copy properties (etag, last_modified, copy_id, copy_status).
1758
1779
  :rtype: dict[str, Union[str, ~datetime.datetime]]
1759
1780
 
1760
1781
  .. admonition:: Example:
@@ -1770,7 +1791,8 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1770
1791
  source_url=source_url,
1771
1792
  metadata=metadata,
1772
1793
  incremental_copy=incremental_copy,
1773
- **kwargs)
1794
+ **kwargs
1795
+ )
1774
1796
  try:
1775
1797
  if incremental_copy:
1776
1798
  return cast(Dict[str, Union[str, datetime]], self._client.page_blob.copy_incremental(**options))
@@ -1792,6 +1814,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1792
1814
  The copy operation to abort. This can be either an ID string, or an
1793
1815
  instance of BlobProperties.
1794
1816
  :type copy_id: str or ~azure.storage.blob.BlobProperties
1817
+ :return: None
1795
1818
  :rtype: None
1796
1819
 
1797
1820
  .. admonition:: Example:
@@ -1854,7 +1877,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1854
1877
  This value is not tracked or validated on the client. To configure client-side network timesouts
1855
1878
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1856
1879
  #other-client--per-operation-configuration>`__.
1857
- :returns: A BlobLeaseClient object.
1880
+ :return: A BlobLeaseClient object.
1858
1881
  :rtype: ~azure.storage.blob.BlobLeaseClient
1859
1882
 
1860
1883
  .. admonition:: Example:
@@ -1910,6 +1933,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1910
1933
  Required if the blob has an active lease. Value can be a BlobLeaseClient object
1911
1934
  or the lease ID as a string.
1912
1935
  :paramtype lease: ~azure.storage.blob.BlobLeaseClient or str
1936
+ :return: None
1913
1937
  :rtype: None
1914
1938
  """
1915
1939
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
@@ -1980,7 +2004,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
1980
2004
  This value is not tracked or validated on the client. To configure client-side network timesouts
1981
2005
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
1982
2006
  #other-client--per-operation-configuration>`__.
1983
- :returns: Blob property dict.
2007
+ :return: Blob property dict.
1984
2008
  :rtype: dict[str, Any]
1985
2009
  """
1986
2010
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -2046,7 +2070,16 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2046
2070
  :keyword str source_authorization:
2047
2071
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
2048
2072
  the prefix of the source_authorization string.
2049
- :returns: Blob property dict.
2073
+ :keyword source_token_intent:
2074
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
2075
+ This is ignored for other forms of authentication.
2076
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
2077
+
2078
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
2079
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
2080
+
2081
+ :paramtype source_token_intent: Literal['backup']
2082
+ :return: Blob property dict.
2050
2083
  :rtype: dict[str, Any]
2051
2084
  """
2052
2085
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -2057,7 +2090,8 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2057
2090
  source_offset=source_offset,
2058
2091
  source_length=source_length,
2059
2092
  source_content_md5=source_content_md5,
2060
- **kwargs)
2093
+ **kwargs
2094
+ )
2061
2095
  try:
2062
2096
  return cast(Dict[str, Any], self._client.block_blob.stage_block_from_url(**options))
2063
2097
  except HttpResponseError as error:
@@ -2090,7 +2124,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2090
2124
  This value is not tracked or validated on the client. To configure client-side network timesouts
2091
2125
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2092
2126
  #other-client--per-operation-configuration>`__.
2093
- :returns: A tuple of two lists - committed and uncommitted blocks
2127
+ :return: A tuple of two lists - committed and uncommitted blocks
2094
2128
  :rtype: Tuple[List[BlobBlock], List[BlobBlock]]
2095
2129
  """
2096
2130
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
@@ -2202,7 +2236,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2202
2236
  This value is not tracked or validated on the client. To configure client-side network timesouts
2203
2237
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2204
2238
  #other-client--per-operation-configuration>`__.
2205
- :returns: Blob-updated property dict (Etag and last modified).
2239
+ :return: Blob-updated property dict (Etag and last modified).
2206
2240
  :rtype: dict(str, Any)
2207
2241
  """
2208
2242
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -2244,6 +2278,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2244
2278
  Required if the blob has an active lease. Value can be a BlobLeaseClient object
2245
2279
  or the lease ID as a string.
2246
2280
  :paramtype lease: ~azure.storage.blob.BlobLeaseClient or str
2281
+ :return: None
2247
2282
  :rtype: None
2248
2283
  """
2249
2284
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
@@ -2299,7 +2334,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2299
2334
  This value is not tracked or validated on the client. To configure client-side network timesouts
2300
2335
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2301
2336
  #other-client--per-operation-configuration>`__.
2302
- :returns: Blob-updated property dict (Etag and last modified)
2337
+ :return: Blob-updated property dict (Etag and last modified)
2303
2338
  :rtype: Dict[str, Any]
2304
2339
  """
2305
2340
  version_id = get_version_id(self.version_id, kwargs)
@@ -2332,7 +2367,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2332
2367
  This value is not tracked or validated on the client. To configure client-side network timesouts
2333
2368
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2334
2369
  #other-client--per-operation-configuration>`__.
2335
- :returns: Key value pairs of blob tags.
2370
+ :return: Key value pairs of blob tags.
2336
2371
  :rtype: Dict[str, str]
2337
2372
  """
2338
2373
  version_id = get_version_id(self.version_id, kwargs)
@@ -2404,7 +2439,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2404
2439
  This value is not tracked or validated on the client. To configure client-side network timesouts
2405
2440
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2406
2441
  #other-client--per-operation-configuration>`__.
2407
- :returns:
2442
+ :return:
2408
2443
  A tuple of two lists of page ranges as dictionaries with 'start' and 'end' keys.
2409
2444
  The first element are filled page ranges, the 2nd element is cleared page ranges.
2410
2445
  :rtype: tuple(list(dict(str, str), list(dict(str, str))
@@ -2497,7 +2532,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2497
2532
  This value is not tracked or validated on the client. To configure client-side network timesouts
2498
2533
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2499
2534
  #other-client--per-operation-configuration>`__.
2500
- :returns: An iterable (auto-paging) of PageRange.
2535
+ :return: An iterable (auto-paging) of PageRange.
2501
2536
  :rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.PageRange]
2502
2537
  """
2503
2538
  results_per_page = kwargs.pop('results_per_page', None)
@@ -2580,7 +2615,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2580
2615
  This value is not tracked or validated on the client. To configure client-side network timesouts
2581
2616
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2582
2617
  #other-client--per-operation-configuration>`__.
2583
- :returns:
2618
+ :return:
2584
2619
  A tuple of two lists of page ranges as dictionaries with 'start' and 'end' keys.
2585
2620
  The first element are filled page ranges, the 2nd element is cleared page ranges.
2586
2621
  :rtype: tuple(list(dict(str, str), list(dict(str, str))
@@ -2645,7 +2680,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2645
2680
  This value is not tracked or validated on the client. To configure client-side network timesouts
2646
2681
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2647
2682
  #other-client--per-operation-configuration>`__.
2648
- :returns: Blob-updated property dict (Etag and last modified).
2683
+ :return: Blob-updated property dict (Etag and last modified).
2649
2684
  :rtype: dict(str, Any)
2650
2685
  """
2651
2686
  options = _set_sequence_number_options(sequence_number_action, sequence_number=sequence_number, **kwargs)
@@ -2701,7 +2736,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2701
2736
  This value is not tracked or validated on the client. To configure client-side network timesouts
2702
2737
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2703
2738
  #other-client--per-operation-configuration>`__.
2704
- :returns: Blob-updated property dict (Etag and last modified).
2739
+ :return: Blob-updated property dict (Etag and last modified).
2705
2740
  :rtype: dict(str, Any)
2706
2741
  """
2707
2742
  if kwargs.get('cpk') and self.scheme.lower() != 'https':
@@ -2797,7 +2832,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2797
2832
  This value is not tracked or validated on the client. To configure client-side network timesouts
2798
2833
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
2799
2834
  #other-client--per-operation-configuration>`__.
2800
- :returns: Blob-updated property dict (Etag and last modified).
2835
+ :return: Blob-updated property dict (Etag and last modified).
2801
2836
  :rtype: dict(str, Any)
2802
2837
  """
2803
2838
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -2919,7 +2954,16 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2919
2954
  :keyword str source_authorization:
2920
2955
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
2921
2956
  the prefix of the source_authorization string.
2922
- :returns: Response after uploading pages from specified URL.
2957
+ :keyword source_token_intent:
2958
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
2959
+ This is ignored for other forms of authentication.
2960
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
2961
+
2962
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
2963
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
2964
+
2965
+ :paramtype source_token_intent: Literal['backup']
2966
+ :return: Response after uploading pages from specified URL.
2923
2967
  :rtype: Dict[str, Any]
2924
2968
  """
2925
2969
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -2999,7 +3043,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
2999
3043
  This value is not tracked or validated on the client. To configure client-side network timesouts
3000
3044
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
3001
3045
  #other-client--per-operation-configuration>`__.
3002
- :returns: Blob-updated property dict (Etag and last modified).
3046
+ :return: Blob-updated property dict (Etag and last modified).
3003
3047
  :rtype: dict(str, Any)
3004
3048
  """
3005
3049
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -3096,7 +3140,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
3096
3140
  This value is not tracked or validated on the client. To configure client-side network timesouts
3097
3141
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
3098
3142
  #other-client--per-operation-configuration>`__.
3099
- :returns: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3143
+ :return: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3100
3144
  :rtype: dict(str, Any)
3101
3145
  """
3102
3146
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -3211,7 +3255,16 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
3211
3255
  :keyword str source_authorization:
3212
3256
  Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
3213
3257
  the prefix of the source_authorization string.
3214
- :returns: Result after appending a new block.
3258
+ :keyword source_token_intent:
3259
+ Required when source is Azure Storage Files and using `TokenCredential` for authentication.
3260
+ This is ignored for other forms of authentication.
3261
+ Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:
3262
+
3263
+ backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
3264
+ ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.
3265
+
3266
+ :paramtype source_token_intent: Literal['backup']
3267
+ :return: Result after appending a new block.
3215
3268
  :rtype: Dict[str, Union[str, datetime, int]]
3216
3269
  """
3217
3270
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -3269,7 +3322,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
3269
3322
  This value is not tracked or validated on the client. To configure client-side network timesouts
3270
3323
  see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob
3271
3324
  #other-client--per-operation-configuration>`__.
3272
- :returns: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3325
+ :return: Blob-updated property dict (Etag, last modified, append offset, committed block count).
3273
3326
  :rtype: dict(str, Any)
3274
3327
  """
3275
3328
  if self.require_encryption or (self.key_encryption_key is not None):
@@ -3286,7 +3339,7 @@ class BlobClient(StorageAccountHostsMixin, StorageEncryptionMixin): # pylint: d
3286
3339
 
3287
3340
  The container need not already exist. Defaults to current blob's credentials.
3288
3341
 
3289
- :returns: A ContainerClient.
3342
+ :return: A ContainerClient.
3290
3343
  :rtype: ~azure.storage.blob.ContainerClient
3291
3344
 
3292
3345
  .. admonition:: Example:
@@ -197,6 +197,7 @@ def _upload_blob_from_url_options(source_url: str, **kwargs: Any) -> Dict[str, A
197
197
  overwrite = kwargs.pop('overwrite', False)
198
198
  content_settings = kwargs.pop('content_settings', None)
199
199
  source_authorization = kwargs.pop('source_authorization', None)
200
+ source_token_intent = kwargs.pop('source_token_intent', None)
200
201
  if content_settings:
201
202
  kwargs['blob_http_headers'] = BlobHTTPHeaders(
202
203
  blob_cache_control=content_settings.cache_control,
@@ -214,6 +215,7 @@ def _upload_blob_from_url_options(source_url: str, **kwargs: Any) -> Dict[str, A
214
215
 
215
216
  options = {
216
217
  'copy_source_authorization': source_authorization,
218
+ 'file_request_intent': source_token_intent,
217
219
  'content_length': 0,
218
220
  'copy_source_blob_properties': kwargs.pop('include_source_blob_properties', True),
219
221
  'source_content_md5': kwargs.pop('source_content_md5', None),
@@ -268,7 +270,7 @@ def _download_blob_options(
268
270
  The string representing the SDK package version.
269
271
  :param AzureBlobStorage client:
270
272
  The generated Blob Storage client.
271
- :returns: A dictionary containing the download blob options.
273
+ :return: A dictionary containing the download blob options.
272
274
  :rtype: Dict[str, Any]
273
275
  """
274
276
  if length is not None:
@@ -376,7 +378,7 @@ def _quick_query_options(snapshot: Optional[str], query_expression: str, **kwarg
376
378
  'timeout': kwargs.pop('timeout', None),
377
379
  'cls': return_headers_and_deserialized,
378
380
  }
379
- options.update(kwargs)
381
+ options.update({k: v for k, v in kwargs.items() if v is not None})
380
382
  return options, delimiter
381
383
 
382
384
  def _generic_delete_blob_options(delete_snapshots: Optional[str] = None, **kwargs: Any) -> Dict[str, Any]:
@@ -607,6 +609,7 @@ def _start_copy_from_url_options( # pylint:disable=too-many-statements
607
609
  requires_sync = kwargs.pop('requires_sync', None)
608
610
  encryption_scope_str = kwargs.pop('encryption_scope', None)
609
611
  source_authorization = kwargs.pop('source_authorization', None)
612
+ source_token_intent = kwargs.pop('source_token_intent', None)
610
613
  # If tags is a str, interpret that as copy_source_tags
611
614
  copy_source_tags = isinstance(tags, str)
612
615
 
@@ -626,6 +629,8 @@ def _start_copy_from_url_options( # pylint:disable=too-many-statements
626
629
  headers['x-ms-encryption-scope'] = encryption_scope_str
627
630
  if source_authorization:
628
631
  headers['x-ms-copy-source-authorization'] = source_authorization
632
+ if source_token_intent:
633
+ headers['x-ms-file-request-intent'] = source_token_intent
629
634
  if copy_source_tags:
630
635
  headers['x-ms-copy-source-tag-option'] = tags
631
636
  else:
@@ -635,6 +640,9 @@ def _start_copy_from_url_options( # pylint:disable=too-many-statements
635
640
  if source_authorization:
636
641
  raise ValueError(
637
642
  "Source authorization tokens are only supported for sync copy, please specify requires_sync=True")
643
+ if source_token_intent:
644
+ raise ValueError(
645
+ "Source token intent is only supported for sync copy, please specify requires_sync=True")
638
646
  if copy_source_tags:
639
647
  raise ValueError(
640
648
  "Copying source tags is only supported for sync copy, please specify requires_sync=True")
@@ -650,19 +658,20 @@ def _start_copy_from_url_options( # pylint:disable=too-many-statements
650
658
 
651
659
  options = {
652
660
  'copy_source': source_url,
653
- 'seal_blob': kwargs.pop('seal_destination_blob', None),
654
661
  'timeout': timeout,
655
662
  'modified_access_conditions': dest_mod_conditions,
656
- 'blob_tags_string': blob_tags_string,
657
663
  'headers': headers,
658
664
  'cls': return_response_headers,
659
665
  }
666
+
660
667
  if not incremental_copy:
661
668
  source_mod_conditions = get_source_conditions(kwargs)
662
669
  dest_access_conditions = get_access_conditions(kwargs.pop('destination_lease', None))
663
670
  options['source_modified_access_conditions'] = source_mod_conditions
664
671
  options['lease_access_conditions'] = dest_access_conditions
665
672
  options['tier'] = tier.value if tier else None
673
+ options['seal_blob'] = kwargs.pop('seal_destination_blob', None)
674
+ options['blob_tags_string'] = blob_tags_string
666
675
  options.update(kwargs)
667
676
  return options
668
677
 
@@ -729,6 +738,7 @@ def _stage_block_from_url_options(
729
738
  ) -> Dict[str, Any]:
730
739
  source_url = _encode_source_url(source_url=source_url)
731
740
  source_authorization = kwargs.pop('source_authorization', None)
741
+ source_token_intent = kwargs.pop('source_token_intent', None)
732
742
  if source_length is not None and source_offset is None:
733
743
  raise ValueError("Source offset value must not be None if length is set.")
734
744
  if source_length is not None and source_offset is not None:
@@ -747,6 +757,7 @@ def _stage_block_from_url_options(
747
757
  encryption_algorithm=cpk.algorithm)
748
758
  options = {
749
759
  'copy_source_authorization': source_authorization,
760
+ 'file_request_intent': source_token_intent,
750
761
  'block_id': block_id,
751
762
  'content_length': 0,
752
763
  'source_url': source_url,
@@ -1010,6 +1021,7 @@ def _upload_pages_from_url_options(
1010
1021
  if_sequence_number_equal_to=kwargs.pop('if_sequence_number_eq', None)
1011
1022
  )
1012
1023
  source_authorization = kwargs.pop('source_authorization', None)
1024
+ source_token_intent = kwargs.pop('source_token_intent', None)
1013
1025
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
1014
1026
  mod_conditions = get_modify_conditions(kwargs)
1015
1027
  source_mod_conditions = get_source_conditions(kwargs)
@@ -1023,6 +1035,7 @@ def _upload_pages_from_url_options(
1023
1035
 
1024
1036
  options = {
1025
1037
  'copy_source_authorization': source_authorization,
1038
+ 'file_request_intent': source_token_intent,
1026
1039
  'source_url': source_url,
1027
1040
  'content_length': 0,
1028
1041
  'source_range': source_range,
@@ -1152,6 +1165,7 @@ def _append_block_from_url_options(
1152
1165
  append_position=appendpos_condition
1153
1166
  )
1154
1167
  source_authorization = kwargs.pop('source_authorization', None)
1168
+ source_token_intent = kwargs.pop('source_token_intent', None)
1155
1169
  access_conditions = get_access_conditions(kwargs.pop('lease', None))
1156
1170
  mod_conditions = get_modify_conditions(kwargs)
1157
1171
  source_mod_conditions = get_source_conditions(kwargs)
@@ -1164,6 +1178,7 @@ def _append_block_from_url_options(
1164
1178
 
1165
1179
  options = {
1166
1180
  'copy_source_authorization': source_authorization,
1181
+ 'file_request_intent': source_token_intent,
1167
1182
  'source_url': copy_source_url,
1168
1183
  'content_length': 0,
1169
1184
  'source_range': source_range,