Skip to content

Commit

Permalink
adding code snippets for pageBlobAsyncClient
Browse files Browse the repository at this point in the history
  • Loading branch information
vhvb1989 committed Sep 23, 2019
1 parent 6c80488 commit 778492b
Show file tree
Hide file tree
Showing 3 changed files with 425 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public final class PageBlobAsyncClient extends BlobAsyncClient {
* information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/put-blob">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.setCreate#long}
*
* @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a
* 512-byte boundary.
* @return A reactive response containing the information of the created page blob.
Expand All @@ -96,6 +100,10 @@ public Mono<PageBlobItem> setCreate(long size) {
* information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/put-blob">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.createWithResponse#long-Long-BlobHTTPHeaders-Metadata-BlobAccessConditions}
*
* @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a
* 512-byte boundary.
* @param sequenceNumber A user-controlled value that you can use to track requests. The value of the sequence
Expand Down Expand Up @@ -145,6 +153,10 @@ Mono<Response<PageBlobItem>> createWithResponse(long size, Long sequenceNumber,
* Note that the data passed must be replayable if retries are enabled (the default). In other words, the
* {@code Flux} must produce the same data each time it is subscribed to.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.uploadPages#PageRange-Flux}
*
* @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start
* offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges
* are 0-511, 512-1023, etc.
Expand All @@ -164,6 +176,10 @@ public Mono<PageBlobItem> uploadPages(PageRange pageRange, Flux<ByteBuffer> body
* Note that the data passed must be replayable if retries are enabled (the default). In other words, the
* {@code Flux} must produce the same data each time it is subscribed to.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.uploadPagesWithResponse#PageRange-Flux-PageBlobAccessConditions}
*
* @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start
* offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges
* are 0-511, 512-1023, etc.
Expand Down Expand Up @@ -203,7 +219,10 @@ Mono<Response<PageBlobItem>> uploadPagesWithResponse(PageRange pageRange, Flux<B
* Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple
* of 512. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/put-page">Azure Docs</a>.
* <p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.uploadPagesFromURL#PageRange-URL-Long}
*
* @param range A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start
* offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges
Expand All @@ -225,7 +244,10 @@ public Mono<PageBlobItem> uploadPagesFromURL(PageRange range, URL sourceURL, Lon
* Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple
* of 512. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/put-page">Azure Docs</a>.
* <p>
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.uploadPagesFromURLWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions}
*
* @param range The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries,
* the start offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte
Expand Down Expand Up @@ -282,6 +304,10 @@ Mono<Response<PageBlobItem>> uploadPagesFromURLWithResponse(PageRange range, URL
* Frees the specified pages from the page blob. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/put-page">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.clearPages#PageRange}
*
* @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start
* offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges
* are 0-511, 512-1023, etc.
Expand All @@ -295,6 +321,10 @@ public Mono<PageBlobItem> clearPages(PageRange pageRange) {
* Frees the specified pages from the page blob. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/put-page">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.clearPagesWithResponse#PageRange-PageBlobAccessConditions}
*
* @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start
* offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges
* are 0-511, 512-1023, etc.
Expand Down Expand Up @@ -333,6 +363,10 @@ Mono<Response<PageBlobItem>> clearPagesWithResponse(PageRange pageRange,
* Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/get-page-ranges">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.getPageRanges#BlobRange}
*
* @param blobRange {@link BlobRange}
* @return A reactive response containing the information of the cleared pages.
*/
Expand All @@ -344,6 +378,10 @@ public Mono<PageList> getPageRanges(BlobRange blobRange) {
* Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/get-page-ranges">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.getPageRangesWithResponse#BlobRange-BlobAccessConditions}
*
* @param blobRange {@link BlobRange}
* @param accessConditions {@link BlobAccessConditions}
* @return A reactive response emitting all the page ranges.
Expand All @@ -369,6 +407,10 @@ Mono<Response<PageList>> getPageRangesWithResponse(BlobRange blobRange, BlobAcce
* information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/get-page-ranges">Azure
* Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.getPageRangesDiff#BlobRange-String}
*
* @param blobRange {@link BlobRange}
* @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and
* previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as
Expand All @@ -384,6 +426,10 @@ public Mono<PageList> getPageRangesDiff(BlobRange blobRange, String prevSnapshot
* information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/get-page-ranges">Azure
* Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.getPageRangesDiffWithResponse#BlobRange-String-BlobAccessConditions}
*
* @param blobRange {@link BlobRange}
* @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and
* previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as
Expand Down Expand Up @@ -418,6 +464,10 @@ Mono<Response<PageList>> getPageRangesDiffWithResponse(BlobRange blobRange, Stri
* Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the <a
* href="https://docs.microsoft.com/rest/api/storageservices/set-blob-properties">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.resize#long}
*
* @param size Resizes a page blob to the specified size. If the specified value is less than the current size of
* the blob, then all pages above the specified value are cleared.
* @return A reactive response emitting the resized page blob.
Expand All @@ -430,6 +480,10 @@ public Mono<PageBlobItem> resize(long size) {
* Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the <a
* href="https://docs.microsoft.com/rest/api/storageservices/set-blob-properties">Azure Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.resizeWithResponse#long-BlobAccessConditions}
*
* @param size Resizes a page blob to the specified size. If the specified value is less than the current size of
* the blob, then all pages above the specified value are cleared.
* @param accessConditions {@link BlobAccessConditions}
Expand Down Expand Up @@ -459,6 +513,10 @@ Mono<Response<PageBlobItem>> resizeWithResponse(long size, BlobAccessConditions
* Sets the page blob's sequence number. For more information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/set-blob-properties">Azure
* Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.updateSequenceNumber#SequenceNumberActionType-Long}
*
* @param action Indicates how the service should modify the blob's sequence number.
* @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can
* use to track requests and manage concurrency issues.
Expand All @@ -472,6 +530,10 @@ public Mono<PageBlobItem> updateSequenceNumber(SequenceNumberActionType action,
* Sets the page blob's sequence number. For more information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/set-blob-properties">Azure
* Docs</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.updateSequenceNumberWithResponse#SequenceNumberActionType-Long-BlobAccessConditions}
*
* @param action Indicates how the service should modify the blob's sequence number.
* @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can
* use to track requests and manage concurrency issues.
Expand Down Expand Up @@ -511,6 +573,10 @@ Mono<Response<PageBlobItem>> updateSequenceNumberWithResponse(SequenceNumberActi
* and
* <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/windows/incremental-snapshots">here</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.copyIncremental#URL-String}
*
* @param source The source page blob.
* @param snapshot The snapshot on the copy source.
* @return A reactive response emitting the copy status.
Expand All @@ -527,6 +593,10 @@ public Mono<CopyStatusType> copyIncremental(URL source, String snapshot) {
* and
* <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/windows/incremental-snapshots">here</a>.
*
* <p><strong>Code Samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.PageBlobAsyncClient.copyIncrementalWithResponse#URL-String-ModifiedAccessConditions}
*
* @param source The source page blob.
* @param snapshot The snapshot on the copy source.
* @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ static PageBlobClient getPageBlobClient(String blobName, String containerName) {
.buildPageBlobClient();
}

static PageBlobAsyncClient getPageBlobAsyncClient(String blobName, String containerName) {
return new BlobClientBuilder()
.blobName(blobName)
.containerName(containerName)
.buildPageBlobAsyncClient();
}

static BlobServiceAsyncClient getBlobServiceAsyncClient() {
return new BlobServiceClientBuilder().buildAsyncClient();
}
Expand Down
Loading

0 comments on commit 778492b

Please sign in to comment.