diff --git a/sdk/storage/azure-storage-blobs/CHANGELOG.md b/sdk/storage/azure-storage-blobs/CHANGELOG.md index 8f07b8c89..7fd41cfc8 100644 --- a/sdk/storage/azure-storage-blobs/CHANGELOG.md +++ b/sdk/storage/azure-storage-blobs/CHANGELOG.md @@ -18,7 +18,6 @@ - Changed return type of `BlobServiceClient::GetAccountInfo` to `AccountInfo`. - Changed return type of `BlobServiceClient::GetStatistics` to `ServiceStatistics`. - Changed return type of `BlobContainerClient::GetProperties` to `BlobContainerProperties`. -- Changed return type of `BlobContainerClient::GetAccessPolicy` to `BlobContainerAccessPolicy`. - Changed return type of `BlobClient::GetProperties` to `BlobProperties`. - Changed return type of `BlobClinet::GetTags` to `std::map`. - Removed `PreviousShareSnapshot` from `GetShareFileRangeListOptions`, use `ShareFileClient::GetRangeListDiff` instead. diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp index b318a4601..6f786d2c1 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_container_client.hpp @@ -239,9 +239,9 @@ namespace Azure { namespace Storage { namespace Blobs { * * @param options Optional parameters to execute this function. * @param context Context for cancelling long running operations. - * @return A BlobContainerAccessPolicy describing the container's access policy. + * @return A GetBlobContainerAccessPolicyResult describing the container's access policy. */ - Azure::Response GetAccessPolicy( + Azure::Response GetAccessPolicy( const GetBlobContainerAccessPolicyOptions& options = GetBlobContainerAccessPolicyOptions(), const Azure::Core::Context& context = Azure::Core::Context()) const; 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 62e59166c..43452e913 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 @@ -747,12 +747,6 @@ namespace Azure { namespace Storage { namespace Blobs { BlobRetentionPolicy RetentionPolicy; }; // struct BlobAnalyticsLogging - struct BlobContainerAccessPolicy - { - PublicAccessType AccessType = PublicAccessType::None; - std::vector SignedIdentifiers; - }; // struct BlobContainerAccessPolicy - struct BlobContainerItemDetails { Azure::ETag ETag; @@ -807,6 +801,15 @@ namespace Azure { namespace Storage { namespace Blobs { std::vector Items; }; // struct FindBlobsByTagsSinglePageResult + struct GetBlobContainerAccessPolicyResult + { + std::string RequestId; + Azure::ETag ETag; + Azure::DateTime LastModified; + PublicAccessType AccessType = PublicAccessType::None; + std::vector SignedIdentifiers; + }; // struct GetBlobContainerAccessPolicyResult + struct GetBlockListResult { std::string RequestId; @@ -3418,7 +3421,7 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Nullable LeaseId; }; // struct GetBlobContainerAccessPolicyOptions - static Azure::Response GetAccessPolicy( + static Azure::Response GetAccessPolicy( Azure::Core::Http::_internal::HttpPipeline& pipeline, const Azure::Core::Url& url, const GetBlobContainerAccessPolicyOptions& options, @@ -3436,7 +3439,7 @@ namespace Azure { namespace Storage { namespace Blobs { request.GetUrl().AppendQueryParameter("comp", "acl"); auto pHttpResponse = pipeline.Send(request, context); Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse; - BlobContainerAccessPolicy response; + GetBlobContainerAccessPolicyResult response; auto http_status_code = static_cast::type>( httpResponse.GetStatusCode()); @@ -3448,15 +3451,19 @@ namespace Azure { namespace Storage { namespace Blobs { const auto& httpResponseBody = httpResponse.GetBody(); _internal::XmlReader reader( reinterpret_cast(httpResponseBody.data()), httpResponseBody.size()); - response = BlobContainerAccessPolicyFromXml(reader); + response = GetBlobContainerAccessPolicyResultFromXml(reader); } + response.RequestId = httpResponse.GetHeaders().at("x-ms-request-id"); + response.ETag = Azure::ETag(httpResponse.GetHeaders().at("etag")); + response.LastModified = Azure::DateTime::Parse( + httpResponse.GetHeaders().at("last-modified"), Azure::DateTime::DateFormat::Rfc1123); auto x_ms_blob_public_access__iterator = httpResponse.GetHeaders().find("x-ms-blob-public-access"); if (x_ms_blob_public_access__iterator != httpResponse.GetHeaders().end()) { response.AccessType = PublicAccessType(x_ms_blob_public_access__iterator->second); } - return Azure::Response( + return Azure::Response( std::move(response), std::move(pHttpResponse)); } @@ -3842,10 +3849,10 @@ namespace Azure { namespace Storage { namespace Blobs { } private: - static BlobContainerAccessPolicy BlobContainerAccessPolicyFromXml( + static GetBlobContainerAccessPolicyResult GetBlobContainerAccessPolicyResultFromXml( _internal::XmlReader& reader) { - BlobContainerAccessPolicy ret; + GetBlobContainerAccessPolicyResult ret; enum class XmlTagName { k_SignedIdentifiers, diff --git a/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp index cfd292b3b..c9d7cfc41 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_container_client.cpp @@ -291,7 +291,7 @@ namespace Azure { namespace Storage { namespace Blobs { return response; } - Azure::Response BlobContainerClient::GetAccessPolicy( + Azure::Response BlobContainerClient::GetAccessPolicy( const GetBlobContainerAccessPolicyOptions& options, const Azure::Core::Context& context) const { 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 9a286e3ad..d49b522d5 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 @@ -404,6 +404,9 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_TRUE(IsValidTime(ret->LastModified)); auto ret2 = container_client.GetAccessPolicy(); + EXPECT_FALSE(ret2->RequestId.empty()); + EXPECT_TRUE(ret2->ETag.HasValue()); + EXPECT_TRUE(IsValidTime(ret2->LastModified)); EXPECT_EQ(ret2->AccessType, options.AccessType); EXPECT_EQ(ret2->SignedIdentifiers, options.SignedIdentifiers); diff --git a/sdk/storage/azure-storage-files-datalake/CHANGELOG.md b/sdk/storage/azure-storage-files-datalake/CHANGELOG.md index c581698f9..39c31c54d 100644 --- a/sdk/storage/azure-storage-files-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-files-datalake/CHANGELOG.md @@ -14,7 +14,6 @@ - Moved `SecondaryHostForRetryReads` out of retry options, now it's under `DataLakeClientOptions`. - Changed return type of `DataLakeServiceClient::GetUserDelegationKey` to `UserDelegationKey`. - Changed return type of `DataLakeFileSystemClient::GetProperties` to `DataLakeFileSystemProperties`. -- Changed return type of `DataLakeFileSystemClient::GetAccessPolicy` to `DataLakeFileSystemAccessPolicy`. - Changed return type of `DataLakePathClient::GetProperties` to `DataLakePathProperties`. - Removed `GetUserDelegationKeyResult`. diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp index 09b812786..1b4083fa5 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_file_system_client.hpp @@ -189,10 +189,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { * * @param options Optional parameters to execute this function. * @param context Context for cancelling long running operations. - * @return A DataLakeFileSystemAccessPolicy describing the container's access policy. + * @return A GetDataLakeFileSystemAccessPolicyResult describing the container's access policy. * @remark This request is sent to blob endpoint. */ - Azure::Response GetAccessPolicy( + Azure::Response GetAccessPolicy( const GetDataLakeFileSystemAccessPolicyOptions& options = GetDataLakeFileSystemAccessPolicyOptions(), const Azure::Core::Context& context = Azure::Core::Context()) const; diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp index 23704c150..a6be05ae6 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp @@ -51,8 +51,11 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { nam using DataLakeSignedIdentifier = Blobs::Models::BlobSignedIdentifier; using ListDataLakeFileSystemsIncludeFlags = Blobs::Models::ListBlobContainersIncludeFlags; - struct DataLakeFileSystemAccessPolicy + struct GetDataLakeFileSystemAccessPolicyResult { + std::string RequestId; + Azure::ETag ETag; + Azure::DateTime LastModified; PublicAccessType AccessType = PublicAccessType::None; std::vector SignedIdentifiers; }; // struct DataLakeFileSystemAccessPolciy 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 41ba0fd97..277cdd893 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 @@ -283,14 +283,18 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { m_fileSystemUrl, *m_pipeline, _internal::WithReplicaStatus(context), protocolLayerOptions); } - Azure::Response DataLakeFileSystemClient::GetAccessPolicy( + Azure::Response + DataLakeFileSystemClient::GetAccessPolicy( const GetDataLakeFileSystemAccessPolicyOptions& options, const Azure::Core::Context& context) const { Blobs::GetBlobContainerAccessPolicyOptions blobOptions; blobOptions.AccessConditions.LeaseId = options.AccessConditions.LeaseId; auto response = m_blobContainerClient.GetAccessPolicy(blobOptions, context); - Models::DataLakeFileSystemAccessPolicy ret; + Models::GetDataLakeFileSystemAccessPolicyResult ret; + ret.RequestId = std::move(response->RequestId); + ret.ETag = std::move(response->ETag); + ret.LastModified = std::move(response->LastModified); if (response->AccessType == Blobs::Models::PublicAccessType::BlobContainer) { ret.AccessType = Models::PublicAccessType::FileSystem; @@ -308,7 +312,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { ret.AccessType = Models::PublicAccessType(response->AccessType.ToString()); } ret.SignedIdentifiers = std::move(response->SignedIdentifiers); - return Azure::Response( + return Azure::Response( std::move(ret), response.ExtractRawResponse()); } diff --git a/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp b/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp index 639960519..a972f1ee2 100644 --- a/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp +++ b/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp @@ -390,6 +390,9 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_TRUE(IsValidTime(ret->LastModified)); auto ret2 = fileSystem.GetAccessPolicy(); + EXPECT_FALSE(ret2->RequestId.empty()); + EXPECT_TRUE(ret2->ETag.HasValue()); + EXPECT_TRUE(IsValidTime(ret2->LastModified)); EXPECT_EQ(ret2->AccessType, options.AccessType); for (size_t i = 0; i < ret2->SignedIdentifiers.size(); ++i) {