Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] [STG 98] Merge feature/storage-stg98 to main #39834

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion sdk/storage/azure-storage-blob/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Release History

## 12.25.0 (Unreleased)
## 12.26.0b1 (Unreleased)

### Features Added
- Added support for service version 2025-07-05.

## 12.25.0b1 (2025-02-11)

Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/storage/azure-storage-blob",
"Tag": "python/storage/azure-storage-blob_b11831f46e"
"Tag": "python/storage/azure-storage-blob_5c69f3f177"
}
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,15 @@ def upload_blob_from_url(
:keyword str source_authorization:
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
the prefix of the source_authorization string.
:keyword source_token_intent:
Required when source is Azure Storage Files and using `TokenCredential` for authentication.
This is ignored for other forms of authentication.
Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

:paramtype source_token_intent: Literal['backup']
:returns: Blob-updated property Dict (Etag and last modified)
:rtype: Dict[str, Any]
"""
Expand All @@ -430,7 +439,8 @@ def upload_blob_from_url(
options = _upload_blob_from_url_options(
source_url=source_url,
metadata=metadata,
**kwargs)
**kwargs
)
try:
return cast(Dict[str, Any], self._client.block_blob.put_blob_from_url(**options))
except HttpResponseError as error:
Expand Down Expand Up @@ -1746,6 +1756,15 @@ def start_copy_from_url(

.. versionadded:: 12.9.0

:keyword source_token_intent:
Required when source is Azure Storage Files and using `TokenCredential` for authentication.
This is ignored for other forms of authentication.
Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

:paramtype source_token_intent: Literal['backup']
:keyword str encryption_scope:
A predefined encryption scope used to encrypt the data on the sync copied blob. An encryption
scope can be created using the Management API and referenced here by name. If a default
Expand All @@ -1770,7 +1789,8 @@ def start_copy_from_url(
source_url=source_url,
metadata=metadata,
incremental_copy=incremental_copy,
**kwargs)
**kwargs
)
try:
if incremental_copy:
return cast(Dict[str, Union[str, datetime]], self._client.page_blob.copy_incremental(**options))
Expand Down Expand Up @@ -2046,6 +2066,15 @@ def stage_block_from_url(
:keyword str source_authorization:
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
the prefix of the source_authorization string.
:keyword source_token_intent:
Required when source is Azure Storage Files and using `TokenCredential` for authentication.
This is ignored for other forms of authentication.
Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

:paramtype source_token_intent: Literal['backup']
:returns: Blob property dict.
:rtype: dict[str, Any]
"""
Expand All @@ -2057,7 +2086,8 @@ def stage_block_from_url(
source_offset=source_offset,
source_length=source_length,
source_content_md5=source_content_md5,
**kwargs)
**kwargs
)
try:
return cast(Dict[str, Any], self._client.block_blob.stage_block_from_url(**options))
except HttpResponseError as error:
Expand Down Expand Up @@ -2919,6 +2949,15 @@ def upload_pages_from_url(
:keyword str source_authorization:
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
the prefix of the source_authorization string.
:keyword source_token_intent:
Required when source is Azure Storage Files and using `TokenCredential` for authentication.
This is ignored for other forms of authentication.
Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

:paramtype source_token_intent: Literal['backup']
:returns: Response after uploading pages from specified URL.
:rtype: Dict[str, Any]
"""
Expand Down Expand Up @@ -3211,6 +3250,15 @@ def append_block_from_url(
:keyword str source_authorization:
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is
the prefix of the source_authorization string.
:keyword source_token_intent:
Required when source is Azure Storage Files and using `TokenCredential` for authentication.
This is ignored for other forms of authentication.
Specifies the intent for all requests when using `TokenCredential` authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directory
ACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

:paramtype source_token_intent: Literal['backup']
:returns: Result after appending a new block.
:rtype: Dict[str, Union[str, datetime, int]]
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def _upload_blob_from_url_options(source_url: str, **kwargs: Any) -> Dict[str, A
overwrite = kwargs.pop('overwrite', False)
content_settings = kwargs.pop('content_settings', None)
source_authorization = kwargs.pop('source_authorization', None)
source_token_intent = kwargs.pop('source_token_intent', None)
if content_settings:
kwargs['blob_http_headers'] = BlobHTTPHeaders(
blob_cache_control=content_settings.cache_control,
Expand All @@ -214,6 +215,7 @@ def _upload_blob_from_url_options(source_url: str, **kwargs: Any) -> Dict[str, A

options = {
'copy_source_authorization': source_authorization,
'file_request_intent': source_token_intent,
'content_length': 0,
'copy_source_blob_properties': kwargs.pop('include_source_blob_properties', True),
'source_content_md5': kwargs.pop('source_content_md5', None),
Expand Down Expand Up @@ -607,6 +609,7 @@ def _start_copy_from_url_options( # pylint:disable=too-many-statements
requires_sync = kwargs.pop('requires_sync', None)
encryption_scope_str = kwargs.pop('encryption_scope', None)
source_authorization = kwargs.pop('source_authorization', None)
source_token_intent = kwargs.pop('source_token_intent', None)
# If tags is a str, interpret that as copy_source_tags
copy_source_tags = isinstance(tags, str)

Expand All @@ -626,6 +629,8 @@ def _start_copy_from_url_options( # pylint:disable=too-many-statements
headers['x-ms-encryption-scope'] = encryption_scope_str
if source_authorization:
headers['x-ms-copy-source-authorization'] = source_authorization
if source_token_intent:
headers['x-ms-file-request-intent'] = source_token_intent
if copy_source_tags:
headers['x-ms-copy-source-tag-option'] = tags
else:
Expand All @@ -635,6 +640,9 @@ def _start_copy_from_url_options( # pylint:disable=too-many-statements
if source_authorization:
raise ValueError(
"Source authorization tokens are only supported for sync copy, please specify requires_sync=True")
if source_token_intent:
raise ValueError(
"Source token intent is only supported for sync copy, please specify requires_sync=True")
if copy_source_tags:
raise ValueError(
"Copying source tags is only supported for sync copy, please specify requires_sync=True")
Expand Down Expand Up @@ -729,6 +737,7 @@ def _stage_block_from_url_options(
) -> Dict[str, Any]:
source_url = _encode_source_url(source_url=source_url)
source_authorization = kwargs.pop('source_authorization', None)
source_token_intent = kwargs.pop('source_token_intent', None)
if source_length is not None and source_offset is None:
raise ValueError("Source offset value must not be None if length is set.")
if source_length is not None and source_offset is not None:
Expand All @@ -747,6 +756,7 @@ def _stage_block_from_url_options(
encryption_algorithm=cpk.algorithm)
options = {
'copy_source_authorization': source_authorization,
'file_request_intent': source_token_intent,
'block_id': block_id,
'content_length': 0,
'source_url': source_url,
Expand Down Expand Up @@ -1010,6 +1020,7 @@ def _upload_pages_from_url_options(
if_sequence_number_equal_to=kwargs.pop('if_sequence_number_eq', None)
)
source_authorization = kwargs.pop('source_authorization', None)
source_token_intent = kwargs.pop('source_token_intent', None)
access_conditions = get_access_conditions(kwargs.pop('lease', None))
mod_conditions = get_modify_conditions(kwargs)
source_mod_conditions = get_source_conditions(kwargs)
Expand All @@ -1023,6 +1034,7 @@ def _upload_pages_from_url_options(

options = {
'copy_source_authorization': source_authorization,
'file_request_intent': source_token_intent,
'source_url': source_url,
'content_length': 0,
'source_range': source_range,
Expand Down Expand Up @@ -1152,6 +1164,7 @@ def _append_block_from_url_options(
append_position=appendpos_condition
)
source_authorization = kwargs.pop('source_authorization', None)
source_token_intent = kwargs.pop('source_token_intent', None)
access_conditions = get_access_conditions(kwargs.pop('lease', None))
mod_conditions = get_modify_conditions(kwargs)
source_mod_conditions = get_source_conditions(kwargs)
Expand All @@ -1164,6 +1177,7 @@ def _append_block_from_url_options(

options = {
'copy_source_authorization': source_authorization,
'file_request_intent': source_token_intent,
'source_url': copy_source_url,
'content_length': 0,
'source_range': source_range,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
:param base_url: Service URL. Required. Default value is "".
:type base_url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2025-01-05". Note that overriding this default value may result in unsupported behavior.
is "2025-07-05". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib
desired operation. Required.
:type url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2025-01-05". Note that overriding this default value may result in unsupported behavior.
is "2025-07-05". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

def __init__(self, url: str, **kwargs: Any) -> None:
version: Literal["2025-01-05"] = kwargs.pop("version", "2025-01-05")
version: Literal["2025-07-05"] = kwargs.pop("version", "2025-07-05")

if url is None:
raise ValueError("Parameter 'url' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
:param base_url: Service URL. Required. Default value is "".
:type base_url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2025-01-05". Note that overriding this default value may result in unsupported behavior.
is "2025-07-05". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib
desired operation. Required.
:type url: str
:keyword version: Specifies the version of the operation to use for this request. Default value
is "2025-01-05". Note that overriding this default value may result in unsupported behavior.
is "2025-07-05". Note that overriding this default value may result in unsupported behavior.
:paramtype version: str
"""

def __init__(self, url: str, **kwargs: Any) -> None:
version: Literal["2025-01-05"] = kwargs.pop("version", "2025-01-05")
version: Literal["2025-07-05"] = kwargs.pop("version", "2025-07-05")

if url is None:
raise ValueError("Parameter 'url' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ async def append_block_from_url(
transactional_content_md5: Optional[bytes] = None,
request_id_parameter: Optional[str] = None,
copy_source_authorization: Optional[str] = None,
file_request_intent: Optional[Union[str, _models.FileShareTokenIntent]] = None,
cpk_info: Optional[_models.CpkInfo] = None,
cpk_scope_info: Optional[_models.CpkScopeInfo] = None,
lease_access_conditions: Optional[_models.LeaseAccessConditions] = None,
Expand Down Expand Up @@ -486,6 +487,8 @@ async def append_block_from_url(
:param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid
OAuth access token to copy source. Default value is None.
:type copy_source_authorization: str
:param file_request_intent: Valid value is backup. "backup" Default value is None.
:type file_request_intent: str or ~azure.storage.blob.models.FileShareTokenIntent
:param cpk_info: Parameter group. Default value is None.
:type cpk_info: ~azure.storage.blob.models.CpkInfo
:param cpk_scope_info: Parameter group. Default value is None.
Expand Down Expand Up @@ -584,6 +587,7 @@ async def append_block_from_url(
source_if_none_match=_source_if_none_match,
request_id_parameter=request_id_parameter,
copy_source_authorization=copy_source_authorization,
file_request_intent=file_request_intent,
comp=comp,
version=self._config.version,
headers=_headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,7 @@ async def copy_from_url(
legal_hold: Optional[bool] = None,
copy_source_authorization: Optional[str] = None,
copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None,
file_request_intent: Optional[Union[str, _models.FileShareTokenIntent]] = None,
source_modified_access_conditions: Optional[_models.SourceModifiedAccessConditions] = None,
modified_access_conditions: Optional[_models.ModifiedAccessConditions] = None,
lease_access_conditions: Optional[_models.LeaseAccessConditions] = None,
Expand Down Expand Up @@ -2344,6 +2345,8 @@ async def copy_from_url(
copied or replaced with the tags specified by x-ms-tags. Known values are: "REPLACE" and
"COPY". Default value is None.
:type copy_source_tags: str or ~azure.storage.blob.models.BlobCopySourceTags
:param file_request_intent: Valid value is backup. "backup" Default value is None.
:type file_request_intent: str or ~azure.storage.blob.models.FileShareTokenIntent
:param source_modified_access_conditions: Parameter group. Default value is None.
:type source_modified_access_conditions:
~azure.storage.blob.models.SourceModifiedAccessConditions
Expand Down Expand Up @@ -2425,6 +2428,7 @@ async def copy_from_url(
copy_source_authorization=copy_source_authorization,
encryption_scope=_encryption_scope,
copy_source_tags=copy_source_tags,
file_request_intent=file_request_intent,
x_ms_requires_sync=x_ms_requires_sync,
version=self._config.version,
headers=_headers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ async def put_blob_from_url(
copy_source_blob_properties: Optional[bool] = None,
copy_source_authorization: Optional[str] = None,
copy_source_tags: Optional[Union[str, _models.BlobCopySourceTags]] = None,
file_request_intent: Optional[Union[str, _models.FileShareTokenIntent]] = None,
blob_http_headers: Optional[_models.BlobHTTPHeaders] = None,
lease_access_conditions: Optional[_models.LeaseAccessConditions] = None,
cpk_info: Optional[_models.CpkInfo] = None,
Expand Down Expand Up @@ -367,6 +368,8 @@ async def put_blob_from_url(
copied or replaced with the tags specified by x-ms-tags. Known values are: "REPLACE" and
"COPY". Default value is None.
:type copy_source_tags: str or ~azure.storage.blob.models.BlobCopySourceTags
:param file_request_intent: Valid value is backup. "backup" Default value is None.
:type file_request_intent: str or ~azure.storage.blob.models.FileShareTokenIntent
:param blob_http_headers: Parameter group. Default value is None.
:type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders
:param lease_access_conditions: Parameter group. Default value is None.
Expand Down Expand Up @@ -482,6 +485,7 @@ async def put_blob_from_url(
copy_source_blob_properties=copy_source_blob_properties,
copy_source_authorization=copy_source_authorization,
copy_source_tags=copy_source_tags,
file_request_intent=file_request_intent,
blob_type=blob_type,
version=self._config.version,
headers=_headers,
Expand Down Expand Up @@ -690,6 +694,7 @@ async def stage_block_from_url(
timeout: Optional[int] = None,
request_id_parameter: Optional[str] = None,
copy_source_authorization: Optional[str] = None,
file_request_intent: Optional[Union[str, _models.FileShareTokenIntent]] = None,
cpk_info: Optional[_models.CpkInfo] = None,
cpk_scope_info: Optional[_models.CpkScopeInfo] = None,
lease_access_conditions: Optional[_models.LeaseAccessConditions] = None,
Expand Down Expand Up @@ -728,6 +733,8 @@ async def stage_block_from_url(
:param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid
OAuth access token to copy source. Default value is None.
:type copy_source_authorization: str
:param file_request_intent: Valid value is backup. "backup" Default value is None.
:type file_request_intent: str or ~azure.storage.blob.models.FileShareTokenIntent
:param cpk_info: Parameter group. Default value is None.
:type cpk_info: ~azure.storage.blob.models.CpkInfo
:param cpk_scope_info: Parameter group. Default value is None.
Expand Down Expand Up @@ -798,6 +805,7 @@ async def stage_block_from_url(
source_if_none_match=_source_if_none_match,
request_id_parameter=request_id_parameter,
copy_source_authorization=copy_source_authorization,
file_request_intent=file_request_intent,
comp=comp,
version=self._config.version,
headers=_headers,
Expand Down
Loading
Loading