revert non-overwriting changes (#773)
This commit is contained in:
parent
570c774ebd
commit
e0d717a0d3
@ -930,11 +930,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Whether the upload should overwrite any existing blobs.
|
||||
*/
|
||||
bool Overwrite = false;
|
||||
|
||||
/**
|
||||
* @brief An MD5 hash of the blob content. This hash is used to verify the integrity of
|
||||
* the blob during transport. When this header is specified, the storage service checks the hash
|
||||
@ -1149,11 +1144,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Whether the existing blob should be deleted and recreated.
|
||||
*/
|
||||
bool Overwrite = false;
|
||||
|
||||
/**
|
||||
* @brief The standard HTTP header system properties to set.
|
||||
*/
|
||||
@ -1267,11 +1257,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
*/
|
||||
Azure::Core::Context Context;
|
||||
|
||||
/**
|
||||
* @brief Whether the existing blob should be deleted and recreated.
|
||||
*/
|
||||
bool Overwrite = false;
|
||||
|
||||
/**
|
||||
* @brief The sequence number is a user-controlled value that you can use to track requests. The
|
||||
* value of the sequence number must be between 0 and 2^63 - 1.
|
||||
|
||||
@ -85,10 +85,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
if (!options.Overwrite)
|
||||
{
|
||||
protocolLayerOptions.IfNoneMatch = c_ETagWildcard;
|
||||
}
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
if (m_customerProvidedKey.HasValue())
|
||||
{
|
||||
|
||||
@ -92,10 +92,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
if (!options.Overwrite)
|
||||
{
|
||||
protocolLayerOptions.IfNoneMatch = c_ETagWildcard;
|
||||
}
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
if (m_customerProvidedKey.HasValue())
|
||||
{
|
||||
@ -137,7 +133,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
uploadBlockBlobOptions.HttpHeaders = options.HttpHeaders;
|
||||
uploadBlockBlobOptions.Metadata = options.Metadata;
|
||||
uploadBlockBlobOptions.Tier = options.Tier;
|
||||
uploadBlockBlobOptions.Overwrite = true;
|
||||
return Upload(&contentStream, uploadBlockBlobOptions);
|
||||
}
|
||||
|
||||
@ -219,7 +214,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
uploadBlockBlobOptions.HttpHeaders = options.HttpHeaders;
|
||||
uploadBlockBlobOptions.Metadata = options.Metadata;
|
||||
uploadBlockBlobOptions.Tier = options.Tier;
|
||||
uploadBlockBlobOptions.Overwrite = true;
|
||||
return Upload(&contentStream, uploadBlockBlobOptions);
|
||||
}
|
||||
|
||||
|
||||
@ -89,10 +89,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
|
||||
protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
|
||||
protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
|
||||
if (!options.Overwrite)
|
||||
{
|
||||
protocolLayerOptions.IfNoneMatch = c_ETagWildcard;
|
||||
}
|
||||
protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
|
||||
if (m_customerProvidedKey.HasValue())
|
||||
{
|
||||
|
||||
@ -330,15 +330,4 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_TRUE(getPropertiesResult->IsSealed.GetValue());
|
||||
}
|
||||
|
||||
TEST_F(AppendBlobClientTest, Overwrite)
|
||||
{
|
||||
std::string blobName = RandomString();
|
||||
auto blobClient = m_blobContainerClient->GetAppendBlobClient(blobName);
|
||||
EXPECT_NO_THROW(blobClient.Create());
|
||||
EXPECT_THROW(blobClient.Create(), StorageError);
|
||||
Blobs::CreateAppendBlobOptions options;
|
||||
options.Overwrite = true;
|
||||
EXPECT_NO_THROW(blobClient.Create(options));
|
||||
}
|
||||
|
||||
}}} // namespace Azure::Storage::Test
|
||||
|
||||
@ -883,7 +883,6 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
options.AccessConditions.TagConditions = failWhereExpression;
|
||||
EXPECT_THROW(appendBlobClient.Create(options), StorageError);
|
||||
options.AccessConditions.TagConditions = successWhereExpression;
|
||||
options.Overwrite = true;
|
||||
EXPECT_NO_THROW(appendBlobClient.Create(options));
|
||||
appendBlobClient.SetTags(tags);
|
||||
}
|
||||
@ -959,7 +958,6 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
options.AccessConditions.TagConditions = failWhereExpression;
|
||||
EXPECT_THROW(pageBlobClient.Create(contentSize, options), StorageError);
|
||||
options.AccessConditions.TagConditions = successWhereExpression;
|
||||
options.Overwrite = true;
|
||||
EXPECT_NO_THROW(pageBlobClient.Create(contentSize, options));
|
||||
|
||||
pageBlobClient.SetTags(tags);
|
||||
@ -1021,7 +1019,6 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
content.Rewind();
|
||||
EXPECT_THROW(blockBlobClient.Upload(&content, options), StorageError);
|
||||
options.AccessConditions.TagConditions = successWhereExpression;
|
||||
options.Overwrite = true;
|
||||
content.Rewind();
|
||||
EXPECT_NO_THROW(blockBlobClient.Upload(&content, options));
|
||||
blockBlobClient.SetTags(tags);
|
||||
|
||||
@ -759,20 +759,4 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_TRUE(exceptionCaught);
|
||||
}
|
||||
|
||||
TEST_F(BlockBlobClientTest, Overwrite)
|
||||
{
|
||||
std::string blobName = RandomString();
|
||||
std::vector<uint8_t> blobContent(1);
|
||||
auto blobContentStream
|
||||
= Azure::Core::Http::MemoryBodyStream(m_blobContent.data(), m_blobContent.size());
|
||||
auto blobClient = m_blobContainerClient->GetBlockBlobClient(blobName);
|
||||
EXPECT_NO_THROW(blobClient.Upload(&blobContentStream));
|
||||
blobContentStream.Rewind();
|
||||
EXPECT_THROW(blobClient.Upload(&blobContentStream), StorageError);
|
||||
blobContentStream.Rewind();
|
||||
Blobs::UploadBlockBlobOptions options;
|
||||
options.Overwrite = true;
|
||||
EXPECT_NO_THROW(blobClient.Upload(&blobContentStream, options));
|
||||
}
|
||||
|
||||
}}} // namespace Azure::Storage::Test
|
||||
|
||||
@ -251,15 +251,4 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_THROW(pageBlobClient.UploadPages(0, &pageContent, options), StorageError);
|
||||
}
|
||||
|
||||
TEST_F(PageBlobClientTest, Overwrite)
|
||||
{
|
||||
std::string blobName = RandomString();
|
||||
auto blobClient = m_blobContainerClient->GetPageBlobClient(blobName);
|
||||
EXPECT_NO_THROW(blobClient.Create(1024));
|
||||
EXPECT_THROW(blobClient.Create(1024), StorageError);
|
||||
Blobs::CreatePageBlobOptions options;
|
||||
options.Overwrite = true;
|
||||
EXPECT_NO_THROW(blobClient.Create(1024, options));
|
||||
}
|
||||
|
||||
}}} // namespace Azure::Storage::Test
|
||||
|
||||
Loading…
Reference in New Issue
Block a user