revert changes to GetAccessPolicy (#1923)
This commit is contained in:
parent
5df3596c34
commit
5210e8eb0d
@ -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<std::string, std::string>`.
|
||||
- Removed `PreviousShareSnapshot` from `GetShareFileRangeListOptions`, use `ShareFileClient::GetRangeListDiff` instead.
|
||||
|
||||
@ -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<Models::BlobContainerAccessPolicy> GetAccessPolicy(
|
||||
Azure::Response<Models::GetBlobContainerAccessPolicyResult> GetAccessPolicy(
|
||||
const GetBlobContainerAccessPolicyOptions& options = GetBlobContainerAccessPolicyOptions(),
|
||||
const Azure::Core::Context& context = Azure::Core::Context()) const;
|
||||
|
||||
|
||||
@ -747,12 +747,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
BlobRetentionPolicy RetentionPolicy;
|
||||
}; // struct BlobAnalyticsLogging
|
||||
|
||||
struct BlobContainerAccessPolicy
|
||||
{
|
||||
PublicAccessType AccessType = PublicAccessType::None;
|
||||
std::vector<BlobSignedIdentifier> SignedIdentifiers;
|
||||
}; // struct BlobContainerAccessPolicy
|
||||
|
||||
struct BlobContainerItemDetails
|
||||
{
|
||||
Azure::ETag ETag;
|
||||
@ -807,6 +801,15 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
std::vector<FilterBlobItem> Items;
|
||||
}; // struct FindBlobsByTagsSinglePageResult
|
||||
|
||||
struct GetBlobContainerAccessPolicyResult
|
||||
{
|
||||
std::string RequestId;
|
||||
Azure::ETag ETag;
|
||||
Azure::DateTime LastModified;
|
||||
PublicAccessType AccessType = PublicAccessType::None;
|
||||
std::vector<BlobSignedIdentifier> SignedIdentifiers;
|
||||
}; // struct GetBlobContainerAccessPolicyResult
|
||||
|
||||
struct GetBlockListResult
|
||||
{
|
||||
std::string RequestId;
|
||||
@ -3418,7 +3421,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Nullable<std::string> LeaseId;
|
||||
}; // struct GetBlobContainerAccessPolicyOptions
|
||||
|
||||
static Azure::Response<BlobContainerAccessPolicy> GetAccessPolicy(
|
||||
static Azure::Response<GetBlobContainerAccessPolicyResult> 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<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -3448,15 +3451,19 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
const auto& httpResponseBody = httpResponse.GetBody();
|
||||
_internal::XmlReader reader(
|
||||
reinterpret_cast<const char*>(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<BlobContainerAccessPolicy>(
|
||||
return Azure::Response<GetBlobContainerAccessPolicyResult>(
|
||||
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,
|
||||
|
||||
@ -291,7 +291,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
return response;
|
||||
}
|
||||
|
||||
Azure::Response<Models::BlobContainerAccessPolicy> BlobContainerClient::GetAccessPolicy(
|
||||
Azure::Response<Models::GetBlobContainerAccessPolicyResult> BlobContainerClient::GetAccessPolicy(
|
||||
const GetBlobContainerAccessPolicyOptions& options,
|
||||
const Azure::Core::Context& context) const
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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`.
|
||||
|
||||
|
||||
@ -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<Models::DataLakeFileSystemAccessPolicy> GetAccessPolicy(
|
||||
Azure::Response<Models::GetDataLakeFileSystemAccessPolicyResult> GetAccessPolicy(
|
||||
const GetDataLakeFileSystemAccessPolicyOptions& options
|
||||
= GetDataLakeFileSystemAccessPolicyOptions(),
|
||||
const Azure::Core::Context& context = Azure::Core::Context()) const;
|
||||
|
||||
@ -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<DataLakeSignedIdentifier> SignedIdentifiers;
|
||||
}; // struct DataLakeFileSystemAccessPolciy
|
||||
|
||||
@ -283,14 +283,18 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
m_fileSystemUrl, *m_pipeline, _internal::WithReplicaStatus(context), protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Response<Models::DataLakeFileSystemAccessPolicy> DataLakeFileSystemClient::GetAccessPolicy(
|
||||
Azure::Response<Models::GetDataLakeFileSystemAccessPolicyResult>
|
||||
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<Models::DataLakeFileSystemAccessPolicy>(
|
||||
return Azure::Response<Models::GetDataLakeFileSystemAccessPolicyResult>(
|
||||
std::move(ret), response.ExtractRawResponse());
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user