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

#include <page_blob_client.hpp>

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

Public Member Functions

 PageBlobClient (const std::string &blobUri, std::shared_ptr< SharedKeyCredential > credential, const PageBlobClientOptions &options=PageBlobClientOptions())
 Initialize a new instance of PageBlobClient. More...
 
 PageBlobClient (const std::string &blobUri, std::shared_ptr< Core::Credentials::ClientSecretCredential > credential, const PageBlobClientOptions &options=PageBlobClientOptions())
 Initialize a new instance of PageBlobClient. More...
 
 PageBlobClient (const std::string &blobUri, const PageBlobClientOptions &options=PageBlobClientOptions())
 Initialize a new instance of PageBlobClient. More...
 
PageBlobClient WithSnapshot (const std::string &snapshot) const
 Initializes a new instance of the PageBlobClient class with an identical uri source but the specified snapshot timestamp. More...
 
PageBlobClient 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< CreatePageBlobResultCreate (int64_t blobContentLength, const CreatePageBlobOptions &options=CreatePageBlobOptions()) const
 Creates a new page blob of the specified size. The content of any existing blob is overwritten with the newly initialized page blob. More...
 
Azure::Core::Response< UploadPageBlobPagesResultUploadPages (int64_t offset, Azure::Core::Http::BodyStream *content, const UploadPageBlobPagesOptions &options=UploadPageBlobPagesOptions()) const
 Writes content to a range of pages in a page blob, starting at offset. More...
 
Azure::Core::Response< UploadPageBlobPagesFromUriResultUploadPagesFromUri (int64_t destinationoffset, std::string sourceUri, int64_t sourceOffset, int64_t sourceLength, const UploadPageBlobPagesFromUriOptions &options=UploadPageBlobPagesFromUriOptions()) const
 Writes a range of pages to a page blob where the contents are read from a uri. More...
 
Azure::Core::Response< ClearPageBlobPagesResultClearPages (int64_t offset, int64_t length, const ClearPageBlobPagesOptions &options=ClearPageBlobPagesOptions()) const
 Clears one or more pages from the page blob, as specificed by offset and length. More...
 
Azure::Core::Response< ResizePageBlobResultResize (int64_t blobContentLength, const ResizePageBlobOptions &options=ResizePageBlobOptions()) const
 Resizes the page blob to the specified size (which must be a multiple of 512). If the specified value is less than the current size of the blob, then all pages above the specified value are cleared. More...
 
Azure::Core::Response< GetPageBlobPageRangesResultGetPageRanges (const GetPageBlobPageRangesOptions &options=GetPageBlobPageRangesOptions()) const
 Returns the list of valid page ranges for a page blob or snapshot of a page blob. More...
 
Azure::Core::Response< StartCopyPageBlobIncrementalResultStartCopyIncremental (const std::string &sourceUri, const StartCopyPageBlobIncrementalOptions &options=StartCopyPageBlobIncrementalOptions()) const
 Starts copying a snapshot of the sourceUri page blob to this page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. 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 PageBlobClient CreateFromConnectionString (const std::string &connectionString, const std::string &containerName, const std::string &blobName, const PageBlobClientOptions &options=PageBlobClientOptions())
 Initialize a new instance of PageBlobClient. 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 PageBlobClient allows you to manipulate Azure Storage page blobs.

Page blobs are a collection of 512-byte pages optimized for random read and write operations. To create a page blob, you initialize the page blob and specify the maximum size the page blob will grow. To add or update the contents of a page blob, you write a page or pages by specifying an offset and a range that align to 512-byte page boundaries. Writes to page blobs happen in-place and are immediately committed to the blob.

Constructor & Destructor Documentation

◆ PageBlobClient() [1/3]

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

Initialize a new instance of PageBlobClient.

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.
28  : BlobClient(blobUri, std::move(credential), options)
29  {
30  }

◆ PageBlobClient() [2/3]

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

Initialize a new instance of PageBlobClient.

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.
36  : BlobClient(blobUri, std::move(credential), options)
37  {
38  }

◆ PageBlobClient() [3/3]

