PageBlobClient::SetBlobSize doesn't support encryption headers (#2603)

* PageBlobClient::SetBlobSize doesn't support encryption headers

* update ut
This commit is contained in:
JinmingHu 2021-07-14 11:01:00 +08:00 committed by GitHub
parent 83a3a0a749
commit 5b87554736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 31 deletions

View File

@ -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<int64_t> IfSequenceNumberLessThanOrEqualTo;
Azure::Nullable<int64_t> IfSequenceNumberLessThan;
Azure::Nullable<int64_t> IfSequenceNumberEqualTo;
Azure::Nullable<std::string> EncryptionKey;
Azure::Nullable<std::vector<uint8_t>> EncryptionKeySha256;
Azure::Nullable<EncryptionAlgorithmType> EncryptionAlgorithm;
Azure::Nullable<std::string> EncryptionScope;
Azure::Nullable<Azure::DateTime> IfModifiedSince;
Azure::Nullable<Azure::DateTime> 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(

View File

@ -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);
}

View File

@ -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));
}
}