From 5b8755473619af2b71dfd21a4d1dbeefa9b20442 Mon Sep 17 00:00:00 2001 From: JinmingHu Date: Wed, 14 Jul 2021 11:01:00 +0800 Subject: [PATCH] PageBlobClient::SetBlobSize doesn't support encryption headers (#2603) * PageBlobClient::SetBlobSize doesn't support encryption headers * update ut --- .../blobs/protocol/blob_rest_client.hpp | 25 +------------------ .../src/page_blob_client.cpp | 7 ------ .../test/ut/blob_container_client_test.cpp | 1 + 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp index ae341e193..d9b776969 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp @@ -2024,7 +2024,7 @@ namespace Azure { namespace Storage { namespace Blobs { } /** - * @brief Azure::Storage::Blobs::PageBlobClient::Resize. + * @brief Response type for Azure::Storage::Blobs::PageBlobClient::Resize. */ struct ResizePageBlobResult final { @@ -10273,10 +10273,6 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Nullable IfSequenceNumberLessThanOrEqualTo; Azure::Nullable IfSequenceNumberLessThan; Azure::Nullable IfSequenceNumberEqualTo; - Azure::Nullable EncryptionKey; - Azure::Nullable> EncryptionKeySha256; - Azure::Nullable EncryptionAlgorithm; - Azure::Nullable EncryptionScope; Azure::Nullable IfModifiedSince; Azure::Nullable IfUnmodifiedSince; Azure::ETag IfMatch; @@ -10323,25 +10319,6 @@ namespace Azure { namespace Storage { namespace Blobs { "x-ms-if-sequence-number-eq", std::to_string(options.IfSequenceNumberEqualTo.Value())); } - if (options.EncryptionKey.HasValue()) - { - request.SetHeader("x-ms-encryption-key", options.EncryptionKey.Value()); - } - if (options.EncryptionKeySha256.HasValue()) - { - request.SetHeader( - "x-ms-encryption-key-sha256", - Azure::Core::Convert::Base64Encode(options.EncryptionKeySha256.Value())); - } - if (options.EncryptionAlgorithm.HasValue()) - { - request.SetHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.Value().ToString()); - } - if (options.EncryptionScope.HasValue()) - { - request.SetHeader("x-ms-encryption-scope", options.EncryptionScope.Value()); - } if (options.IfModifiedSince.HasValue()) { request.SetHeader( diff --git a/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp b/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp index 8ff723619..cf3dbea91 100644 --- a/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp @@ -227,13 +227,6 @@ namespace Azure { namespace Storage { namespace Blobs { protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch; protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch; protocolLayerOptions.IfTags = options.AccessConditions.TagConditions; - if (m_customerProvidedKey.HasValue()) - { - protocolLayerOptions.EncryptionKey = m_customerProvidedKey.Value().Key; - protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.Value().KeyHash; - protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.Value().Algorithm; - } - protocolLayerOptions.EncryptionScope = m_encryptionScope; return _detail::BlobRestClient::PageBlob::Resize( *m_pipeline, m_blobUrl, protocolLayerOptions, context); } diff --git a/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp index f39d181ff..ae3490a08 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp @@ -672,6 +672,7 @@ namespace Azure { namespace Storage { namespace Test { = Azure::Storage::Blobs::PageBlobClient::CreateFromConnectionString( StandardStorageConnectionString(), m_containerName, pageBlobName); EXPECT_NO_THROW(pageBlobClientWithoutEncryptionKey.GetPageRanges()); + EXPECT_NO_THROW(pageBlobClientWithoutEncryptionKey.Resize(blobContent.size() + 512)); } }