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

The BlockBlobClient allows you to manipulate Azure Storage block blobs. More...

#include <block_blob_client.hpp>

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

Public Member Functions

 BlockBlobClient (const std::string &blobUrl, std::shared_ptr< StorageSharedKeyCredential > credential, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlockBlobClient. More...
 
 BlockBlobClient (const std::string &blobUrl, std::shared_ptr< Core::Credentials::TokenCredential > credential, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlockBlobClient. More...
 
 BlockBlobClient (const std::string &blobUrl, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlockBlobClient. More...
 
BlockBlobClient WithSnapshot (const std::string &snapshot) const
 Initializes a new instance of the BlockBlobClient class with an identical URL source but the specified snapshot timestamp. More...
 
BlockBlobClient WithVersionId (const std::string &versionId) const
 Creates a clone of this instance that references a version ID rather than the base blob. More...
 
Azure::Response< Models::UploadBlockBlobResultUpload (Azure::Core::IO::BodyStream &content, const UploadBlockBlobOptions &options=UploadBlockBlobOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. More...
 
Azure::Response< Models::UploadBlockBlobFromResultUploadFrom (const uint8_t *buffer, size_t bufferSize, const UploadBlockBlobFromOptions &options=UploadBlockBlobFromOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. More...
 
Azure::Response< Models::UploadBlockBlobFromResultUploadFrom (const std::string &fileName, const UploadBlockBlobFromOptions &options=UploadBlockBlobFromOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. More...
 
Azure::Response< Models::StageBlockResultStageBlock (const std::string &blockId, Azure::Core::IO::BodyStream &content, const StageBlockOptions &options=StageBlockOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Creates a new block as part of a block blob's staging area to be eventually committed via the CommitBlockList operation. More...
 
Azure::Response< Models::StageBlockFromUriResultStageBlockFromUri (const std::string &blockId, const std::string &sourceUri, const StageBlockFromUriOptions &options=StageBlockFromUriOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Creates a new block to be committed as part of a blob where the contents are read from the sourceUri. More...
 
Azure::Response< Models::CommitBlockListResultCommitBlockList (const std::vector< std::string > &blockIds, const CommitBlockListOptions &options=CommitBlockListOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior StageBlock operation. You can call CommitBlockList to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. More...
 
Azure::Response< Models::GetBlockListResultGetBlockList (const GetBlockListOptions &options=GetBlockListOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Retrieves the list of blocks that have been uploaded as part of a block blob. There are two block lists maintained for a blob. The Committed Block list has blocks that have been successfully committed to a given blob with CommitBlockList. The Uncommitted Block list has blocks that have been uploaded for a blob using StageBlock, but that have not yet been committed. More...
 
- Public Member Functions inherited from Azure::Storage::Blobs::BlobClient
virtual ~BlobClient ()=default
 Destructor. More...
 
 BlobClient (const std::string &blobUrl, std::shared_ptr< StorageSharedKeyCredential > credential, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlobClient. More...
 
 BlobClient (const std::string &blobUrl, std::shared_ptr< Core::Credentials::TokenCredential > credential, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlobClient. More...
 
 BlobClient (const std::string &blobUrl, const BlobClientOptions &options=BlobClientOptions())
 Initialize a new instance of BlobClient. More...
 
BlockBlobClient AsBlockBlobClient () const
 Creates a new BlockBlobClient object with the same URL as this BlobClient. The new BlockBlobClient uses the same request policy pipeline as this BlobClient. More...
 
AppendBlobClient AsAppendBlobClient () const
 Creates a new AppendBlobClient object with the same URL as this BlobClient. The new AppendBlobClient uses the same request policy pipeline as this BlobClient. More...
 
PageBlobClient AsPageBlobClient () const
 Creates a new PageBlobClient object with the same URL as this BlobClient. The new PageBlobClient uses the same request policy pipeline as this BlobClient. More...
 
std::string GetUrl () const
 Gets the blob's primary URL endpoint. More...
 
BlobClient WithSnapshot (const std::string &snapshot) const
 Initializes a new instance of the BlobClient class with an identical URL 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::Response< Models::BlobPropertiesGetProperties (const GetBlobPropertiesOptions &options=GetBlobPropertiesOptions(), const Azure::Core::Context &context=Azure::Core::Context()) 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::Response< Models::SetBlobHttpHeadersResultSetHttpHeaders (Models::BlobHttpHeaders httpHeaders, const SetBlobHttpHeadersOptions &options=SetBlobHttpHeadersOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Sets system properties on the blob. More...
 
Azure::Response< Models::SetBlobMetadataResultSetMetadata (Metadata metadata, const SetBlobMetadataOptions &options=SetBlobMetadataOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Sets user-defined metadata for the specified blob as one or more name-value pairs. More...
 
Azure::Response< Models::SetBlobAccessTierResultSetAccessTier (Models::AccessTier accessTier, const SetBlobAccessTierOptions &options=SetBlobAccessTierOptions(), const Azure::Core::Context &context=Azure::Core::Context()) 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...
 
StartBlobCopyOperation StartCopyFromUri (const std::string &sourceUri, const StartBlobCopyFromUriOptions &options=StartBlobCopyFromUriOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Copies data at from the source to this blob. More...
 
Azure::Response< Models::AbortBlobCopyFromUriResultAbortCopyFromUri (const std::string &copyId, const AbortBlobCopyFromUriOptions &options=AbortBlobCopyFromUriOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Aborts a pending StartCopyFromUri operation, and leaves this blob with zero length and full metadata. More...
 
Azure::Response< Models::DownloadBlobResultDownload (const DownloadBlobOptions &options=DownloadBlobOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Downloads a blob or a blob range from the service, including its metadata and properties. More...
 
Azure::Response< Models::DownloadBlobToResultDownloadTo (uint8_t *buffer, size_t bufferSize, const DownloadBlobToOptions &options=DownloadBlobToOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Downloads a blob or a blob range from the service to a memory buffer using parallel requests. More...
 
Azure::Response< Models::DownloadBlobToResultDownloadTo (const std::string &fileName, const DownloadBlobToOptions &options=DownloadBlobToOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Downloads a blob or a blob range from the service to a file using parallel requests. More...
 
Azure::Response< Models::CreateBlobSnapshotResultCreateSnapshot (const CreateBlobSnapshotOptions &options=CreateBlobSnapshotOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Creates a read-only snapshot of a blob. More...
 
Azure::Response< Models::DeleteBlobResultDelete (const DeleteBlobOptions &options=DeleteBlobOptions(), const Azure::Core::Context &context=Azure::Core::Context()) 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::Response< Models::DeleteBlobResultDeleteIfExists (const DeleteBlobOptions &options=DeleteBlobOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Marks the specified blob or snapshot for deletion if it exists. More...
 
Azure::Response< Models::UndeleteBlobResultUndelete (const UndeleteBlobOptions &options=UndeleteBlobOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Restores the contents and metadata of a soft deleted blob and any associated soft deleted snapshots. More...
 
Azure::Response< Models::SetBlobTagsResultSetTags (std::map< std::string, std::string > tags, const SetBlobTagsOptions &options=SetBlobTagsOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Sets tags on the underlying blob. More...
 
Azure::Response< std::map< std::string, std::string > > GetTags (const GetBlobTagsOptions &options=GetBlobTagsOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
 Gets the tags associated with the underlying blob. More...
 

Static Public Member Functions

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

Friends

class BlobClient
 
class Files::DataLake::DataLakeFileClient
 

Additional Inherited Members

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

Detailed Description

Block blobs let you upload large blobs efficiently. Block blobs are comprised of blocks, each of which is identified by a block ID. You create or modify a block blob by writing a set of blocks and committing them by their block IDs. Each block can be a different size.

When you upload a block to a blob in your storage account, it is associated with the specified block blob, but it does not become part of the blob until you commit a list of blocks that includes the new block's ID. New blocks remain in an uncommitted state until they are specifically committed or discarded. Writing a block does not update the last modified time of an existing blob.

Constructor & Destructor Documentation

◆ BlockBlobClient() [1/3]

Azure::Storage::Blobs::BlockBlobClient::BlockBlobClient ( const std::string &  blobUrl,
std::shared_ptr< StorageSharedKeyCredential >  credential,
const BlobClientOptions options = BlobClientOptions() 
)
explicit
Parameters
blobUrlA URL 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.

◆ BlockBlobClient() [2/3]

Azure::Storage::Blobs::BlockBlobClient::BlockBlobClient ( const std::string &  blobUrl,
std::shared_ptr< Core::Credentials::TokenCredential >  credential,
const BlobClientOptions options = BlobClientOptions() 
)
explicit
Parameters
blobUrlA URL referencing the blob that includes the name of the account, the name of the container, and the name of the blob.
credentialThe token credential used to sign requests.
optionsOptional client options that define the transport pipeline policies for authentication, retries, etc., that are applied to every request.

◆ BlockBlobClient() [3/3]

Azure::Storage::Blobs::BlockBlobClient::BlockBlobClient ( const std::string &  blobUrl,
const BlobClientOptions options = BlobClientOptions() 
)
explicit
Parameters
blobUrlA URL 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.

Member Function Documentation

◆ CommitBlockList()

Azure::Response< Models::CommitBlockListResult > Azure::Storage::Blobs::BlockBlobClient::CommitBlockList ( const std::vector< std::string > &  blockIds,
const CommitBlockListOptions options = CommitBlockListOptions(),
const Azure::Core::Context &  context = Azure::Core::Context() 
) const
Parameters
blockIdsBase64 encoded block IDs to indicate that make up the blob.
optionsOptional parameters to execute this function.
contextContext for cancelling long running operations.
Returns
A CommitBlobBlockListResult describing the state of the updated block blob.

◆ CreateFromConnectionString()

BlockBlobClient Azure::Storage::Blobs::BlockBlobClient::CreateFromConnectionString ( const std::string &  connectionString,
const std::string &  blobContainerName,
const std::string &  blobName,
const BlobClientOptions options = BlobClientOptions() 
)
static
Parameters
connectionStringA connection string includes the authentication information required for your application to access data in an Azure Storage account at runtime.
blobContainerNameThe 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 BlockBlobClient instance.

◆ GetBlockList()

Azure::Response< Models::GetBlockListResult > Azure::Storage::Blobs::BlockBlobClient::GetBlockList ( const GetBlockListOptions options = GetBlockListOptions(),
const Azure::Core::Context &  context = Azure::Core::Context() 
) const
Parameters
optionsOptional parameters to execute this function.
contextContext for cancelling long running operations.
Returns
A GetBlobBlockListResult describing requested block list.

◆ StageBlock()

Azure::Response< Models::StageBlockResult > Azure::Storage::Blobs::BlockBlobClient::StageBlock ( const std::string &  blockId,
Azure::Core::IO::BodyStream &  content,
const StageBlockOptions options = StageBlockOptions(),
const Azure::Core::Context &  context = Azure::Core::Context() 
) const
Parameters
blockIdA valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size.
contentA BodyStream containing the content to upload.
optionsOptional parameters to execute this function.
contextContext for cancelling long running operations.
Returns
A StageBlockResult describing the state of the updated block.

◆ StageBlockFromUri()

Azure::Response< Models::StageBlockFromUriResult > Azure::Storage::Blobs::BlockBlobClient::StageBlockFromUri ( const std::string &  blockId,
const std::string &  sourceUri,
const StageBlockFromUriOptions options = StageBlockFromUriOptions(),
const Azure::Core::Context &  context = Azure::Core::Context() 
) const
Parameters
blockIdA valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size.
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.
contextContext for cancelling long running operations.
Returns
A StageBlockFromUriResult describing the state of the updated block blob.

◆ Upload()

Azure::Response< Models::UploadBlockBlobResult > Azure::Storage::Blobs::BlockBlobClient::Upload ( Azure::Core::IO::BodyStream &  content,
const UploadBlockBlobOptions options = UploadBlockBlobOptions(),
const Azure::Core::Context &  context = Azure::Core::Context() 
) const
Parameters
contentA BodyStream containing the content to upload.
optionsOptional parameters to execute this function.
contextContext for cancelling long running operations.
Returns
A UploadBlockBlobResult describing the state of the updated block blob.

◆ UploadFrom() [1/2]

Azure::Response< Models::UploadBlockBlobFromResult > Azure::Storage::Blobs::BlockBlobClient::UploadFrom ( const std::string &  fileName,
const UploadBlockBlobFromOptions options = UploadBlockBlobFromOptions(),
const Azure::Core::Context &  context = Azure::Core::Context() 
) const
Parameters
fileNameA file containing the content to upload.
optionsOptional parameters to execute this function.
contextContext for cancelling long running operations.
Returns
A UploadBlockBlobFromResult describing the state of the updated block blob.

◆ UploadFrom() [2/2]

Azure::Response< Models::UploadBlockBlobFromResult > Azure::Storage::Blobs::BlockBlobClient::UploadFrom ( const uint8_t *  buffer,
size_t  bufferSize,
const UploadBlockBlobFromOptions options = UploadBlockBlobFromOptions(),
const Azure::Core::Context &  context = Azure::Core::Context() 
) const
Parameters
bufferA memory buffer containing the content to upload.
bufferSizeSize of the memory buffer.
optionsOptional parameters to execute this function.
contextContext for cancelling long running operations.
Returns
A UploadBlockBlobFromResult describing the state of the updated block blob.

◆ WithSnapshot()

BlockBlobClient Azure::Storage::Blobs::BlockBlobClient::WithSnapshot ( const std::string &  snapshot) const
Parameters
snapshotThe snapshot identifier.
Returns
A new BlockBlobClient instance.
Remarks
Pass empty string to remove the snapshot returning the base blob.

◆ WithVersionId()

BlockBlobClient Azure::Storage::Blobs::BlockBlobClient::WithVersionId ( const std::string &  versionId) const
Parameters
versionIdThe version ID returning a URL to the base blob.
Returns
A new BlockBlobClient instance.
Remarks
Pass empty string to remove the version ID returning the base blob.

The documentation for this class was generated from the following files: