azure-storage-blobs
Public Member Functions | Static Public Member Functions | Friends | List of all members
Azure::Storage::Blobs::AppendBlobClient Class Reference

The AppendBlobClient allows you to manipulate Azure Storage append blobs. More...

#include <append_blob_client.hpp>

Inheritance diagram for Azure::Storage::Blobs::AppendBlobClient:
Azure::Storage::Blobs::BlobClient

Public Member Functions

 AppendBlobClient (const std::string &blobUri, std::shared_ptr< SharedKeyCredential > credential, const AppendBlobClientOptions &options=AppendBlobClientOptions())
 Initialize a new instance of AppendBlobClient. More...
 
 AppendBlobClient (const std::string &blobUri, std::shared_ptr< Core::Credentials::ClientSecretCredential > credential, const AppendBlobClientOptions &options=AppendBlobClientOptions())
 Initialize a new instance of AppendBlobClient. More...
 
 AppendBlobClient (const std::string &blobUri, const AppendBlobClientOptions &options=AppendBlobClientOptions())
 Initialize a new instance of AppendBlobClient. More...
 
AppendBlobClient WithSnapshot (const std::string &snapshot) const
 Initializes a new instance of the AppendBlobClient class with an identical uri source but the specified snapshot timestamp. More...
 
AppendBlobClient WithVersionId (const std::string &versionId) const
 Creates a clone of this instance that references a version ID rather than the base blob. More...
 
Azure::Core::Response< CreateAppendBlobResultCreate (const CreateAppendBlobOptions &options=CreateAppendBlobOptions()) const
 Creates a new 0-length append blob. The content of any existing blob is overwritten with the newly initialized append blob. More...
 
Azure::Core::Response< AppendBlockResultAppendBlock (Azure::Core::Http::BodyStream *content, const AppendBlockOptions &options=AppendBlockOptions()) const
 Commits a new block of data, represented by the content BodyStream to the end of the existing append blob. More...
 
Azure::Core::Response< AppendBlockFromUriResultAppendBlockFromUri (const std::string &sourceUri, const AppendBlockFromUriOptions &options=AppendBlockFromUriOptions()) const
 Commits a new block of data, represented by the content BodyStream to the end of the existing append blob. More...
 
Azure::Core::Response< SealAppendBlobResultSeal (const SealAppendBlobOptions &options=SealAppendBlobOptions()) const
 Seals the append blob, making it read only. Any subsequent appends will fail. More...
 
