Skip to content

Commit 582085e

Browse files
Privated hierarchy traversal and fixed encryption algorithm (Azure#18212)
* Privated hierarchy traversal * fixed encryption algo * updated changelog
1 parent bfb7119 commit 582085e

24 files changed

+190
-267
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Release History
22

33
## 12.8.1 (2021-04-20)
4-
**New Features**
5-
- Added support for `BlobClient -> ContainerClient -> BlobServiceClient` Traversal
6-
74
**Fixes**
85
- Fixed retry on large block upload
96
- Make `AccountName`, `AccountKey` etc. in conn_str case insensitive
@@ -14,6 +11,7 @@
1411
- Fixed retries for blob download streams (#18164, #17974, #10572 (comment))
1512
- Added chunk streaming docstrings and samples (#17149, #11009)
1613
- Added retry for blob download (#17974, #10572)
14+
- Fixed encryption algorithm hardcoded setting (#17835)
1715

1816

1917
## 12.8.0 (2021-03-01)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3754,7 +3754,7 @@ def seal_append_blob(self, **kwargs):
37543754
process_storage_error(error)
37553755

37563756
@distributed_trace
3757-
def get_container_client(self): # pylint: disable=client-method-missing-kwargs
3757+
def _get_container_client(self): # pylint: disable=client-method-missing-kwargs
37583758
# type: (...) -> ContainerClient
37593759
"""Get a client to interact with the blob's parent container.
37603760

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def set_container_metadata( # type: ignore
584584
process_storage_error(error)
585585

586586
@distributed_trace
587-
def get_blob_service_client(self): # pylint: disable=client-method-missing-kwargs
587+
def _get_blob_service_client(self): # pylint: disable=client-method-missing-kwargs
588588
# type: (...) -> BlobServiceClient
589589
"""Get a client to interact with the container's parent service account.
590590

sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ async def create(
4545
content_length: int,
4646
timeout: Optional[int] = None,
4747
metadata: Optional[str] = None,
48-
encryption_algorithm: Optional[str] = "AES256",
4948
request_id_parameter: Optional[str] = None,
5049
blob_tags_string: Optional[str] = None,
5150
blob_http_headers: Optional["_models.BlobHTTPHeaders"] = None,
@@ -71,10 +70,6 @@ async def create(
7170
rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more
7271
information.
7372
:type metadata: str
74-
:param encryption_algorithm: The algorithm used to produce the encryption key hash. Currently,
75-
the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is
76-
provided.
77-
:type encryption_algorithm: str
7873
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
7974
limit that is recorded in the analytics logs when storage analytics logging is enabled.
8075
:type request_id_parameter: str
@@ -110,6 +105,7 @@ async def create(
110105
_blob_content_disposition = None
111106
_encryption_key = None
112107
_encryption_key_sha256 = None
108+
_encryption_algorithm = None
113109
_encryption_scope = None
114110
_if_modified_since = None
115111
_if_unmodified_since = None
@@ -126,6 +122,7 @@ async def create(
126122
if cpk_info is not None:
127123
_encryption_key = cpk_info.encryption_key
128124
_encryption_key_sha256 = cpk_info.encryption_key_sha256
125+
_encryption_algorithm = cpk_info.encryption_algorithm
129126
if cpk_scope_info is not None:
130127
_encryption_scope = cpk_scope_info.encryption_scope
131128
if lease_access_conditions is not None:
@@ -175,8 +172,8 @@ async def create(
175172
header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str')
176173
if _encryption_key_sha256 is not None:
177174
header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str')
178-
if encryption_algorithm is not None:
179-
header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'str')
175+
if _encryption_algorithm is not None:
176+
header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str')
180177
if _encryption_scope is not None:
181178
header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str')
182179
if _if_modified_since is not None:
@@ -230,7 +227,6 @@ async def append_block(
230227
timeout: Optional[int] = None,
231228
transactional_content_md5: Optional[bytearray] = None,
232229
transactional_content_crc64: Optional[bytearray] = None,
233-
encryption_algorithm: Optional[str] = "AES256",
234230
request_id_parameter: Optional[str] = None,
235231
lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None,
236232
append_position_access_conditions: Optional["_models.AppendPositionAccessConditions"] = None,
@@ -257,10 +253,6 @@ async def append_block(
257253
:param transactional_content_crc64: Specify the transactional crc64 for the body, to be
258254
validated by the service.
259255
:type transactional_content_crc64: bytearray
260-
:param encryption_algorithm: The algorithm used to produce the encryption key hash. Currently,
261-
the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is
262-
provided.
263-
:type encryption_algorithm: str
264256
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
265257
limit that is recorded in the analytics logs when storage analytics logging is enabled.
266258
:type request_id_parameter: str
@@ -290,6 +282,7 @@ async def append_block(
290282
_append_position = None
291283
_encryption_key = None
292284
_encryption_key_sha256 = None
285+
_encryption_algorithm = None
293286
_encryption_scope = None
294287
_if_modified_since = None
295288
_if_unmodified_since = None
@@ -302,6 +295,7 @@ async def append_block(
302295
if cpk_info is not None:
303296
_encryption_key = cpk_info.encryption_key
304297
_encryption_key_sha256 = cpk_info.encryption_key_sha256
298+
_encryption_algorithm = cpk_info.encryption_algorithm
305299
if cpk_scope_info is not None:
306300
_encryption_scope = cpk_scope_info.encryption_scope
307301
if lease_access_conditions is not None:
@@ -346,8 +340,8 @@ async def append_block(
346340
header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str')
347341
if _encryption_key_sha256 is not None:
348342
header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str')
349-
if encryption_algorithm is not None:
350-
header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'str')
343+
if _encryption_algorithm is not None:
344+
header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str')
351345
if _encryption_scope is not None:
352346
header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str')
353347
if _if_modified_since is not None:
@@ -406,7 +400,6 @@ async def append_block_from_url(
406400
source_contentcrc64: Optional[bytearray] = None,
407401
timeout: Optional[int] = None,
408402
transactional_content_md5: Optional[bytearray] = None,
409-
encryption_algorithm: Optional[str] = "AES256",
410403
request_id_parameter: Optional[str] = None,
411404
cpk_info: Optional["_models.CpkInfo"] = None,
412405
cpk_scope_info: Optional["_models.CpkScopeInfo"] = None,
@@ -440,10 +433,6 @@ async def append_block_from_url(
440433
:param transactional_content_md5: Specify the transactional md5 for the body, to be validated
441434
by the service.
442435
:type transactional_content_md5: bytearray
443-
:param encryption_algorithm: The algorithm used to produce the encryption key hash. Currently,
444-
the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is
445-
provided.
446-
:type encryption_algorithm: str
447436
:param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character
448437
limit that is recorded in the analytics logs when storage analytics logging is enabled.
449438
:type request_id_parameter: str
@@ -472,6 +461,7 @@ async def append_block_from_url(
472461

473462
_encryption_key = None
474463
_encryption_key_sha256 = None
464+
_encryption_algorithm = None
475465
_encryption_scope = None
476466
_lease_id = None
477467
_max_size = None
@@ -491,6 +481,7 @@ async def append_block_from_url(
491481
if cpk_info is not None:
492482
_encryption_key = cpk_info.encryption_key
493483
_encryption_key_sha256 = cpk_info.encryption_key_sha256
484+
_encryption_algorithm = cpk_info.encryption_algorithm
494485
if cpk_scope_info is not None:
495486
_encryption_scope = cpk_scope_info.encryption_scope
496487
if lease_access_conditions is not None:
@@ -538,8 +529,8 @@ async def append_block_from_url(
538529
header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str')
539530
if _encryption_key_sha256 is not None:
540531
header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str')
541-
if encryption_algorithm is not None:
542-
header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", encryption_algorithm, 'str')
532+
if _encryption_algorithm is not None:
533+
header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str')
543534
if _encryption_scope is not None:
544535
header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str')
545536
if _lease_id is not None:

0 commit comments

Comments
 (0)