Rename XxxRespone->XxxInfo (#337)

* Rename XxxRespone->XxxInfo

* fix doc, remove unused include headers, remove fab4

* Rename SetAccessTierInfo->SetBlobAccessTierInfo
This commit is contained in:
JinmingHu 2020-07-24 09:40:15 +08:00 committed by GitHub
parent 8568327a56
commit ef03d3b3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 94 additions and 85 deletions

View File

@ -92,6 +92,7 @@ set (AZURE_STORAGE_BLOB_HEADER
inc/blobs/page_blob_client.hpp
inc/blobs/append_blob_client.hpp
inc/blobs/blob_options.hpp
inc/blobs/blob_responses.hpp
inc/blobs/protocol/blob_rest_client.hpp
)

View File

@ -4,6 +4,7 @@
#pragma once
#include "blob_options.hpp"
#include "blob_responses.hpp"
#include "common/storage_credential.hpp"
#include "common/storage_uri_builder.hpp"
#include "credentials/credentials.hpp"
@ -20,18 +21,6 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
namespace Azure { namespace Storage { namespace Blobs {
struct BlobDownloadInfo
{
std::string ETag;
std::string LastModified;
int64_t ContentLength = 0;
BlobHttpHeaders HttpHeaders;
std::map<std::string, std::string> Metadata;
Blobs::BlobType BlobType = Blobs::BlobType::Unknown;
Azure::Core::Nullable<bool> ServerEncrypted;
Azure::Core::Nullable<std::string> EncryptionKeySHA256;
};
class BlockBlobClient;
class AppendBlobClient;
class PageBlobClient;
@ -164,7 +153,7 @@ namespace Azure { namespace Storage { namespace Blobs {
*
* @param httpHeaders The standard HTTP header system properties to set.
* @param options Optional parameters to execute this function.
* @return A SetBlobHttpHeadersResponse describing the updated blob.
* @return A BlobInfo describing the updated blob.
*/
Azure::Core::Response<BlobInfo> SetHttpHeaders(
BlobHttpHeaders httpHeaders,
@ -177,7 +166,7 @@ namespace Azure { namespace Storage { namespace Blobs {
* @param metadata Custom metadata to set for this blob.
* @param
* options Optional parameters to execute this function.
* @return A SetBlobMetadataResponse describing the updated blob.
* @return A BlobInfo describing the updated blob.
*/
Azure::Core::Response<BlobInfo> SetMetadata(
std::map<std::string, std::string> metadata,
@ -190,9 +179,9 @@ namespace Azure { namespace Storage { namespace Blobs {
* @param Tier Indicates the tier to be set on the blob.
* @param options Optional
* parameters to execute this function.
* @return A SetAccessTierResponse on successfully setting the tier.
* @return A SetBlobAccessTierInfo on successfully setting the tier.
*/
Azure::Core::Response<SetAccessTierResponse> SetAccessTier(
Azure::Core::Response<SetBlobAccessTierInfo> SetAccessTier(
AccessTier Tier,
const SetAccessTierOptions& options = SetAccessTierOptions()) const;
@ -218,9 +207,9 @@ namespace Azure { namespace Storage { namespace Blobs {
*
* @param copyId ID of the copy operation to abort.
* @param options Optional parameters to execute this function.
* @return A AbortCopyBlobResponse on successfully aborting.
* @return A AbortCopyBlobInfo on successfully aborting.
*/
Azure::Core::Response<AbortCopyBlobResponse> AbortCopyFromUri(
Azure::Core::Response<AbortCopyBlobInfo> AbortCopyFromUri(
const std::string& copyId,
const AbortCopyFromUriOptions& options = AbortCopyFromUriOptions()) const;
@ -243,8 +232,7 @@ namespace Azure { namespace Storage { namespace Blobs {
* @param bufferSize Size of the memory buffer. Size must be larger or equal to size of the blob
* or blob range.
* @param options Optional parameters to execute this function.
* @return A
* BlobDownloadInfo describing the downloaded blob.
* @return A BlobDownloadInfo describing the downloaded blob.
*/
Azure::Core::Response<BlobDownloadInfo> DownloadToBuffer(
uint8_t* buffer,
@ -257,8 +245,7 @@ namespace Azure { namespace Storage { namespace Blobs {
*
* @param file A file path to write the downloaded content to.
* @param options Optional parameters to execute this function.
* @return A
* BlobDownloadInfo describing the downloaded blob.
* @return A BlobDownloadInfo describing the downloaded blob.
*/
Azure::Core::Response<BlobDownloadInfo> DownloadToFile(
const std::string& file,
@ -281,9 +268,9 @@ namespace Azure { namespace Storage { namespace Blobs {
* snapshots. You can delete both at the same time using DeleteBlobOptions.DeleteSnapshots.
*
* @param options Optional parameters to execute this function.
* @return A DeleteBlobResponse on successfully deleting.
* @return A DeleteBlobInfo on successfully deleting.
*/
Azure::Core::Response<DeleteBlobResponse> Delete(
Azure::Core::Response<DeleteBlobInfo> Delete(
const DeleteBlobOptions& options = DeleteBlobOptions()) const;
/**
@ -292,9 +279,9 @@ namespace Azure { namespace Storage { namespace Blobs {
*
* @param options Optional parameters to execute this
* function.
* @return A UndeleteBlobResponse on successfully deleting.
* @return A UndeleteBlobInfo on successfully deleting.
*/
Azure::Core::Response<UndeleteBlobResponse> Undelete(
Azure::Core::Response<UndeleteBlobInfo> Undelete(
const UndeleteBlobOptions& options = UndeleteBlobOptions()) const;
protected:

View File

@ -144,9 +144,9 @@ namespace Azure { namespace Storage { namespace Blobs {
*
* @param
* options Optional parameters to execute this function.
* @return A DeleteContainerResponse if successful.
* @return A DeleteContainerInfo if successful.
*/
Azure::Core::Response<DeleteContainerResponse> Delete(
Azure::Core::Response<DeleteContainerInfo> Delete(
const DeleteBlobContainerOptions& options = DeleteBlobContainerOptions()) const;
/**
@ -167,7 +167,7 @@ namespace Azure { namespace Storage { namespace Blobs {
* @param metadata Custom metadata to set for this container.
* @param options
* Optional parameters to execute this function.
* @return A SetContainerMetadataResponse if successful.
* @return A BlobContainerInfo if successful.
*/
Azure::Core::Response<BlobContainerInfo> SetMetadata(
std::map<std::string, std::string> metadata,

View File

@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#pragma once
#include "protocol/blob_rest_client.hpp"
#include <map>
#include <string>
#include <vector>
namespace Azure { namespace Storage { namespace Blobs {
struct BlobDownloadInfo
{
std::string ETag;
std::string LastModified;
int64_t ContentLength = 0;
BlobHttpHeaders HttpHeaders;
std::map<std::string, std::string> Metadata;
Blobs::BlobType BlobType = Blobs::BlobType::Unknown;
Azure::Core::Nullable<bool> ServerEncrypted;
Azure::Core::Nullable<std::string> EncryptionKeySHA256;
};
struct PageRange
{
int64_t Offset;
int64_t Length;
};
struct PageRangesInfo
{
std::string ETag;
std::string LastModified;
int64_t BlobContentLength = 0;
std::vector<PageRange> PageRanges;
std::vector<PageRange> ClearRanges;
};
}}} // namespace Azure::Storage::Blobs

View File

@ -4,6 +4,7 @@
#pragma once
#include "blob_options.hpp"
#include "blob_responses.hpp"
#include "blobs/blob_client.hpp"
#include "common/storage_credential.hpp"
#include "credentials/credentials.hpp"
@ -13,25 +14,6 @@
namespace Azure { namespace Storage { namespace Blobs {
struct PageRange
{
int64_t Offset;
int64_t Length;
};
struct PageRangesInfo
{
std::string RequestId;
std::string Date;
std::string Version;
Azure::Core::Nullable<std::string> ClientRequestId;
std::string ETag;
std::string LastModified;
int64_t BlobContentLength = 0;
std::vector<PageRange> PageRanges;
std::vector<PageRange> ClearRanges;
};
/**
* The PageBlobClient allows you to manipulate Azure Storage page blobs.
*

View File

@ -28,9 +28,9 @@ namespace Azure { namespace Storage { namespace Blobs {
Azure::Core::Http::BodyStream,
std::function<void(Azure::Core::Http::BodyStream*)>>;
struct AbortCopyBlobResponse
struct AbortCopyBlobInfo
{
}; // struct AbortCopyBlobResponse
}; // struct AbortCopyBlobInfo
enum class AccessTier
{
@ -539,13 +539,13 @@ namespace Azure { namespace Storage { namespace Blobs {
throw std::runtime_error("cannot convert " + copy_status + " to CopyStatus");
}
struct DeleteBlobResponse
struct DeleteBlobInfo
{
}; // struct DeleteBlobResponse
}; // struct DeleteBlobInfo
struct DeleteContainerResponse
struct DeleteContainerInfo
{
}; // struct DeleteContainerResponse
}; // struct DeleteContainerInfo
enum class DeleteSnapshotsOption
{
@ -823,13 +823,13 @@ namespace Azure { namespace Storage { namespace Blobs {
throw std::runtime_error("cannot convert " + rehydrate_priority + " to RehydratePriority");
}
struct SetAccessTierResponse
struct SetBlobAccessTierInfo
{
}; // struct SetAccessTierResponse
}; // struct SetBlobAccessTierInfo
struct UndeleteBlobResponse
struct UndeleteBlobInfo
{
}; // struct UndeleteBlobResponse
}; // struct UndeleteBlobInfo
struct UserDelegationKey
{
@ -1704,13 +1704,13 @@ namespace Azure { namespace Storage { namespace Blobs {
return request;
}
static Azure::Core::Response<DeleteContainerResponse> DeleteParseResponse(
static Azure::Core::Response<DeleteContainerInfo> DeleteParseResponse(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> pHttpResponse)
{
unused(context);
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
DeleteContainerResponse response;
DeleteContainerInfo response;
auto http_status_code
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
httpResponse.GetStatusCode());
@ -1718,11 +1718,11 @@ namespace Azure { namespace Storage { namespace Blobs {
{
throw StorageError::CreateFromResponse(std::move(pHttpResponse));
}
return Azure::Core::Response<DeleteContainerResponse>(
return Azure::Core::Response<DeleteContainerInfo>(
std::move(response), std::move(pHttpResponse));
}
static Azure::Core::Response<DeleteContainerResponse> Delete(
static Azure::Core::Response<DeleteContainerInfo> Delete(
Azure::Core::Context context,
Azure::Core::Http::HttpPipeline& pipeline,
const std::string& url,
@ -2969,13 +2969,13 @@ namespace Azure { namespace Storage { namespace Blobs {
return request;
}
static Azure::Core::Response<DeleteBlobResponse> DeleteParseResponse(
static Azure::Core::Response<DeleteBlobInfo> DeleteParseResponse(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> pHttpResponse)
{
unused(context);
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
DeleteBlobResponse response;
DeleteBlobInfo response;
auto http_status_code
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
httpResponse.GetStatusCode());
@ -2983,11 +2983,10 @@ namespace Azure { namespace Storage { namespace Blobs {
{
throw StorageError::CreateFromResponse(std::move(pHttpResponse));
}
return Azure::Core::Response<DeleteBlobResponse>(
std::move(response), std::move(pHttpResponse));
return Azure::Core::Response<DeleteBlobInfo>(std::move(response), std::move(pHttpResponse));
}
static Azure::Core::Response<DeleteBlobResponse> Delete(
static Azure::Core::Response<DeleteBlobInfo> Delete(
Azure::Core::Context context,
Azure::Core::Http::HttpPipeline& pipeline,
const std::string& url,
@ -3022,13 +3021,13 @@ namespace Azure { namespace Storage { namespace Blobs {
return request;
}
static Azure::Core::Response<UndeleteBlobResponse> UndeleteParseResponse(
static Azure::Core::Response<UndeleteBlobInfo> UndeleteParseResponse(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> pHttpResponse)
{
unused(context);
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
UndeleteBlobResponse response;
UndeleteBlobInfo response;
auto http_status_code
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
httpResponse.GetStatusCode());
@ -3036,11 +3035,11 @@ namespace Azure { namespace Storage { namespace Blobs {
{
throw StorageError::CreateFromResponse(std::move(pHttpResponse));
}
return Azure::Core::Response<UndeleteBlobResponse>(
return Azure::Core::Response<UndeleteBlobInfo>(
std::move(response), std::move(pHttpResponse));
}
static Azure::Core::Response<UndeleteBlobResponse> Undelete(
static Azure::Core::Response<UndeleteBlobInfo> Undelete(
Azure::Core::Context context,
Azure::Core::Http::HttpPipeline& pipeline,
const std::string& url,
@ -3534,13 +3533,13 @@ namespace Azure { namespace Storage { namespace Blobs {
return request;
}
static Azure::Core::Response<SetAccessTierResponse> SetAccessTierParseResponse(
static Azure::Core::Response<SetBlobAccessTierInfo> SetAccessTierParseResponse(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> pHttpResponse)
{
unused(context);
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
SetAccessTierResponse response;
SetBlobAccessTierInfo response;
auto http_status_code
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
httpResponse.GetStatusCode());
@ -3548,11 +3547,11 @@ namespace Azure { namespace Storage { namespace Blobs {
{
throw StorageError::CreateFromResponse(std::move(pHttpResponse));
}
return Azure::Core::Response<SetAccessTierResponse>(
return Azure::Core::Response<SetBlobAccessTierInfo>(
std::move(response), std::move(pHttpResponse));
}
static Azure::Core::Response<SetAccessTierResponse> SetAccessTier(
static Azure::Core::Response<SetBlobAccessTierInfo> SetAccessTier(
Azure::Core::Context context,
Azure::Core::Http::HttpPipeline& pipeline,
const std::string& url,
@ -3732,13 +3731,13 @@ namespace Azure { namespace Storage { namespace Blobs {
return request;
}
static Azure::Core::Response<AbortCopyBlobResponse> AbortCopyFromUriParseResponse(
static Azure::Core::Response<AbortCopyBlobInfo> AbortCopyFromUriParseResponse(
Azure::Core::Context context,
std::unique_ptr<Azure::Core::Http::RawResponse> pHttpResponse)
{
unused(context);
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
AbortCopyBlobResponse response;
AbortCopyBlobInfo response;
auto http_status_code
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
httpResponse.GetStatusCode());
@ -3746,11 +3745,11 @@ namespace Azure { namespace Storage { namespace Blobs {
{
throw StorageError::CreateFromResponse(std::move(pHttpResponse));
}
return Azure::Core::Response<AbortCopyBlobResponse>(
return Azure::Core::Response<AbortCopyBlobInfo>(
std::move(response), std::move(pHttpResponse));
}
static Azure::Core::Response<AbortCopyBlobResponse> AbortCopyFromUri(
static Azure::Core::Response<AbortCopyBlobInfo> AbortCopyFromUri(
Azure::Core::Context context,
Azure::Core::Http::HttpPipeline& pipeline,
const std::string& url,

View File

@ -461,7 +461,7 @@ namespace Azure { namespace Storage { namespace Blobs {
options.Context, *m_pipeline, m_blobUrl.ToString(), protocolLayerOptions);
}
Azure::Core::Response<SetAccessTierResponse> BlobClient::SetAccessTier(
Azure::Core::Response<SetBlobAccessTierInfo> BlobClient::SetAccessTier(
AccessTier Tier,
const SetAccessTierOptions& options) const
{
@ -495,7 +495,7 @@ namespace Azure { namespace Storage { namespace Blobs {
options.Context, *m_pipeline, m_blobUrl.ToString(), protocolLayerOptions);
}
Azure::Core::Response<AbortCopyBlobResponse> BlobClient::AbortCopyFromUri(
Azure::Core::Response<AbortCopyBlobInfo> BlobClient::AbortCopyFromUri(
const std::string& copyId,
const AbortCopyFromUriOptions& options) const
{
@ -520,8 +520,7 @@ namespace Azure { namespace Storage { namespace Blobs {
options.Context, *m_pipeline, m_blobUrl.ToString(), protocolLayerOptions);
}
Azure::Core::Response<DeleteBlobResponse> BlobClient::Delete(
const DeleteBlobOptions& options) const
Azure::Core::Response<DeleteBlobInfo> BlobClient::Delete(const DeleteBlobOptions& options) const
{
BlobRestClient::Blob::DeleteOptions protocolLayerOptions;
protocolLayerOptions.DeleteSnapshots = options.DeleteSnapshots;
@ -534,7 +533,7 @@ namespace Azure { namespace Storage { namespace Blobs {
options.Context, *m_pipeline, m_blobUrl.ToString(), protocolLayerOptions);
}
Azure::Core::Response<UndeleteBlobResponse> BlobClient::Undelete(
Azure::Core::Response<UndeleteBlobInfo> BlobClient::Undelete(
const UndeleteBlobOptions& options) const
{
BlobRestClient::Blob::UndeleteOptions protocolLayerOptions;

View File

@ -146,7 +146,7 @@ namespace Azure { namespace Storage { namespace Blobs {
options.Context, *m_pipeline, m_containerUrl.ToString(), protocolLayerOptions);
}
Azure::Core::Response<DeleteContainerResponse> BlobContainerClient::Delete(
Azure::Core::Response<DeleteContainerInfo> BlobContainerClient::Delete(
const DeleteBlobContainerOptions& options) const
{
BlobRestClient::Container::DeleteOptions protocolLayerOptions;