- Public Member Functions inherited from Azure::Storage::Blobs::BlobClient
 BlobClient (const std::string &blobUri, std::shared_ptr< SharedKeyCredential > credential, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlobClient. More...
 
 BlobClient (const std::string &blobUri, std::shared_ptr< Core::Credentials::ClientSecretCredential > credential, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlobClient. More...
 
 BlobClient (const std::string &blobUri, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlobClient. More...
 
BlockBlobClient GetBlockBlobClient () const
 Creates a new BlockBlobClient object with the same uri as this BlobClient. The new BlockBlobClient uses the same request policy pipeline as this BlobClient. More...
 
AppendBlobClient GetAppendBlobClient () const
 Creates a new AppendBlobClient object with the same uri as this BlobClient. The new AppendBlobClient uses the same request policy pipeline as this BlobClient. More...
 
PageBlobClient GetPageBlobClient () const
 Creates a new PageBlobClient object with the same uri as this BlobClient. The new PageBlobClient uses the same request policy pipeline as this BlobClient. More...
 
std::string GetUri () const
 Gets the blob's primary uri endpoint. More...
 
BlobClient WithSnapshot (const std::string &snapshot) const
 Initializes a new instance of the BlobClient class with an identical uri source but the specified snapshot timestamp. More...
 
BlobClient WithVersionId (const std::string &versionId) const
 Creates a clone of this instance that references a version ID rather than the base blob. More...
 
Azure::Core::Response< GetBlobPropertiesResultGetProperties (const GetBlobPropertiesOptions &options=GetBlobPropertiesOptions()) const
 Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. More...
 
Azure::Core::Response< SetBlobHttpHeadersResultSetHttpHeaders (BlobHttpHeaders httpHeaders, const SetBlobHttpHeadersOptions &options=SetBlobHttpHeadersOptions()) const
 Sets system properties on the blob. More...
 
Azure::Core::Response< SetBlobMetadataResultSetMetadata (std::map< std::string, std::string > metadata, const SetBlobMetadataOptions &options=SetBlobMetadataOptions()) const
 Sets user-defined metadata for the specified blob as one or more name-value pairs. More...
 
Azure::Core::Response< SetBlobAccessTierResultSetAccessTier (AccessTier Tier, const SetBlobAccessTierOptions &options=SetBlobAccessTierOptions()) const
 Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage or general purpose v2 account. More...
 
Azure::Core::Response< StartCopyBlobFromUriResultStartCopyFromUri (const std::string &sourceUri, const StartCopyBlobFromUriOptions &options=StartCopyBlobFromUriOptions()) const
 Copies data at from the source to this blob. More...
 
Azure::Core::Response< AbortCopyBlobFromUriResultAbortCopyFromUri (const std::string &copyId, const AbortCopyBlobFromUriOptions &options=AbortCopyBlobFromUriOptions()) const
 Aborts a pending StartCopyFromUri operation, and leaves this blob with zero length and full metadata. More...
 
Azure::Core::Response< DownloadBlobResultDownload (const DownloadBlobOptions &options=DownloadBlobOptions()) const
 Downloads a blob or a blob range from the service, including its metadata and properties. More...
 
Azure::Core::Response< DownloadBlobToResultDownloadTo (uint8_t *buffer, std::size_t bufferSize, const DownloadBlobToOptions &options=DownloadBlobToOptions()) const
 Downloads a blob or a blob range from the service to a memory buffer using parallel requests. More...
 
Azure::Core::Response< DownloadBlobToResultDownloadTo (const std::string &file, const DownloadBlobToOptions &options=DownloadBlobToOptions()) const
 Downloads a blob or a blob range from the service to a file using parallel requests. More...
 
Azure::Core::Response< CreateBlobSnapshotResultCreateSnapshot (const CreateBlobSnapshotOptions &options=CreateBlobSnapshotOptions()) const
 Creates a read-only snapshot of a blob. More...
 
Azure::Core::Response< DeleteBlobResultDelete (const DeleteBlobOptions &options=DeleteBlobOptions()) const
 Marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time using DeleteBlobOptions.DeleteSnapshots. More...
 
Azure::Core::Response< UndeleteBlobResultUndelete (const UndeleteBlobOptions &options=UndeleteBlobOptions()) const
 Restores the contents and metadata of a soft deleted blob and any associated soft deleted snapshots. More...
 
Azure::Core::Response< AcquireBlobLeaseResultAcquireLease (const std::string &proposedLeaseId, int32_t duration, const AcquireBlobLeaseOptions &options=AcquireBlobLeaseOptions()) const
 Acquires a lease on the blob. More...
 
Azure::Core::Response< RenewBlobLeaseResultRenewLease (const std::string &leaseId, const RenewBlobLeaseOptions &options=RenewBlobLeaseOptions()) const
 Renews the blob's previously-acquired lease. More...
 
Azure::Core::Response< ReleaseBlobLeaseResultReleaseLease (const std::string &leaseId, const ReleaseBlobLeaseOptions &options=ReleaseBlobLeaseOptions()) const
 Releases the blob's previously-acquired lease. More...
 
Azure::Core::Response< ChangeBlobLeaseResultChangeLease (const std::string &leaseId, const std::string &proposedLeaseId, const ChangeBlobLeaseOptions &options=ChangeBlobLeaseOptions()) const
 Changes the lease of an active lease. More...
 
Azure::Core::Response< BreakBlobLeaseResultBreakLease (const BreakBlobLeaseOptions &options=BreakBlobLeaseOptions()) const
 Breaks the previously-acquired lease. More...
 
Azure::Core::Response< SetBlobTagsResultSetTags (std::map< std::string, std::string > tags, const SetBlobTagsOptions &options=SetBlobTagsOptions()) const
 Sets tags on the underlying blob. More...
 
Azure::Core::Response< GetBlobTagsResultGetTags (const GetBlobTagsOptions &options=GetBlobTagsOptions()) const
 Gets the tags associated with the underlying blob. More...
 

Static Public Member Functions

static AppendBlobClient CreateFromConnectionString (const std::string &connectionString, const std::string &containerName, const std::string &blobName, const AppendBlobClientOptions &options=AppendBlobClientOptions())
 Initialize a new instance of AppendBlobClient. More...
 
- Static Public Member Functions inherited from Azure::Storage::Blobs::BlobClient
static BlobClient CreateFromConnectionString (const std::string &connectionString, const std::string &containerName, const std::string &blobName, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlobClient. More...
 

Friends

class BlobClient
 

Additional Inherited Members

- Protected Attributes inherited from Azure::Storage::Blobs::BlobClient
Azure::Core::Http::Url m_blobUrl
 
std::shared_ptr< Azure::Core::Http::HttpPipeline > m_pipeline
 
Azure::Core::Nullable< EncryptionKeym_customerProvidedKey
 
Azure::Core::Nullable< std::string > m_encryptionScope
 

Detailed Description

The AppendBlobClient allows you to manipulate Azure Storage append blobs.

An append blob is comprised of blocks and is optimized for append operations. When you modify an append blob, blocks are added to the end of the blob only, via the AppendBlock operation. Updating or deleting of existing blocks is not supported. Unlike a block blob, an append blob does not expose its block IDs.

Constructor & Destructor Documentation

◆ AppendBlobClient() [1/3]

Azure::Storage::Blobs::AppendBlobClient::AppendBlobClient ( const std::string &  blobUri,
std::shared_ptr< SharedKeyCredential >  credential,
const AppendBlobClientOptions options = AppendBlobClientOptions() 
)
explicit

Initialize a new instance of AppendBlobClient.

Parameters
blobUriA uri referencing the blob that includes the name of the account, the name of the container, and the name of the blob.
credentialThe shared key credential used to sign requests.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
26  : BlobClient(blobUri, std::move(credential), options)
27  {
28  }

◆ AppendBlobClient() [2/3]

Azure::Storage::Blobs::AppendBlobClient::AppendBlobClient ( const std::string &  blobUri,
std::shared_ptr< Core::Credentials::ClientSecretCredential >  credential,
const AppendBlobClientOptions options = AppendBlobClientOptions() 
)
explicit

Initialize a new instance of AppendBlobClient.

Parameters
blobUriA uri referencing the blob that includes the name of the account, the name of the container, and the name of the blob.
credentialThe client secret credential used to sign requests.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
34  : BlobClient(blobUri, std::move(credential), options)
35  {
36  }

◆ AppendBlobClient() [3/3]

Azure::Storage::Blobs::AppendBlobClient::AppendBlobClient ( const std::string &  blobUri,
const AppendBlobClientOptions options = AppendBlobClientOptions() 
)
explicit

Initialize a new instance of AppendBlobClient.

Parameters
blobUriA uri referencing the blob that includes the name of the account, the name of the container, and the name of the blob, and possibly also a SAS token.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
41  : BlobClient(blobUri, options)
42  {
43  }

Member Function Documentation

◆ AppendBlock()

Azure::Core::Response< AppendBlockResult > Azure::Storage::Blobs::AppendBlobClient::AppendBlock ( Azure::Core::Http::BodyStream *  content,
const AppendBlockOptions options = AppendBlockOptions() 
) const

Commits a new block of data, represented by the content BodyStream to the end of the existing append blob.

Parameters
contentA BodyStream containing the content of the block to append.
optionsOptional parameters to execute this function.
Returns
A AppendBlockResult describing the state of the updated append blob.
101  {
102  BlobRestClient::AppendBlob::AppendBlockOptions protocolLayerOptions;
103  protocolLayerOptions.TransactionalContentMd5 = options.TransactionalContentMd5;
104  protocolLayerOptions.TransactionalContentCrc64 = options.TransactionalContentCrc64;
105  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
106  protocolLayerOptions.MaxSize = options.AccessConditions.MaxSize;
107  protocolLayerOptions.AppendPosition = options.AccessConditions.AppendPosition;
108  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
109  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
110  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
111  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
112  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
113  if (m_customerProvidedKey.HasValue())
114  {
115  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
116  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
117  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
118  }
119  protocolLayerOptions.EncryptionScope = m_encryptionScope;
120  return BlobRestClient::AppendBlob::AppendBlock(
121  options.Context, *m_pipeline, m_blobUrl, content, protocolLayerOptions);
122  }

◆ AppendBlockFromUri()

Azure::Core::Response< AppendBlockFromUriResult > Azure::Storage::Blobs::AppendBlobClient::AppendBlockFromUri ( const std::string &  sourceUri,
const AppendBlockFromUriOptions options = AppendBlockFromUriOptions() 
) const

Commits a new block of data, represented by the content BodyStream to the end of the existing append blob.

Parameters
sourceUriSpecifies the uri of the source blob. The value may be a uri of up to 2 KB in length that specifies a blob. The source blob must either be public or must be authenticated via a shared access signature. If the source blob is public, no authentication is required to perform the operation.
optionsOptional parameters to execute this function.
Returns
A AppendBlockFromUriResult describing the state of the updated append blob.
127  {
128  BlobRestClient::AppendBlob::AppendBlockFromUriOptions protocolLayerOptions;
129  protocolLayerOptions.SourceUri = sourceUri;
130  if (options.SourceOffset.HasValue() && options.SourceLength.HasValue())
131  {
132  protocolLayerOptions.SourceRange = std::make_pair(
133  options.SourceOffset.GetValue(),
134  options.SourceOffset.GetValue() + options.SourceLength.GetValue() - 1);
135  }
136  else if (options.SourceOffset.HasValue())
137  {
138  protocolLayerOptions.SourceRange = std::make_pair(
139  options.SourceOffset.GetValue(),
140  std::numeric_limits<
141  std::remove_reference_t<decltype(options.SourceOffset.GetValue())>>::max());
142  }
143  protocolLayerOptions.TransactionalContentMd5 = options.TransactionalContentMd5;
144  protocolLayerOptions.TransactionalContentCrc64 = options.TransactionalContentCrc64;
145  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
146  protocolLayerOptions.MaxSize = options.AccessConditions.MaxSize;
147  protocolLayerOptions.AppendPosition = options.AccessConditions.AppendPosition;
148  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
149  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
150  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
151  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
152  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
153  if (m_customerProvidedKey.HasValue())
154  {
155  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
156  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
157  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
158  }
159  protocolLayerOptions.EncryptionScope = m_encryptionScope;
160  return BlobRestClient::AppendBlob::AppendBlockFromUri(
161  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
162  }

◆ Create()

Azure::Core::Response< CreateAppendBlobResult > Azure::Storage::Blobs::AppendBlobClient::Create ( const CreateAppendBlobOptions options = CreateAppendBlobOptions()) const

Creates a new 0-length append blob. The content of any existing blob is overwritten with the newly initialized append blob.

Parameters
optionsOptional parameters to execute this function.
Returns
A CreateAppendBlobResult describing the newly created append blob.
77  {
78  BlobRestClient::AppendBlob::CreateAppendBlobOptions protocolLayerOptions;
79  protocolLayerOptions.HttpHeaders = options.HttpHeaders;
80  protocolLayerOptions.Metadata = options.Metadata;
81  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
82  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
83  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
84  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
85  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
86  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
87  if (m_customerProvidedKey.HasValue())
88  {
89  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
90  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
91  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
92  }
93  protocolLayerOptions.EncryptionScope = m_encryptionScope;
94  return BlobRestClient::AppendBlob::Create(
95  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
96  }

◆ CreateFromConnectionString()

AppendBlobClient Azure::Storage::Blobs::AppendBlobClient::CreateFromConnectionString ( const std::string &  connectionString,
const std::string &  containerName,
const std::string &  blobName,
const AppendBlobClientOptions options = AppendBlobClientOptions() 
)
static

Initialize a new instance of AppendBlobClient.

Parameters
connectionStringA connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.
containerNameThe name of the container containing this blob.
blobNameThe name of this blob.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.
Returns
A new AppendBlobClient instance.
16  {
17  AppendBlobClient newClient(
18  BlobClient::CreateFromConnectionString(connectionString, containerName, blobName, options));
19  return newClient;
20  }

◆ Seal()

Azure::Core::Response< SealAppendBlobResult > Azure::Storage::Blobs::AppendBlobClient::Seal ( const SealAppendBlobOptions options = SealAppendBlobOptions()) const

Seals the append blob, making it read only. Any subsequent appends will fail.

Parameters
optionsOptional parameters to execute this function.
Returns
A SealAppendBlobResult describing the state of the sealed append blob.
166  {
167  BlobRestClient::AppendBlob::SealAppendBlobOptions protocolLayerOptions;
168  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
169  protocolLayerOptions.AppendPosition = options.AccessConditions.AppendPosition;
170  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
171  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
172  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
173  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
174  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
175  return BlobRestClient::AppendBlob::Seal(
176  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
177  }

◆ WithSnapshot()

AppendBlobClient Azure::Storage::Blobs::AppendBlobClient::WithSnapshot ( const std::string &  snapshot) const

Initializes a new instance of the AppendBlobClient class with an identical uri source but the specified snapshot timestamp.

Parameters
snapshotThe snapshot identifier.
Returns
A new AppendBlobClient instance.
Remarks
Pass empty string to remove the snapshot returning the base blob.
48  {
49  AppendBlobClient newClient(*this);
50  if (snapshot.empty())
51  {
52  newClient.m_blobUrl.RemoveQuery(Details::c_HttpQuerySnapshot);
53  }
54  else
55  {
56  newClient.m_blobUrl.AppendQuery(Details::c_HttpQuerySnapshot, snapshot);
57  }
58  return newClient;
59  }

◆ WithVersionId()

AppendBlobClient Azure::Storage::Blobs::AppendBlobClient::WithVersionId ( const std::string &  versionId) const

Creates a clone of this instance that references a version ID rather than the base blob.

Parameters
versionIdThe version ID returning a URL to the base blob.
Returns
A new AppendBlobClient instance.
Remarks
Pass empty string to remove the version ID returning the base blob.
62  {
63  AppendBlobClient newClient(*this);
64  if (versionId.empty())
65  {
66  newClient.m_blobUrl.RemoveQuery(Details::c_HttpQueryVersionId);
67  }
68  else
69  {
70  newClient.m_blobUrl.AppendQuery(Details::c_HttpQueryVersionId, versionId);
71  }
72  return newClient;
73  }

The documentation for this class was generated from the following files:
Azure::Storage::Blobs::BlobClient::CreateFromConnectionString
static BlobClient CreateFromConnectionString(const std::string &connectionString, const std::string &containerName, const std::string &blobName, const BlobClientOptions &options=BlobClientOptions())
Initialize a new instance of BlobClient.
Definition: blob_client.cpp:22
Azure::Storage::Blobs::AppendBlobClient::AppendBlobClient
AppendBlobClient(const std::string &blobUri, std::shared_ptr< SharedKeyCredential > credential, const AppendBlobClientOptions &options=AppendBlobClientOptions())
Initialize a new instance of AppendBlobClient.
Definition: append_blob_client.cpp:22