Skip to content

Commit

Permalink
[Storage] [STG 96] Merge STG 96 into Main (#37764)
Browse files Browse the repository at this point in the history
  • Loading branch information
weirongw23-msft authored Oct 10, 2024
1 parent 0d6524f commit f466161
Show file tree
Hide file tree
Showing 87 changed files with 3,007 additions and 1,015 deletions.
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-blob/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Release History

## 12.24.0b1 (2024-10-09)
## 12.24.0b1 (2024-10-10)

### Features Added
- Added support for service version 2025-01-05.
- Added support for passing metadata to `upload_blob_from_url` via the new `metadata` keyword.
- Added support for `set_immutability_policy`, `delete_immutability_policy` and `set_legal_hold` for Blob Snapshots and Versions.
- Added support for `set_immutability_policy`, `delete_immutability_policy` and `set_legal_hold` for Blob snapshots and versions.

## 12.23.1 (2024-09-25)

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_7df5687d1f"
"Tag": "python/storage/azure-storage-blob_b11831f46e"
}
21 changes: 17 additions & 4 deletions sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,9 @@ def set_immutability_policy(
.. versionadded:: 12.10.0
This was introduced in API version '2020-10-02'.
:keyword str version_id:
The version id parameter is an opaque DateTime
value that, when present, specifies the version of the blob to check if it exists.
:keyword int timeout:
Sets the server-side timeout for the operation in seconds. For more details see
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
Expand All @@ -1238,9 +1241,11 @@ def set_immutability_policy(
:rtype: Dict[str, str]
"""

version_id = get_version_id(self.version_id, kwargs)
kwargs['immutability_policy_expiry'] = immutability_policy.expiry_time
kwargs['immutability_policy_mode'] = immutability_policy.policy_mode
return cast(Dict[str, str], self._client.blob.set_immutability_policy(cls=return_response_headers, **kwargs))
return cast(Dict[str, str], self._client.blob.set_immutability_policy(
cls=return_response_headers, version_id=version_id, **kwargs))

@distributed_trace
def delete_immutability_policy(self, **kwargs: Any) -> None:
Expand All @@ -1249,6 +1254,9 @@ def delete_immutability_policy(self, **kwargs: Any) -> None:
.. versionadded:: 12.10.0
This operation was introduced in API version '2020-10-02'.
:keyword str version_id:
The version id parameter is an opaque DateTime
value that, when present, specifies the version of the blob to check if it exists.
:keyword int timeout:
Sets the server-side timeout for the operation in seconds. For more details see
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
Expand All @@ -1259,7 +1267,8 @@ def delete_immutability_policy(self, **kwargs: Any) -> None:
:rtype: Dict[str, str]
"""

self._client.blob.delete_immutability_policy(**kwargs)
version_id = get_version_id(self.version_id, kwargs)
self._client.blob.delete_immutability_policy(version_id=version_id, **kwargs)

@distributed_trace
def set_legal_hold(self, legal_hold: bool, **kwargs: Any) -> Dict[str, Union[str, datetime, bool]]:
Expand All @@ -1270,6 +1279,9 @@ def set_legal_hold(self, legal_hold: bool, **kwargs: Any) -> Dict[str, Union[str
:param bool legal_hold:
Specified if a legal hold should be set on the blob.
:keyword str version_id:
The version id parameter is an opaque DateTime
value that, when present, specifies the version of the blob to check if it exists.
:keyword int timeout:
Sets the server-side timeout for the operation in seconds. For more details see
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
Expand All @@ -1280,8 +1292,9 @@ def set_legal_hold(self, legal_hold: bool, **kwargs: Any) -> Dict[str, Union[str
:rtype: Dict[str, Union[str, datetime, bool]]
"""

return cast(Dict[str, Union[str, datetime, bool]],
self._client.blob.set_legal_hold(legal_hold, cls=return_response_headers, **kwargs))
version_id = get_version_id(self.version_id, kwargs)
return cast(Dict[str, Union[str, datetime, bool]], self._client.blob.set_legal_hold(
legal_hold, version_id=version_id, cls=return_response_headers, **kwargs))

@distributed_trace
def create_page_blob(
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 "2024-08-04". Note that overriding this default value may result in unsupported behavior.
is "2025-01-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 "2024-08-04". Note that overriding this default value may result in unsupported behavior.
is "2025-01-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["2024-08-04"] = kwargs.pop("version", "2024-08-04")
version: Literal["2025-01-05"] = kwargs.pop("version", "2025-01-05")

if url is None:
raise ValueError("Parameter 'url' must not be None.")
Expand Down
Loading

0 comments on commit f466161

Please sign in to comment.