From 624d81ed0f506e902893f2296bf52648cb7109e1 Mon Sep 17 00:00:00 2001 From: JinmingHu Date: Fri, 26 Feb 2021 15:30:43 +0800 Subject: [PATCH] Rename string conversion functions to `ToString()` (#1748) * Get() -> ToString() * changelog --- sdk/storage/azure-storage-blobs/CHANGELOG.md | 1 + .../blobs/protocol/blob_rest_client.hpp | 102 +++++++++--------- .../test/ut/blob_container_client_test.cpp | 4 +- .../test/ut/blob_service_client_test.cpp | 6 +- .../test/ut/page_blob_client_test.cpp | 2 +- .../azure-storage-files-datalake/CHANGELOG.md | 1 + .../protocol/datalake_rest_client.hpp | 31 +++--- .../src/datalake_file_client.cpp | 6 +- .../src/datalake_file_system_client.cpp | 6 +- .../src/datalake_path_client.cpp | 2 +- .../src/datalake_service_client.cpp | 10 +- .../azure-storage-files-shares/CHANGELOG.md | 1 + .../shares/protocol/share_rest_client.hpp | 35 +++--- .../files/shares/share_file_attributes.hpp | 2 +- .../src/share_directory_client.cpp | 6 +- .../src/share_file_attributes.cpp | 2 +- .../src/share_file_client.cpp | 18 ++-- .../test/share_file_attributes_test.cpp | 8 +- .../test/share_file_client_test.cpp | 2 +- 19 files changed, 129 insertions(+), 116 deletions(-) diff --git a/sdk/storage/azure-storage-blobs/CHANGELOG.md b/sdk/storage/azure-storage-blobs/CHANGELOG.md index d8e712aa2..af9aaeb6a 100644 --- a/sdk/storage/azure-storage-blobs/CHANGELOG.md +++ b/sdk/storage/azure-storage-blobs/CHANGELOG.md @@ -9,6 +9,7 @@ ### Breaking Changes - Changed the return type of `StartCopyFromUri` and `StartCopyIncremental` API from a `Response` to the particular `Operation` type called `StartCopyBlobOperation` directly. +- String conversion functions of extensible enums were renamed from `Get()` to `ToString()`. ## 12.0.0-beta.8 (2021-02-12) 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 39a025cb5..865c2804d 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 @@ -46,7 +46,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit AccessTier(std::string value) : m_value(std::move(value)) {} bool operator==(const AccessTier& other) const { return m_value == other.m_value; } bool operator!=(const AccessTier& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static AccessTier P1; AZ_STORAGE_BLOBS_DLLEXPORT const static AccessTier P2; AZ_STORAGE_BLOBS_DLLEXPORT const static AccessTier P3; @@ -75,7 +75,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit AccountKind(std::string value) : m_value(std::move(value)) {} bool operator==(const AccountKind& other) const { return m_value == other.m_value; } bool operator!=(const AccountKind& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static AccountKind Storage; AZ_STORAGE_BLOBS_DLLEXPORT const static AccountKind BlobStorage; AZ_STORAGE_BLOBS_DLLEXPORT const static AccountKind StorageV2; @@ -112,7 +112,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobArchiveStatus(std::string value) : m_value(std::move(value)) {} bool operator==(const BlobArchiveStatus& other) const { return m_value == other.m_value; } bool operator!=(const BlobArchiveStatus& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlobArchiveStatus RehydratePendingToHot; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobArchiveStatus RehydratePendingToCool; @@ -144,7 +144,7 @@ namespace Azure { namespace Storage { namespace Blobs { return m_value == other.m_value; } bool operator!=(const BlobGeoReplicationStatus& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlobGeoReplicationStatus Live; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobGeoReplicationStatus Bootstrap; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobGeoReplicationStatus Unavailable; @@ -159,7 +159,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobLeaseDurationType(std::string value) : m_value(std::move(value)) {} bool operator==(const BlobLeaseDurationType& other) const { return m_value == other.m_value; } bool operator!=(const BlobLeaseDurationType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlobLeaseDurationType Infinite; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobLeaseDurationType Fixed; @@ -173,7 +173,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobLeaseState(std::string value) : m_value(std::move(value)) {} bool operator==(const BlobLeaseState& other) const { return m_value == other.m_value; } bool operator!=(const BlobLeaseState& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlobLeaseState Available; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobLeaseState Leased; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobLeaseState Expired; @@ -190,7 +190,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobLeaseStatus(std::string value) : m_value(std::move(value)) {} bool operator==(const BlobLeaseStatus& other) const { return m_value == other.m_value; } bool operator!=(const BlobLeaseStatus& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlobLeaseStatus Locked; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobLeaseStatus Unlocked; @@ -226,7 +226,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlobType(std::string value) : m_value(std::move(value)) {} bool operator==(const BlobType& other) const { return m_value == other.m_value; } bool operator!=(const BlobType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlobType BlockBlob; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobType PageBlob; AZ_STORAGE_BLOBS_DLLEXPORT const static BlobType AppendBlob; @@ -241,7 +241,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlockListTypeOption(std::string value) : m_value(std::move(value)) {} bool operator==(const BlockListTypeOption& other) const { return m_value == other.m_value; } bool operator!=(const BlockListTypeOption& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlockListTypeOption Committed; AZ_STORAGE_BLOBS_DLLEXPORT const static BlockListTypeOption Uncommitted; AZ_STORAGE_BLOBS_DLLEXPORT const static BlockListTypeOption All; @@ -256,7 +256,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit BlockType(std::string value) : m_value(std::move(value)) {} bool operator==(const BlockType& other) const { return m_value == other.m_value; } bool operator!=(const BlockType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static BlockType Committed; AZ_STORAGE_BLOBS_DLLEXPORT const static BlockType Uncommitted; AZ_STORAGE_BLOBS_DLLEXPORT const static BlockType Latest; @@ -319,7 +319,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit CopyStatus(std::string value) : m_value(std::move(value)) {} bool operator==(const CopyStatus& other) const { return m_value == other.m_value; } bool operator!=(const CopyStatus& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static CopyStatus Success; AZ_STORAGE_BLOBS_DLLEXPORT const static CopyStatus Pending; @@ -390,7 +390,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit DeleteSnapshotsOption(std::string value) : m_value(std::move(value)) {} bool operator==(const DeleteSnapshotsOption& other) const { return m_value == other.m_value; } bool operator!=(const DeleteSnapshotsOption& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static DeleteSnapshotsOption IncludeSnapshots; AZ_STORAGE_BLOBS_DLLEXPORT const static DeleteSnapshotsOption OnlySnapshots; @@ -407,7 +407,7 @@ namespace Azure { namespace Storage { namespace Blobs { return m_value == other.m_value; } bool operator!=(const EncryptionAlgorithmType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static EncryptionAlgorithmType Aes256; private: @@ -521,7 +521,7 @@ namespace Azure { namespace Storage { namespace Blobs { return m_value == other.m_value; } bool operator!=(const ObjectReplicationStatus& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static ObjectReplicationStatus Complete; AZ_STORAGE_BLOBS_DLLEXPORT const static ObjectReplicationStatus Failed; @@ -535,7 +535,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit PublicAccessType(std::string value) : m_value(std::move(value)) {} bool operator==(const PublicAccessType& other) const { return m_value == other.m_value; } bool operator!=(const PublicAccessType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static PublicAccessType BlobContainer; AZ_STORAGE_BLOBS_DLLEXPORT const static PublicAccessType Blob; AZ_STORAGE_BLOBS_DLLEXPORT const static PublicAccessType None; @@ -550,7 +550,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit RehydratePriority(std::string value) : m_value(std::move(value)) {} bool operator==(const RehydratePriority& other) const { return m_value == other.m_value; } bool operator!=(const RehydratePriority& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static RehydratePriority High; AZ_STORAGE_BLOBS_DLLEXPORT const static RehydratePriority Standard; @@ -614,7 +614,7 @@ namespace Azure { namespace Storage { namespace Blobs { return m_value == other.m_value; } bool operator!=(const ScheduleBlobExpiryOriginType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static ScheduleBlobExpiryOriginType NeverExpire; AZ_STORAGE_BLOBS_DLLEXPORT const static ScheduleBlobExpiryOriginType RelativeToCreation; AZ_STORAGE_BLOBS_DLLEXPORT const static ScheduleBlobExpiryOriginType RelativeToNow; @@ -688,7 +688,7 @@ namespace Azure { namespace Storage { namespace Blobs { explicit SkuName(std::string value) : m_value(std::move(value)) {} bool operator==(const SkuName& other) const { return m_value == other.m_value; } bool operator!=(const SkuName& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_BLOBS_DLLEXPORT const static SkuName StandardLrs; AZ_STORAGE_BLOBS_DLLEXPORT const static SkuName StandardGrs; AZ_STORAGE_BLOBS_DLLEXPORT const static SkuName StandardRagrs; @@ -3112,9 +3112,9 @@ namespace Azure { namespace Storage { namespace Blobs { { request.AddHeader("x-ms-meta-" + pair.first, pair.second); } - if (!options.AccessType.Get().empty()) + if (!options.AccessType.ToString().empty()) { - request.AddHeader("x-ms-blob-public-access", options.AccessType.Get()); + request.AddHeader("x-ms-blob-public-access", options.AccessType.ToString()); } if (options.DefaultEncryptionScope.HasValue()) { @@ -3607,9 +3607,9 @@ namespace Azure { namespace Storage { namespace Blobs { } request.GetUrl().AppendQueryParameter("restype", "container"); request.GetUrl().AppendQueryParameter("comp", "acl"); - if (!options.AccessType.Get().empty()) + if (!options.AccessType.ToString().empty()) { - request.AddHeader("x-ms-blob-public-access", options.AccessType.Get()); + request.AddHeader("x-ms-blob-public-access", options.AccessType.ToString()); } if (options.LeaseId.HasValue()) { @@ -4884,7 +4884,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.IfModifiedSince.HasValue()) { @@ -5220,7 +5220,8 @@ namespace Azure { namespace Storage { namespace Blobs { } if (options.DeleteSnapshots.HasValue()) { - request.AddHeader("x-ms-delete-snapshots", options.DeleteSnapshots.GetValue().Get()); + request.AddHeader( + "x-ms-delete-snapshots", options.DeleteSnapshots.GetValue().ToString()); } if (options.LeaseId.HasValue()) { @@ -5308,7 +5309,7 @@ namespace Azure { namespace Storage { namespace Blobs { "timeout", std::to_string(options.Timeout.GetValue())); } request.GetUrl().AppendQueryParameter("comp", "expiry"); - request.AddHeader("x-ms-expiry-option", options.ExpiryOrigin.Get()); + request.AddHeader("x-ms-expiry-option", options.ExpiryOrigin.ToString()); if (options.ExpiryTime.HasValue()) { request.AddHeader("x-ms-expiry-time", options.ExpiryTime.GetValue()); @@ -5405,7 +5406,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.LeaseId.HasValue()) { @@ -5857,7 +5858,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -5934,11 +5935,11 @@ namespace Azure { namespace Storage { namespace Blobs { request.GetUrl().AppendQueryParameter( "timeout", std::to_string(options.Timeout.GetValue())); } - request.AddHeader("x-ms-access-tier", options.Tier.Get()); + request.AddHeader("x-ms-access-tier", options.Tier.ToString()); if (options.RehydratePriority.HasValue()) { request.AddHeader( - "x-ms-rehydrate-priority", options.RehydratePriority.GetValue().Get()); + "x-ms-rehydrate-priority", options.RehydratePriority.GetValue().ToString()); } if (options.IfTags.HasValue()) { @@ -6029,12 +6030,12 @@ namespace Azure { namespace Storage { namespace Blobs { } if (options.Tier.HasValue()) { - request.AddHeader("x-ms-access-tier", options.Tier.GetValue().Get()); + request.AddHeader("x-ms-access-tier", options.Tier.GetValue().ToString()); } if (options.RehydratePriority.HasValue()) { request.AddHeader( - "x-ms-rehydrate-priority", options.RehydratePriority.GetValue().Get()); + "x-ms-rehydrate-priority", options.RehydratePriority.GetValue().ToString()); } if (options.ShouldSealDestination.HasValue()) { @@ -6209,7 +6210,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -6964,7 +6965,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -7023,7 +7024,7 @@ namespace Azure { namespace Storage { namespace Blobs { request.AddHeader("x-ms-blob-type", "BlockBlob"); if (options.Tier.HasValue()) { - request.AddHeader("x-ms-access-tier", options.Tier.GetValue().Get()); + request.AddHeader("x-ms-access-tier", options.Tier.GetValue().ToString()); } if (options.IfModifiedSince.HasValue()) { @@ -7173,7 +7174,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -7309,7 +7310,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -7479,7 +7480,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -7487,7 +7488,7 @@ namespace Azure { namespace Storage { namespace Blobs { } if (options.Tier.HasValue()) { - request.AddHeader("x-ms-access-tier", options.Tier.GetValue().Get()); + request.AddHeader("x-ms-access-tier", options.Tier.GetValue().ToString()); } if (options.IfModifiedSince.HasValue()) { @@ -7572,7 +7573,8 @@ namespace Azure { namespace Storage { namespace Blobs { auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url); request.GetUrl().AppendQueryParameter("comp", "blocklist"); request.GetUrl().AppendQueryParameter( - "blocklisttype", Storage::Details::UrlEncodeQueryParameter(options.ListType.Get())); + "blocklisttype", + Storage::Details::UrlEncodeQueryParameter(options.ListType.ToString())); request.AddHeader("x-ms-version", "2020-02-10"); if (options.Timeout.HasValue()) { @@ -7755,7 +7757,9 @@ namespace Azure { namespace Storage { namespace Blobs { for (const auto& i : options.BlockList) { writer.Write(Storage::Details::XmlNode{ - Storage::Details::XmlNodeType::StartTag, i.first.Get().data(), i.second.data()}); + Storage::Details::XmlNodeType::StartTag, + i.first.ToString().data(), + i.second.data()}); } writer.Write(Storage::Details::XmlNode{Storage::Details::XmlNodeType::EndTag}); } @@ -7843,7 +7847,7 @@ namespace Azure { namespace Storage { namespace Blobs { } if (options.Tier.HasValue()) { - request.AddHeader("x-ms-access-tier", options.Tier.GetValue().Get()); + request.AddHeader("x-ms-access-tier", options.Tier.GetValue().ToString()); } if (options.EncryptionKey.HasValue()) { @@ -7858,7 +7862,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -8027,7 +8031,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -8222,7 +8226,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -8389,7 +8393,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -8513,7 +8517,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -9018,7 +9022,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -9167,7 +9171,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { @@ -9347,7 +9351,7 @@ namespace Azure { namespace Storage { namespace Blobs { if (options.EncryptionAlgorithm.HasValue()) { request.AddHeader( - "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().Get()); + "x-ms-encryption-algorithm", options.EncryptionAlgorithm.GetValue().ToString()); } if (options.EncryptionScope.HasValue()) { 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 2f6058c16..323e3e0dc 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 @@ -187,7 +187,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_TRUE(IsValidTime(blob.Details.CreatedOn)); EXPECT_TRUE(IsValidTime(blob.Details.LastModified)); EXPECT_TRUE(blob.Details.ETag.HasValue()); - EXPECT_FALSE(blob.BlobType.Get().empty()); + EXPECT_FALSE(blob.BlobType.ToString().empty()); if (blob.BlobType == Blobs::Models::BlobType::BlockBlob) { EXPECT_TRUE(blob.Details.Tier.HasValue()); @@ -195,7 +195,7 @@ namespace Azure { namespace Storage { namespace Test { } if (blob.Details.Tier.HasValue()) { - EXPECT_FALSE(blob.Details.Tier.GetValue().Get().empty()); + EXPECT_FALSE(blob.Details.Tier.GetValue().ToString().empty()); } if (blob.BlobType == Blobs::Models::BlobType::AppendBlob) { diff --git a/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp index d2e29cd3c..4b78db966 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/blob_service_client_test.cpp @@ -323,8 +323,8 @@ namespace Azure { namespace Storage { namespace Test { { auto accountInfo = *m_blobServiceClient.GetAccountInfo(); EXPECT_FALSE(accountInfo.RequestId.empty()); - EXPECT_FALSE(accountInfo.SkuName.Get().empty()); - EXPECT_FALSE(accountInfo.AccountKind.Get().empty()); + EXPECT_FALSE(accountInfo.SkuName.ToString().empty()); + EXPECT_FALSE(accountInfo.AccountKind.ToString().empty()); EXPECT_FALSE(accountInfo.IsHierarchicalNamespaceEnabled); auto dataLakeServiceClient @@ -343,7 +343,7 @@ namespace Azure { namespace Storage { namespace Test { = Blobs::BlobServiceClient(InferSecondaryUrl(m_blobServiceClient.GetUrl()), keyCredential); auto serviceStatistics = *secondaryServiceClient.GetStatistics(); EXPECT_FALSE(serviceStatistics.RequestId.empty()); - EXPECT_FALSE(serviceStatistics.GeoReplication.Status.Get().empty()); + EXPECT_FALSE(serviceStatistics.GeoReplication.Status.ToString().empty()); if (serviceStatistics.GeoReplication.LastSyncedOn.HasValue()) { EXPECT_TRUE(IsValidTime(serviceStatistics.GeoReplication.LastSyncedOn.GetValue())); diff --git a/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp index d7afa092a..52cf84215 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp @@ -155,7 +155,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_TRUE(copyInfo.ETag.HasValue()); EXPECT_TRUE(IsValidTime(copyInfo.LastModified)); EXPECT_FALSE(copyInfo.CopyId.empty()); - EXPECT_FALSE(copyInfo.CopyStatus.Get().empty()); + EXPECT_FALSE(copyInfo.CopyStatus.ToString().empty()); EXPECT_TRUE(copyInfo.VersionId.HasValue()); EXPECT_FALSE(copyInfo.VersionId.GetValue().empty()); auto getPropertiesResult = copyInfo.PollUntilDone(std::chrono::seconds(1)); diff --git a/sdk/storage/azure-storage-files-datalake/CHANGELOG.md b/sdk/storage/azure-storage-files-datalake/CHANGELOG.md index b92d3ec01..9f6c2e3b9 100644 --- a/sdk/storage/azure-storage-files-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-files-datalake/CHANGELOG.md @@ -9,6 +9,7 @@ ### Breaking Changes - DataLake client constructors won't automatically convert blob url to dfs url anymore. +- String conversion functions of extensible enums were renamed from `Get()` to `ToString()`. ## 12.0.0-beta.8 (2021-02-12) diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/protocol/datalake_rest_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/protocol/datalake_rest_client.hpp index 3ac8d865c..ba57004f9 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/protocol/datalake_rest_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/protocol/datalake_rest_client.hpp @@ -48,7 +48,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { return m_value == other.m_value; } bool operator!=(const FileSystemResourceType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static FileSystemResourceType Filesystem; @@ -72,7 +72,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathSetAccessControlRecursiveMode Set; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathSetAccessControlRecursiveMode Modify; @@ -89,7 +89,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit PathExpiryOptions(std::string value) : m_value(std::move(value)) {} bool operator==(const PathExpiryOptions& other) const { return m_value == other.m_value; } bool operator!=(const PathExpiryOptions& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathExpiryOptions NeverExpire; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathExpiryOptions RelativeToCreation; @@ -125,7 +125,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit PublicAccessType(std::string value) : m_value(std::move(value)) {} bool operator==(const PublicAccessType& other) const { return m_value == other.m_value; } bool operator!=(const PublicAccessType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PublicAccessType FileSystem; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PublicAccessType Path; @@ -142,7 +142,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit PathResourceType(std::string value) : m_value(std::move(value)) {} bool operator==(const PathResourceType& other) const { return m_value == other.m_value; } bool operator!=(const PathResourceType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathResourceType Directory; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathResourceType File; @@ -160,7 +160,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit PathRenameMode(std::string value) : m_value(std::move(value)) {} bool operator==(const PathRenameMode& other) const { return m_value == other.m_value; } bool operator!=(const PathRenameMode& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathRenameMode Legacy; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathRenameMode Posix; @@ -182,7 +182,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { return m_value == other.m_value; } bool operator!=(const PathGetPropertiesAction& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathGetPropertiesAction GetAccessControl; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static PathGetPropertiesAction GetStatus; @@ -198,7 +198,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit LeaseDurationType(std::string value) : m_value(std::move(value)) {} bool operator==(const LeaseDurationType& other) const { return m_value == other.m_value; } bool operator!=(const LeaseDurationType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseDurationType Infinite; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseDurationType Fixed; @@ -214,7 +214,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit LeaseStateType(std::string value) : m_value(std::move(value)) {} bool operator==(const LeaseStateType& other) const { return m_value == other.m_value; } bool operator!=(const LeaseStateType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseStateType Available; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseStateType Leased; @@ -233,7 +233,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { explicit LeaseStatusType(std::string value) : m_value(std::move(value)) {} bool operator==(const LeaseStatusType& other) const { return m_value == other.m_value; } bool operator!=(const LeaseStatusType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseStatusType Locked; AZ_STORAGE_FILES_DATALAKE_DLLEXPORT const static LeaseStatusType Unlocked; @@ -418,7 +418,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { Azure::Core::Http::Request request(Azure::Core::Http::HttpMethod::Get, url); request.GetUrl().AppendQueryParameter( Details::QueryFileSystemResource, - Storage::Details::UrlEncodeQueryParameter((listPathsOptions.Resource.Get()))); + Storage::Details::UrlEncodeQueryParameter((listPathsOptions.Resource.ToString()))); if (listPathsOptions.Timeout.HasValue()) { request.GetUrl().AppendQueryParameter( @@ -582,7 +582,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { request.GetUrl().AppendQueryParameter( Details::QueryPathResourceType, Storage::Details::UrlEncodeQueryParameter( - (createOptions.Resource.GetValue().Get()))); + (createOptions.Resource.GetValue().ToString()))); } if (createOptions.ContinuationToken.HasValue()) { @@ -595,7 +595,8 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { { request.GetUrl().AppendQueryParameter( Details::QueryPathRenameMode, - Storage::Details::UrlEncodeQueryParameter((createOptions.Mode.GetValue().Get()))); + Storage::Details::UrlEncodeQueryParameter( + (createOptions.Mode.GetValue().ToString()))); } if (createOptions.CacheControl.HasValue()) { @@ -725,7 +726,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { request.GetUrl().AppendQueryParameter( Details::QueryPathGetPropertiesAction, Storage::Details::UrlEncodeQueryParameter( - (getPropertiesOptions.Action.GetValue().Get()))); + (getPropertiesOptions.Action.GetValue().ToString()))); } if (getPropertiesOptions.Upn.HasValue()) { @@ -951,7 +952,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { request.GetUrl().AppendQueryParameter( Details::QueryPathSetAccessControlRecursiveMode, Storage::Details::UrlEncodeQueryParameter( - (setAccessControlRecursiveOptions.Mode.Get()))); + (setAccessControlRecursiveOptions.Mode.ToString()))); if (setAccessControlRecursiveOptions.ForceFlag.HasValue()) { request.GetUrl().AppendQueryParameter( diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp index feb33042c..26c57a2ba 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_file_client.cpp @@ -231,7 +231,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { if (result->Details.LeaseDuration.HasValue()) { ret.Details.LeaseDuration - = Models::LeaseDurationType(result->Details.LeaseDuration.GetValue().Get()); + = Models::LeaseDurationType(result->Details.LeaseDuration.GetValue().ToString()); } ret.Details.LeaseState = result->Details.LeaseState.HasValue() ? FromBlobLeaseState(result->Details.LeaseState.GetValue()) @@ -306,7 +306,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { if (result->Details.LeaseDuration.HasValue()) { ret.Details.LeaseDuration - = Models::LeaseDurationType(result->Details.LeaseDuration.GetValue().Get()); + = Models::LeaseDurationType(result->Details.LeaseDuration.GetValue().ToString()); } ret.Details.LeaseState = result->Details.LeaseState.HasValue() ? FromBlobLeaseState(result->Details.LeaseState.GetValue()) @@ -348,7 +348,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { if (result->Details.LeaseDuration.HasValue()) { ret.Details.LeaseDuration - = Models::LeaseDurationType(result->Details.LeaseDuration.GetValue().Get()); + = Models::LeaseDurationType(result->Details.LeaseDuration.GetValue().ToString()); } ret.Details.LeaseState = result->Details.LeaseState.HasValue() ? FromBlobLeaseState(result->Details.LeaseState.GetValue()) diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp index 19dd4592a..53e23edde 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_file_system_client.cpp @@ -140,7 +140,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { } else { - blobOptions.AccessType = Blobs::Models::PublicAccessType(options.AccessType.Get()); + blobOptions.AccessType = Blobs::Models::PublicAccessType(options.AccessType.ToString()); } auto result = m_blobContainerClient.Create(blobOptions, context); Models::CreateDataLakeFileSystemResult ret; @@ -289,7 +289,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { } else { - ret.AccessType = Models::PublicAccessType(result->AccessType.Get()); + ret.AccessType = Models::PublicAccessType(result->AccessType.ToString()); } ret.ETag = std::move(result->ETag); ret.LastModified = std::move(result->LastModified); @@ -323,7 +323,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { } else { - blobOptions.AccessType = Blobs::Models::PublicAccessType(options.AccessType.Get()); + blobOptions.AccessType = Blobs::Models::PublicAccessType(options.AccessType.ToString()); } auto result = m_blobContainerClient.SetAccessPolicy(blobOptions, context); Models::SetDataLakeFileSystemAccessPolicyResult ret; diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp index 671aff0e1..b67db43e9 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_path_client.cpp @@ -320,7 +320,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { ret.Metadata = std::move(result->Metadata); if (result->LeaseDuration.HasValue()) { - ret.LeaseDuration = Models::LeaseDurationType(result->LeaseDuration.GetValue().Get()); + ret.LeaseDuration = Models::LeaseDurationType(result->LeaseDuration.GetValue().ToString()); } ret.LeaseState = result->LeaseState.HasValue() ? FromBlobLeaseState(result->LeaseState.GetValue()) diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp index f12fa008e..66b979687 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_service_client.cpp @@ -42,17 +42,19 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { } else { - fileSystem.Details.AccessType = Models::PublicAccessType(item.Details.AccessType.Get()); + fileSystem.Details.AccessType + = Models::PublicAccessType(item.Details.AccessType.ToString()); } fileSystem.Details.HasImmutabilityPolicy = item.Details.HasImmutabilityPolicy; fileSystem.Details.HasLegalHold = item.Details.HasLegalHold; if (item.Details.LeaseDuration.HasValue()) { fileSystem.Details.LeaseDuration - = Models::LeaseDurationType((item.Details.LeaseDuration.GetValue().Get())); + = Models::LeaseDurationType((item.Details.LeaseDuration.GetValue().ToString())); } - fileSystem.Details.LeaseState = Models::LeaseStateType(item.Details.LeaseState.Get()); - fileSystem.Details.LeaseStatus = Models::LeaseStatusType(item.Details.LeaseStatus.Get()); + fileSystem.Details.LeaseState = Models::LeaseStateType(item.Details.LeaseState.ToString()); + fileSystem.Details.LeaseStatus + = Models::LeaseStatusType(item.Details.LeaseStatus.ToString()); fileSystems.emplace_back(std::move(fileSystem)); } diff --git a/sdk/storage/azure-storage-files-shares/CHANGELOG.md b/sdk/storage/azure-storage-files-shares/CHANGELOG.md index 701f8bd0c..c0770ae5e 100644 --- a/sdk/storage/azure-storage-files-shares/CHANGELOG.md +++ b/sdk/storage/azure-storage-files-shares/CHANGELOG.md @@ -9,6 +9,7 @@ ### Breaking Changes - Changed the return type of `StartCopy` API from a `Response` to the particular `Operation` type called `StartCopyShareFileOperation` directly. +- String conversion functions of extensible enums were renamed from `Get()` to `ToString()`. ## 12.0.0-beta.8 (2021-02-12) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp index f3be731a7..3ae2b853b 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp @@ -86,7 +86,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit ShareAccessTier(std::string value) : m_value(std::move(value)) {} bool operator==(const ShareAccessTier& other) const { return m_value == other.m_value; } bool operator!=(const ShareAccessTier& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static ShareAccessTier TransactionOptimized; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static ShareAccessTier Hot; @@ -109,7 +109,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { return m_value == other.m_value; } bool operator!=(const PermissionCopyModeType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static PermissionCopyModeType Source; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static PermissionCopyModeType Override; @@ -128,7 +128,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { return m_value == other.m_value; } bool operator!=(const DeleteSnapshotsOptionType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static DeleteSnapshotsOptionType Include; @@ -147,7 +147,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { return m_value == other.m_value; } bool operator!=(const FileRangeWriteFromUrlType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FileRangeWriteFromUrlType Update; @@ -229,7 +229,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit LeaseDurationType(std::string value) : m_value(std::move(value)) {} bool operator==(const LeaseDurationType& other) const { return m_value == other.m_value; } bool operator!=(const LeaseDurationType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseDurationType Infinite; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseDurationType Fixed; @@ -245,7 +245,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit LeaseStateType(std::string value) : m_value(std::move(value)) {} bool operator==(const LeaseStateType& other) const { return m_value == other.m_value; } bool operator!=(const LeaseStateType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseStateType Available; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseStateType Leased; @@ -264,7 +264,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit LeaseStatusType(std::string value) : m_value(std::move(value)) {} bool operator==(const LeaseStatusType& other) const { return m_value == other.m_value; } bool operator!=(const LeaseStatusType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseStatusType Locked; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseStatusType Unlocked; @@ -405,7 +405,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit LeaseAction(std::string value) : m_value(std::move(value)) {} bool operator==(const LeaseAction& other) const { return m_value == other.m_value; } bool operator!=(const LeaseAction& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseAction Acquire; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static LeaseAction Release; @@ -424,7 +424,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit CopyStatusType(std::string value) : m_value(std::move(value)) {} bool operator==(const CopyStatusType& other) const { return m_value == other.m_value; } bool operator!=(const CopyStatusType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static CopyStatusType Pending; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static CopyStatusType Success; @@ -446,7 +446,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { explicit FileRangeWriteType(std::string value) : m_value(std::move(value)) {} bool operator==(const FileRangeWriteType& other) const { return m_value == other.m_value; } bool operator!=(const FileRangeWriteType& other) const { return !(*this == other); } - const std::string& Get() const { return m_value; } + const std::string& ToString() const { return m_value; } AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FileRangeWriteType Update; AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FileRangeWriteType Clear; @@ -2570,7 +2570,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { if (createOptions.XMsAccessTier.HasValue()) { request.AddHeader( - Details::HeaderAccessTier, (createOptions.XMsAccessTier.GetValue().Get())); + Details::HeaderAccessTier, (createOptions.XMsAccessTier.GetValue().ToString())); } request.AddHeader(Details::HeaderVersion, createOptions.ApiVersionParameter); return CreateParseResult(context, pipeline.Send(context, request)); @@ -2650,7 +2650,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.AddHeader( Details::HeaderDeleteSnapshots, - (deleteOptions.XMsDeleteSnapshots.GetValue().Get())); + (deleteOptions.XMsDeleteSnapshots.GetValue().ToString())); } if (deleteOptions.LeaseIdOptional.HasValue()) { @@ -3007,7 +3007,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { if (setPropertiesOptions.XMsAccessTier.HasValue()) { request.AddHeader( - Details::HeaderAccessTier, (setPropertiesOptions.XMsAccessTier.GetValue().Get())); + Details::HeaderAccessTier, + (setPropertiesOptions.XMsAccessTier.GetValue().ToString())); } if (setPropertiesOptions.LeaseIdOptional.HasValue()) { @@ -5713,7 +5714,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { std::to_string(uploadRangeOptions.Timeout.GetValue()))); } request.AddHeader(Details::HeaderXMsRange, uploadRangeOptions.XMsRange); - request.AddHeader(Details::HeaderFileRangeWrite, (uploadRangeOptions.XMsWrite.Get())); + request.AddHeader( + Details::HeaderFileRangeWrite, (uploadRangeOptions.XMsWrite.ToString())); request.AddHeader( Details::HeaderContentLength, std::to_string(uploadRangeOptions.ContentLength)); if (uploadRangeOptions.ContentMd5.HasValue()) @@ -5770,7 +5772,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Details::HeaderSourceRange, uploadRangeFromUrlOptions.SourceRange.GetValue()); } request.AddHeader( - Details::HeaderFileRangeWriteFromUrl, (uploadRangeFromUrlOptions.XMsWrite.Get())); + Details::HeaderFileRangeWriteFromUrl, + (uploadRangeFromUrlOptions.XMsWrite.ToString())); request.AddHeader( Details::HeaderContentLength, std::to_string(uploadRangeFromUrlOptions.ContentLength)); @@ -5908,7 +5911,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.AddHeader( Details::HeaderFilePermissionCopyMode, - (startCopyOptions.XMsFilePermissionCopyMode.GetValue().Get())); + (startCopyOptions.XMsFilePermissionCopyMode.GetValue().ToString())); } if (startCopyOptions.FileCopyIgnoreReadOnly.HasValue()) { diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_attributes.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_attributes.hpp index 356db4779..b09e8a891 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_attributes.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_attributes.hpp @@ -15,7 +15,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names FileAttributes() = default; explicit FileAttributes(const std::string& value); - std::string Get() const; + std::string ToString() const; const std::vector GetValues() const { return m_value; } bool operator==(const FileAttributes& other) const { return m_value == other.m_value; } diff --git a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp index 5d7bc4a5c..b190e3487 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp @@ -110,10 +110,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { auto protocolLayerOptions = Details::ShareRestClient::Directory::CreateOptions(); protocolLayerOptions.Metadata = options.Metadata; - protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.Get(); + protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.ToString(); if (protocolLayerOptions.FileAttributes.empty()) { - protocolLayerOptions.FileAttributes = Models::FileAttributes::Directory.Get(); + protocolLayerOptions.FileAttributes = Models::FileAttributes::Directory.ToString(); } if (options.SmbProperties.CreatedOn.HasValue()) { @@ -239,7 +239,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const Azure::Core::Context& context) const { auto protocolLayerOptions = Details::ShareRestClient::Directory::SetPropertiesOptions(); - protocolLayerOptions.FileAttributes = smbProperties.Attributes.Get(); + protocolLayerOptions.FileAttributes = smbProperties.Attributes.ToString(); if (smbProperties.CreatedOn.HasValue()) { protocolLayerOptions.FileCreationTime = smbProperties.CreatedOn.GetValue().GetRfc3339String( diff --git a/sdk/storage/azure-storage-files-shares/src/share_file_attributes.cpp b/sdk/storage/azure-storage-files-shares/src/share_file_attributes.cpp index 0230987ee..dfb1d0ed6 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_file_attributes.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_file_attributes.cpp @@ -61,7 +61,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names return ret; } - std::string FileAttributes::Get() const + std::string FileAttributes::ToString() const { std::string ret; for (const auto& v : m_value) diff --git a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp index e16248e47..47601e446 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp @@ -99,10 +99,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { auto protocolLayerOptions = Details::ShareRestClient::File::CreateOptions(); protocolLayerOptions.Metadata = options.Metadata; - protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.Get(); + protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.ToString(); if (protocolLayerOptions.FileAttributes.empty()) { - protocolLayerOptions.FileAttributes = Models::FileAttributes::None.Get(); + protocolLayerOptions.FileAttributes = Models::FileAttributes::None.ToString(); } if (options.SmbProperties.CreatedOn.HasValue()) { @@ -318,7 +318,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { auto protocolLayerOptions = Details::ShareRestClient::File::StartCopyOptions(); protocolLayerOptions.Metadata = options.Metadata; protocolLayerOptions.CopySource = std::move(copySource); - protocolLayerOptions.FileCopyFileAttributes = options.SmbProperties.Attributes.Get(); + protocolLayerOptions.FileCopyFileAttributes = options.SmbProperties.Attributes.ToString(); if (options.SmbProperties.CreatedOn.HasValue()) { protocolLayerOptions.FileCopyFileCreationTime @@ -409,10 +409,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const Azure::Core::Context& context) const { auto protocolLayerOptions = Details::ShareRestClient::File::SetHttpHeadersOptions(); - protocolLayerOptions.FileAttributes = smbProperties.Attributes.Get(); + protocolLayerOptions.FileAttributes = smbProperties.Attributes.ToString(); if (protocolLayerOptions.FileAttributes.empty()) { - protocolLayerOptions.FileAttributes = Models::FileAttributes::None.Get(); + protocolLayerOptions.FileAttributes = Models::FileAttributes::None.ToString(); } if (smbProperties.CreatedOn.HasValue()) { @@ -836,10 +836,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { Details::ShareRestClient::File::CreateOptions protocolLayerOptions; protocolLayerOptions.XMsContentLength = bufferSize; - protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.Get(); + protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.ToString(); if (protocolLayerOptions.FileAttributes.empty()) { - protocolLayerOptions.FileAttributes = Models::FileAttributes::None.Get(); + protocolLayerOptions.FileAttributes = Models::FileAttributes::None.ToString(); } if (options.SmbProperties.CreatedOn.HasValue()) { @@ -941,10 +941,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Details::ShareRestClient::File::CreateOptions protocolLayerOptions; protocolLayerOptions.XMsContentLength = fileReader.GetFileSize(); - protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.Get(); + protocolLayerOptions.FileAttributes = options.SmbProperties.Attributes.ToString(); if (protocolLayerOptions.FileAttributes.empty()) { - protocolLayerOptions.FileAttributes = Models::FileAttributes::None.Get(); + protocolLayerOptions.FileAttributes = Models::FileAttributes::None.ToString(); } if (options.SmbProperties.CreatedOn.HasValue()) { diff --git a/sdk/storage/azure-storage-files-shares/test/share_file_attributes_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_file_attributes_test.cpp index 65491f25a..c1f3a1796 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_file_attributes_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_file_attributes_test.cpp @@ -13,7 +13,7 @@ namespace Azure { namespace Storage { namespace Test { | Files::Shares::Models::FileAttributes::Hidden | Files::Shares::Models::FileAttributes::System; - Files::Shares::Models::FileAttributes a2(a1.Get()); + Files::Shares::Models::FileAttributes a2(a1.ToString()); Files::Shares::Models::FileAttributes a3 = @@ -62,11 +62,11 @@ namespace Azure { namespace Storage { namespace Test { { // default constructible Files::Shares::Models::FileAttributes a1; - EXPECT_TRUE(a1.Get().empty()); + EXPECT_TRUE(a1.ToString().empty()); EXPECT_TRUE(a1.GetValues().empty()); Files::Shares::Models::FileAttributes a2(""); - EXPECT_TRUE(a2.Get().empty()); + EXPECT_TRUE(a2.ToString().empty()); EXPECT_TRUE(a2.GetValues().empty()); EXPECT_EQ(a1, a2); @@ -85,7 +85,7 @@ namespace Azure { namespace Storage { namespace Test { | Files::Shares::Models::FileAttributes::NotContentIndexed | Files::Shares::Models::FileAttributes::NoScrubData; - Files::Shares::Models::FileAttributes a2(a1.Get()); + Files::Shares::Models::FileAttributes a2(a1.ToString()); EXPECT_EQ(a1, a2); } diff --git a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp index f3847356c..c4b083b86 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp @@ -685,7 +685,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_TRUE(copyOperation.ETag.HasValue()); EXPECT_TRUE(IsValidTime(copyOperation.LastModified)); EXPECT_FALSE(copyOperation.CopyId.empty()); - EXPECT_FALSE(copyOperation.CopyStatus.Get().empty()); + EXPECT_FALSE(copyOperation.CopyStatus.ToString().empty()); auto fileProperties = *copyOperation.PollUntilDone(std::chrono::milliseconds(1000)); EXPECT_EQ( fileProperties.CopyStatus.GetValue(), Files::Shares::Models::CopyStatusType::Success);