Azure::Storage::Blobs::PageBlobClient::PageBlobClient ( const std::string &  blobUri,
const PageBlobClientOptions options = PageBlobClientOptions() 
)
explicit

Initialize a new instance of PageBlobClient.

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

◆ ClearPages()

Azure::Core::Response< ClearPageBlobPagesResult > Azure::Storage::Blobs::PageBlobClient::ClearPages ( int64_t  offset,
int64_t  length,
const ClearPageBlobPagesOptions options = ClearPageBlobPagesOptions() 
) const

Clears one or more pages from the page blob, as specificed by offset and length.

Parameters
offsetSpecifies the starting offset for the content to be cleared. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512.
lengthSpecifies the length of the content to be cleared. The length must be a modulus of 512.
optionsOptional parameters to execute this function.
Returns
A ClearPageBlobPagesResult describing the state of the updated pages.
164  {
165  BlobRestClient::PageBlob::ClearPageBlobPagesOptions protocolLayerOptions;
166  protocolLayerOptions.Range = std::make_pair(offset, offset + length - 1);
167  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
168  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
169  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
170  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
171  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
172  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
173  if (m_customerProvidedKey.HasValue())
174  {
175  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
176  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
177  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
178  }
179  protocolLayerOptions.EncryptionScope = m_encryptionScope;
180  return BlobRestClient::PageBlob::ClearPages(
181  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
182  }

◆ Create()

Azure::Core::Response< CreatePageBlobResult > Azure::Storage::Blobs::PageBlobClient::Create ( int64_t  blobContentLength,
const CreatePageBlobOptions options = CreatePageBlobOptions() 
) const

Creates a new page blob of the specified size. The content of any existing blob is overwritten with the newly initialized page blob.

Parameters
blobContentLengthSpecifies the maximum size for the page blob. The size must be aligned to a 512-byte boundary.
optionsOptional parameters to execute this function.
Returns
A CreatePageBlobResult describing the newly created page blob.
78  {
79  BlobRestClient::PageBlob::CreatePageBlobOptions protocolLayerOptions;
80  protocolLayerOptions.BlobContentLength = blobContentLength;
81  protocolLayerOptions.SequenceNumber = options.SequenceNumber;
82  protocolLayerOptions.HttpHeaders = options.HttpHeaders;
83  protocolLayerOptions.Metadata = options.Metadata;
84  protocolLayerOptions.Tier = options.Tier;
85  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
86  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
87  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
88  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
89  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
90  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
91  if (m_customerProvidedKey.HasValue())
92  {
93  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
94  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
95  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
96  }
97  protocolLayerOptions.EncryptionScope = m_encryptionScope;
98  return BlobRestClient::PageBlob::Create(
99  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
100  }

◆ CreateFromConnectionString()

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

Initialize a new instance of PageBlobClient.

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 PageBlobClient instance.
18  {
19  PageBlobClient newClient(
20  BlobClient::CreateFromConnectionString(connectionString, containerName, blobName, options));
21  return newClient;
22  }

◆ GetPageRanges()

Azure::Core::Response< GetPageBlobPageRangesResult > Azure::Storage::Blobs::PageBlobClient::GetPageRanges ( const GetPageBlobPageRangesOptions options = GetPageBlobPageRangesOptions()) const

Returns the list of valid page ranges for a page blob or snapshot of a page blob.

Parameters
optionsOptional parameters to execute this function.
Returns
A GetPageBlobPageRangesResult describing the valid page ranges for this blob.
209  {
210  BlobRestClient::PageBlob::GetPageBlobPageRangesOptions protocolLayerOptions;
211  protocolLayerOptions.PreviousSnapshot = options.PreviousSnapshot;
212  protocolLayerOptions.PreviousSnapshotUrl = options.PreviousSnapshotUrl;
213  if (options.Offset.HasValue() && options.Length.HasValue())
214  {
215  protocolLayerOptions.Range = std::make_pair(
216  options.Offset.GetValue(), options.Offset.GetValue() + options.Length.GetValue() - 1);
217  }
218  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
219  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
220  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
221  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
222  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
223  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
224  auto protocolLayerResponse = BlobRestClient::PageBlob::GetPageRanges(
225  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
226 
227  GetPageBlobPageRangesResult ret;
228  ret.ETag = std::move(protocolLayerResponse->ETag);
229  ret.LastModified = std::move(protocolLayerResponse->LastModified);
230  ret.BlobContentLength = protocolLayerResponse->BlobContentLength;
231  for (const auto& range : protocolLayerResponse->PageRanges)
232  {
233  ret.PageRanges.emplace_back(PageRange{range.first, range.second - range.first + 1});
234  }
235  for (const auto& range : protocolLayerResponse->ClearRanges)
236  {
237  ret.ClearRanges.emplace_back(PageRange{range.first, range.second - range.first + 1});
238  }
239  return Azure::Core::Response<GetPageBlobPageRangesResult>(
240  std::move(ret),
241  std::make_unique<Azure::Core::Http::RawResponse>(
242  std::move(protocolLayerResponse.GetRawResponse())));
243  }

◆ Resize()

Azure::Core::Response< ResizePageBlobResult > Azure::Storage::Blobs::PageBlobClient::Resize ( int64_t  blobContentLength,
const ResizePageBlobOptions options = ResizePageBlobOptions() 
) const

Resizes the page blob to the specified size (which must be a multiple of 512). If the specified value is less than the current size of the blob, then all pages above the specified value are cleared.

Parameters
blobContentLengthSpecifies the maximum size for the page blob. The size must be aligned to a 512-byte boundary.
optionsOptional parameters to execute this function.
Returns
A ResizePageBlobResult describing the resized page blob.
187  {
188  BlobRestClient::PageBlob::ResizePageBlobOptions protocolLayerOptions;
189  protocolLayerOptions.BlobContentLength = blobContentLength;
190  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
191  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
192  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
193  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
194  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
195  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
196  if (m_customerProvidedKey.HasValue())
197  {
198  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
199  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
200  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
201  }
202  protocolLayerOptions.EncryptionScope = m_encryptionScope;
203  return BlobRestClient::PageBlob::Resize(
204  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
205  }

◆ StartCopyIncremental()

Azure::Core::Response< StartCopyPageBlobIncrementalResult > Azure::Storage::Blobs::PageBlobClient::StartCopyIncremental ( const std::string &  sourceUri,
const StartCopyPageBlobIncrementalOptions options = StartCopyPageBlobIncrementalOptions() 
) const

Starts copying a snapshot of the sourceUri page blob to this page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual.

Parameters
sourceUriSpecifies the to the source page blob as a uri up to 2 KB in length. The source blob must either be public or must be authenticated via a shared access signature.
optionsOptional parameters to execute this function.
Returns
A StartCopyPageBlobIncrementalResult describing the state of the copy operation.
248  {
249  BlobRestClient::PageBlob::StartCopyPageBlobIncrementalOptions protocolLayerOptions;
250  protocolLayerOptions.CopySource = sourceUri;
251  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
252  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
253  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
254  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
255  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
256  return BlobRestClient::PageBlob::StartCopyIncremental(
257  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
258  }

◆ UploadPages()

Azure::Core::Response< UploadPageBlobPagesResult > Azure::Storage::Blobs::PageBlobClient::UploadPages ( int64_t  offset,
Azure::Core::Http::BodyStream *  content,
const UploadPageBlobPagesOptions options = UploadPageBlobPagesOptions() 
) const

Writes content to a range of pages in a page blob, starting at offset.

Parameters
offsetSpecifies the starting offset for the content to be written as a page. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512.
contentA BodyStream containing the content of the pages to upload.
optionsOptional parameters to execute this function.
Returns
A UploadPageBlobPagesResult describing the state of the updated pages.
106  {
107  BlobRestClient::PageBlob::UploadPageBlobPagesOptions protocolLayerOptions;
108  protocolLayerOptions.Range = std::make_pair(offset, offset + content->Length() - 1);
109  protocolLayerOptions.TransactionalContentMd5 = options.TransactionalContentMd5;
110  protocolLayerOptions.TransactionalContentCrc64 = options.TransactionalContentCrc64;
111  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
112  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
113  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
114  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
115  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
116  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
117  if (m_customerProvidedKey.HasValue())
118  {
119  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
120  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
121  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
122  }
123  protocolLayerOptions.EncryptionScope = m_encryptionScope;
124  return BlobRestClient::PageBlob::UploadPages(
125  options.Context, *m_pipeline, m_blobUrl, content, protocolLayerOptions);
126  }

◆ UploadPagesFromUri()

Azure::Core::Response< UploadPageBlobPagesFromUriResult > Azure::Storage::Blobs::PageBlobClient::UploadPagesFromUri ( int64_t  destinationoffset,
std::string  sourceUri,
int64_t  sourceOffset,
int64_t  sourceLength,
const UploadPageBlobPagesFromUriOptions options = UploadPageBlobPagesFromUriOptions() 
) const

Writes a range of pages to a page blob where the contents are read from a uri.

Parameters
destinationOffsetSpecifies the starting offset for the content to be written. Given that pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512.
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.
sourceOffsetOnly upload a part of the blob in the sourceUri from the specified offset. This offset doesn't need to be a modulus of 512.
sourceLengthOnly upload specified length of the blob in the sourceUri. This length must be a modulus of 512.
optionsOptional parameters to execute this function.
Returns
A UploadPageBlobPagesFromUriResult describing the state of the updated pages.
134  {
135  BlobRestClient::PageBlob::UploadPageBlobPagesFromUriOptions protocolLayerOptions;
136  protocolLayerOptions.SourceUri = sourceUri;
137  protocolLayerOptions.SourceRange
138  = std::make_pair(sourceOffset, sourceOffset + sourceLength - 1);
139  protocolLayerOptions.Range
140  = std::make_pair(destinationoffset, destinationoffset + sourceLength - 1);
141  protocolLayerOptions.TransactionalContentMd5 = options.TransactionalContentMd5;
142  protocolLayerOptions.TransactionalContentCrc64 = options.TransactionalContentCrc64;
143  protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
144  protocolLayerOptions.IfModifiedSince = options.AccessConditions.IfModifiedSince;
145  protocolLayerOptions.IfUnmodifiedSince = options.AccessConditions.IfUnmodifiedSince;
146  protocolLayerOptions.IfMatch = options.AccessConditions.IfMatch;
147  protocolLayerOptions.IfNoneMatch = options.AccessConditions.IfNoneMatch;
148  protocolLayerOptions.IfTags = options.AccessConditions.TagConditions;
149  if (m_customerProvidedKey.HasValue())
150  {
151  protocolLayerOptions.EncryptionKey = m_customerProvidedKey.GetValue().Key;
152  protocolLayerOptions.EncryptionKeySha256 = m_customerProvidedKey.GetValue().KeyHash;
153  protocolLayerOptions.EncryptionAlgorithm = m_customerProvidedKey.GetValue().Algorithm;
154  }
155  protocolLayerOptions.EncryptionScope = m_encryptionScope;
156  return BlobRestClient::PageBlob::UploadPagesFromUri(
157  options.Context, *m_pipeline, m_blobUrl, protocolLayerOptions);
158  }

◆ WithSnapshot()

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

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

Parameters
snapshotThe snapshot identifier.
Returns
A new PageBlobClient instance.
Remarks
Pass empty string to remove the snapshot returning the base blob.
48  {
49  PageBlobClient 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()

PageBlobClient Azure::Storage::Blobs::PageBlobClient::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 PageBlobClient instance.
Remarks
Pass empty string to remove the version ID returning the base blob.
62  {
63  PageBlobClient 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::PageBlobClient::PageBlobClient
PageBlobClient(const std::string &blobUri, std::shared_ptr< SharedKeyCredential > credential, const PageBlobClientOptions &options=PageBlobClientOptions())
Initialize a new instance of PageBlobClient.
Definition: page_blob_client.cpp:24