Skip to content

Commit f466161

Browse files
[Storage] [STG 96] Merge STG 96 into Main (#37764)
1 parent 0d6524f commit f466161

File tree

87 files changed

+3007
-1015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3007
-1015
lines changed

sdk/storage/azure-storage-blob/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Release History
22

3-
## 12.24.0b1 (2024-10-09)
3+
## 12.24.0b1 (2024-10-10)
44

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

1010
## 12.23.1 (2024-09-25)
1111

sdk/storage/azure-storage-blob/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/storage/azure-storage-blob",
5-
"Tag": "python/storage/azure-storage-blob_7df5687d1f"
5+
"Tag": "python/storage/azure-storage-blob_b11831f46e"
66
}

sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,9 @@ def set_immutability_policy(
12281228
.. versionadded:: 12.10.0
12291229
This was introduced in API version '2020-10-02'.
12301230
1231+
:keyword str version_id:
1232+
The version id parameter is an opaque DateTime
1233+
value that, when present, specifies the version of the blob to check if it exists.
12311234
:keyword int timeout:
12321235
Sets the server-side timeout for the operation in seconds. For more details see
12331236
https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations.
@@ -1238,9 +1241,11 @@ def set_immutability_policy(
12381241
:rtype: Dict[str, str]
12391242
"""
12401243

1244+
version_id = get_version_id(self.version_id, kwargs)
12411245
kwargs['immutability_policy_expiry'] = immutability_policy.expiry_time
12421246
kwargs['immutability_policy_mode'] = immutability_policy.policy_mode
1243-
return cast(Dict[str, str], self._client.blob.set_immutability_policy(cls=return_response_headers, **kwargs))
1247+
return cast(Dict[str, str], self._client.blob.set_immutability_policy(
1248+
cls=return_response_headers, version_id=version_id, **kwargs))
12441249

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

1262-
self._client.blob.delete_immutability_policy(**kwargs)
1270+
version_id = get_version_id(self.version_id, kwargs)
1271+
self._client.blob.delete_immutability_policy(version_id=version_id, **kwargs)
12631272

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

1283-
return cast(Dict[str, Union[str, datetime, bool]],
1284-
self._client.blob.set_legal_hold(legal_hold, cls=return_response_headers, **kwargs))
1295+
version_id = get_version_id(self.version_id, kwargs)
1296+
return cast(Dict[str, Union[str, datetime, bool]], self._client.blob.set_legal_hold(
1297+
legal_hold, version_id=version_id, cls=return_response_headers, **kwargs))
12851298

12861299
@distributed_trace
12871300
def create_page_blob(

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
4848
:param base_url: Service URL. Required. Default value is "".
4949
:type base_url: str
5050
:keyword version: Specifies the version of the operation to use for this request. Default value
51-
is "2024-08-04". Note that overriding this default value may result in unsupported behavior.
51+
is "2025-01-05". Note that overriding this default value may result in unsupported behavior.
5252
:paramtype version: str
5353
"""
5454

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class AzureBlobStorageConfiguration: # pylint: disable=too-many-instance-attrib
2323
desired operation. Required.
2424
:type url: str
2525
:keyword version: Specifies the version of the operation to use for this request. Default value
26-
is "2024-08-04". Note that overriding this default value may result in unsupported behavior.
26+
is "2025-01-05". Note that overriding this default value may result in unsupported behavior.
2727
:paramtype version: str
2828
"""
2929

3030
def __init__(self, url: str, **kwargs: Any) -> None:
31-
version: Literal["2024-08-04"] = kwargs.pop("version", "2024-08-04")
31+
version: Literal["2025-01-05"] = kwargs.pop("version", "2025-01-05")
3232

3333
if url is None:
3434
raise ValueError("Parameter 'url' must not be None.")

0 commit comments

Comments
 (0)