Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove version id inTaggedBlobItem and add unit test for cold tier (A…
Browse files Browse the repository at this point in the history
microzchang committed Dec 8, 2022
1 parent ddaf624 commit 157bff4
Showing 6 changed files with 18 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -618,14 +618,6 @@ namespace Azure { namespace Storage { namespace Blobs {
* User-defined tags for this blob.
*/
std::map<std::string, std::string> Tags;
/**
* A string value that uniquely identifies a blob version.
*/
Nullable<std::string> VersionId;
/**
* Indicates if this is the current version of the blob.
*/
Nullable<bool> IsCurrentVersion;
};
/**
* @brief Response type for #Azure::Storage::Blobs::BlobContainerClient::Create.
7 changes: 0 additions & 7 deletions sdk/storage/azure-storage-blobs/src/blob_container_client.cpp
Original file line number Diff line number Diff line change
@@ -481,13 +481,6 @@ namespace Azure { namespace Storage { namespace Blobs {
protocolLayerOptions,
_internal::WithReplicaStatus(context));

for (auto& item : response.Value.Items)
{
if (item.VersionId.HasValue() && !item.IsCurrentVersion.HasValue())
{
item.IsCurrentVersion = false;
}
}
FindBlobsByTagsPagedResponse pagedResponse;
pagedResponse.ServiceEndpoint = std::move(response.Value.ServiceEndpoint);
pagedResponse.TaggedBlobs = std::move(response.Value.Items);
7 changes: 0 additions & 7 deletions sdk/storage/azure-storage-blobs/src/blob_service_client.cpp
Original file line number Diff line number Diff line change
@@ -239,13 +239,6 @@ namespace Azure { namespace Storage { namespace Blobs {
auto response = _detail::ServiceClient::FindBlobsByTags(
*m_pipeline, m_serviceUrl, protocolLayerOptions, _internal::WithReplicaStatus(context));

for (auto& item : response.Value.Items)
{
if (item.VersionId.HasValue() && !item.IsCurrentVersion.HasValue())
{
item.IsCurrentVersion = false;
}
}
FindBlobsByTagsPagedResponse pagedResponse;
pagedResponse.ServiceEndpoint = std::move(response.Value.ServiceEndpoint);
pagedResponse.TaggedBlobs = std::move(response.Value.Items);
36 changes: 0 additions & 36 deletions sdk/storage/azure-storage-blobs/src/rest_client.cpp
Original file line number Diff line number Diff line change
@@ -1284,8 +1284,6 @@ namespace Azure { namespace Storage { namespace Blobs {
kTag,
kKey,
kValue,
kVersionId,
kIsCurrentVersion,
kNextMarker,
};
const std::unordered_map<std::string, XmlTagEnum> XmlTagEnumMap{
@@ -1299,8 +1297,6 @@ namespace Azure { namespace Storage { namespace Blobs {
{"Tag", XmlTagEnum::kTag},
{"Key", XmlTagEnum::kKey},
{"Value", XmlTagEnum::kValue},
{"VersionId", XmlTagEnum::kVersionId},
{"IsCurrentVersion", XmlTagEnum::kIsCurrentVersion},
{"NextMarker", XmlTagEnum::kNextMarker},
};
std::vector<XmlTagEnum> xmlPath;
@@ -1350,20 +1346,6 @@ namespace Azure { namespace Storage { namespace Blobs {
{
mapValue3 = node.Value;
}
else if (
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults
&& xmlPath[1] == XmlTagEnum::kBlobs && xmlPath[2] == XmlTagEnum::kBlob
&& xmlPath[3] == XmlTagEnum::kVersionId)
{
vectorElement1.VersionId = node.Value;
}
else if (
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults
&& xmlPath[1] == XmlTagEnum::kBlobs && xmlPath[2] == XmlTagEnum::kBlob
&& xmlPath[3] == XmlTagEnum::kIsCurrentVersion)
{
vectorElement1.IsCurrentVersion = node.Value == std::string("true");
}
else if (
xmlPath.size() == 2 && xmlPath[0] == XmlTagEnum::kEnumerationResults
&& xmlPath[1] == XmlTagEnum::kNextMarker)
@@ -1912,8 +1894,6 @@ namespace Azure { namespace Storage { namespace Blobs {
kTag,
kKey,
kValue,
kVersionId,
kIsCurrentVersion,
kNextMarker,
};
const std::unordered_map<std::string, XmlTagEnum> XmlTagEnumMap{
@@ -1927,8 +1907,6 @@ namespace Azure { namespace Storage { namespace Blobs {
{"Tag", XmlTagEnum::kTag},
{"Key", XmlTagEnum::kKey},
{"Value", XmlTagEnum::kValue},
{"VersionId", XmlTagEnum::kVersionId},
{"IsCurrentVersion", XmlTagEnum::kIsCurrentVersion},
{"NextMarker", XmlTagEnum::kNextMarker},
};
std::vector<XmlTagEnum> xmlPath;
@@ -1978,20 +1956,6 @@ namespace Azure { namespace Storage { namespace Blobs {
{
mapValue3 = node.Value;
}
else if (
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults
&& xmlPath[1] == XmlTagEnum::kBlobs && xmlPath[2] == XmlTagEnum::kBlob
&& xmlPath[3] == XmlTagEnum::kVersionId)
{
vectorElement1.VersionId = node.Value;
}
else if (
xmlPath.size() == 4 && xmlPath[0] == XmlTagEnum::kEnumerationResults
&& xmlPath[1] == XmlTagEnum::kBlobs && xmlPath[2] == XmlTagEnum::kBlob
&& xmlPath[3] == XmlTagEnum::kIsCurrentVersion)
{
vectorElement1.IsCurrentVersion = node.Value == std::string("true");
}
else if (
xmlPath.size() == 2 && xmlPath[0] == XmlTagEnum::kEnumerationResults
&& xmlPath[1] == XmlTagEnum::kNextMarker)
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-blobs/swagger/README.md
Original file line number Diff line number Diff line change
@@ -724,11 +724,11 @@ directive:
$.FilterBlobItem.properties["Name"]["x-ms-client-name"] = "BlobName";
$.FilterBlobItem.properties["ContainerName"]["x-ms-client-name"] = "BlobContainerName";
delete $.FilterBlobItem.properties["TagValue"];
delete $.FilterBlobItem.properties["VersionId"];
delete $.FilterBlobItem.properties["IsCurrentVersion"];
$.FilterBlobItem.properties["Name"].description = "Blob name.";
$.FilterBlobItem.properties["ContainerName"].description = "Blob container name.";
$.FilterBlobItem.properties["Tags"]["x-ms-xml"] = {"name": "Tags/TagSet"};
$.FilterBlobItem.properties["VersionId"].description = "A string value that uniquely identifies a blob version.";
$.FilterBlobItem.properties["IsCurrentVersion"].description = "Indicates if this is the current version of the blob.";
$.FilterBlobSegment["x-ms-client-name"] = "FindBlobsByTagsResult";
$.FilterBlobSegment.properties["NextMarker"]["x-ms-client-name"] = "ContinuationToken";
$.FilterBlobSegment.properties["Blobs"]["x-ms-client-name"] = "Items";
16 changes: 16 additions & 0 deletions sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp
Original file line number Diff line number Diff line change
@@ -1509,6 +1509,22 @@ namespace Azure { namespace Storage { namespace Test {
blobItem.Details.RehydratePriority.Value(), Blobs::Models::RehydratePriority::Standard);
}

TEST_F(BlockBlobClientTest, DISABLED_SetTierCold)
{

auto const testName(GetTestName());
auto blobClient = GetBlockBlobClient(testName);

std::vector<uint8_t> emptyContent;
std::string blobName(testName);
blobClient.UploadFrom(emptyContent.data(), emptyContent.size());

// set to cold
blobClient.SetAccessTier(Blobs::Models::AccessTier::Cold);
auto properties = blobClient.GetProperties().Value;
EXPECT_EQ(properties.AccessTier.Value(), Blobs::Models::AccessTier::Cold);
}

TEST_F(BlockBlobClientTest, SetTierWithLeaseId)
{
auto const testName(GetTestName());

0 comments on commit 157bff4

Please sign in to comment.