Skip to content

Commit

Permalink
Transition Storage SDKs to New Codesnippet Tooling (Azure#25346)
Browse files Browse the repository at this point in the history
Transition Storage SDKs to New Codesnippet Tooling
  • Loading branch information
alzimmermsft authored and rickle-msft committed Jan 13, 2022
1 parent 19df17d commit a4293d7
Show file tree
Hide file tree
Showing 76 changed files with 12,634 additions and 1,445 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,17 @@
* <p>Azure Storage Blob batches are homogeneous which means a {@link #deleteBlob(String) delete} and {@link
* #setBlobAccessTier(String, AccessTier) set tier} are not allowed to be in the same batch.</p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.illegalBatchOperation}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.illegalBatchOperation -->
* <pre>
* try &#123;
* Response&lt;Void&gt; deleteResponse = batch.deleteBlob&#40;&quot;&#123;url of blob&#125;&quot;&#41;;
* Response&lt;Void&gt; setTierResponse = batch.setBlobAccessTier&#40;&quot;&#123;url of another blob&#125;&quot;, AccessTier.HOT&#41;;
* &#125; catch &#40;UnsupportedOperationException ex&#41; &#123;
* System.err.printf&#40;&quot;This will fail as Azure Storage Blob batch operations are homogeneous. Exception: %s%n&quot;,
* ex.getMessage&#40;&#41;&#41;;
* &#125;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.illegalBatchOperation -->
*
* <p>Please refer to the <a href="https://docs.microsoft.com/rest/api/storageservices/blob-batch">Azure Docs</a>
* for more information.</p>
Expand Down Expand Up @@ -109,7 +119,11 @@ public final class BlobBatch {
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-String}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-String -->
* <pre>
* Response&lt;Void&gt; deleteResponse = batch.deleteBlob&#40;&quot;&#123;container name&#125;&quot;, &quot;&#123;blob name&#125;&quot;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-String -->
*
* @param containerName The container of the blob.
* @param blobName The name of the blob.
Expand All @@ -127,7 +141,14 @@ public Response<Void> deleteBlob(String containerName, String blobName) {
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-String-DeleteSnapshotsOptionType-BlobRequestConditions}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-String-DeleteSnapshotsOptionType-BlobRequestConditions -->
* <pre>
* BlobRequestConditions blobRequestConditions = new BlobRequestConditions&#40;&#41;.setLeaseId&#40;&quot;&#123;lease ID&#125;&quot;&#41;;
*
* Response&lt;Void&gt; deleteResponse = batch.deleteBlob&#40;&quot;&#123;container name&#125;&quot;, &quot;&#123;blob name&#125;&quot;,
* DeleteSnapshotsOptionType.INCLUDE, blobRequestConditions&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-String-DeleteSnapshotsOptionType-BlobRequestConditions -->
*
* @param containerName The container of the blob.
* @param blobName The name of the blob.
Expand All @@ -148,7 +169,11 @@ public Response<Void> deleteBlob(String containerName, String blobName,
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.deleteBlob#String}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.deleteBlob#String -->
* <pre>
* Response&lt;Void&gt; deleteResponse = batch.deleteBlob&#40;&quot;&#123;url of blob&#125;&quot;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.deleteBlob#String -->
*
* @param blobUrl URL of the blob. Blob name must be encoded to UTF-8.
* @return a {@link Response} that will be used to associate this operation to the response when the batch is
Expand All @@ -164,7 +189,14 @@ public Response<Void> deleteBlob(String blobUrl) {
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-DeleteSnapshotsOptionType-BlobRequestConditions}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-DeleteSnapshotsOptionType-BlobRequestConditions -->
* <pre>
* BlobRequestConditions blobRequestConditions = new BlobRequestConditions&#40;&#41;.setLeaseId&#40;&quot;&#123;lease ID&#125;&quot;&#41;;
*
* Response&lt;Void&gt; deleteResponse = batch.deleteBlob&#40;&quot;&#123;url of blob&#125;&quot;, DeleteSnapshotsOptionType.INCLUDE,
* blobRequestConditions&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.deleteBlob#String-DeleteSnapshotsOptionType-BlobRequestConditions -->
*
* @param blobUrl URL of the blob. Blob name must be encoded to UTF-8.
* @param deleteOptions Delete options for the blob and its snapshots.
Expand All @@ -190,7 +222,11 @@ private Response<Void> deleteBlobHelper(String urlPath, DeleteSnapshotsOptionTyp
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-String-AccessTier}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-String-AccessTier -->
* <pre>
* Response&lt;Void&gt; setTierResponse = batch.setBlobAccessTier&#40;&quot;&#123;container name&#125;&quot;, &quot;&#123;blob name&#125;&quot;, AccessTier.HOT&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-String-AccessTier -->
*
* @param containerName The container of the blob.
* @param blobName The name of the blob.
Expand All @@ -209,7 +245,12 @@ public Response<Void> setBlobAccessTier(String containerName, String blobName, A
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-String-AccessTier-String}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-String-AccessTier-String -->
* <pre>
* Response&lt;Void&gt; setTierResponse = batch.setBlobAccessTier&#40;&quot;&#123;container name&#125;&quot;, &quot;&#123;blob name&#125;&quot;, AccessTier.HOT,
* &quot;&#123;lease ID&#125;&quot;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-String-AccessTier-String -->
*
* @param containerName The container of the blob.
* @param blobName The name of the blob.
Expand All @@ -230,7 +271,11 @@ public Response<Void> setBlobAccessTier(String containerName, String blobName, A
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-AccessTier}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-AccessTier -->
* <pre>
* Response&lt;Void&gt; setTierResponse = batch.setBlobAccessTier&#40;&quot;&#123;url of blob&#125;&quot;, AccessTier.HOT&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-AccessTier -->
*
* @param blobUrl URL of the blob. Blob name must be encoded to UTF-8.
* @param accessTier The tier to set on the blob.
Expand All @@ -247,7 +292,11 @@ public Response<Void> setBlobAccessTier(String blobUrl, AccessTier accessTier) {
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-AccessTier-String}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-AccessTier-String -->
* <pre>
* Response&lt;Void&gt; setTierResponse = batch.setBlobAccessTier&#40;&quot;&#123;url of blob&#125;&quot;, AccessTier.HOT, &quot;&#123;lease ID&#125;&quot;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#String-AccessTier-String -->
*
* @param blobUrl URL of the blob. Blob name must be encoded to UTF-8.
* @param accessTier The tier to set on the blob.
Expand All @@ -265,7 +314,12 @@ public Response<Void> setBlobAccessTier(String blobUrl, AccessTier accessTier, S
*
* <p><strong>Code sample</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#BlobBatchSetBlobAccessTierOptions}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#BlobBatchSetBlobAccessTierOptions -->
* <pre>
* Response&lt;Void&gt; setTierResponse = batch.setBlobAccessTier&#40;
* new BlobBatchSetBlobAccessTierOptions&#40;&quot;&#123;url of blob&#125;&quot;, AccessTier.HOT&#41;.setLeaseId&#40;&quot;&#123;lease ID&#125;&quot;&#41;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatch.setBlobAccessTier#BlobBatchSetBlobAccessTierOptions -->
*
* @param options {@link BlobBatchSetBlobAccessTierOptions}
* @return a {@link Response} that will be used to associate this operation to the response when the batch is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,21 @@ public BlobBatch getBlobBatch() {
*
* <p><strong>Code samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatchAsyncClient.submitBatch#BlobBatch}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatchAsyncClient.submitBatch#BlobBatch -->
* <pre>
* BlobBatch batch = batchAsyncClient.getBlobBatch&#40;&#41;;
*
* Response&lt;Void&gt; deleteResponse1 = batch.deleteBlob&#40;&quot;container&quot;, &quot;blob1&quot;&#41;;
* Response&lt;Void&gt; deleteResponse2 = batch.deleteBlob&#40;&quot;container&quot;, &quot;blob2&quot;, DeleteSnapshotsOptionType.INCLUDE,
* new BlobRequestConditions&#40;&#41;.setLeaseId&#40;&quot;leaseId&quot;&#41;&#41;;
*
* batchAsyncClient.submitBatch&#40;batch&#41;.subscribe&#40;response -&gt; &#123;
* System.out.println&#40;&quot;Batch submission completed successfully.&quot;&#41;;
* System.out.printf&#40;&quot;Delete operation 1 completed with status code: %d%n&quot;, deleteResponse1.getStatusCode&#40;&#41;&#41;;
* System.out.printf&#40;&quot;Delete operation 2 completed with status code: %d%n&quot;, deleteResponse2.getStatusCode&#40;&#41;&#41;;
* &#125;, error -&gt; System.err.printf&#40;&quot;Batch submission failed. Error message: %s%n&quot;, error.getMessage&#40;&#41;&#41;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatchAsyncClient.submitBatch#BlobBatch -->
*
* @param batch Batch to submit.
* @return An empty response indicating that the batch operation has completed.
Expand All @@ -104,7 +118,21 @@ public Mono<Void> submitBatch(BlobBatch batch) {
*
* <p><strong>Code samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatchAsyncClient.submitBatch#BlobBatch-boolean}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatchAsyncClient.submitBatch#BlobBatch-boolean -->
* <pre>
* BlobBatch batch = batchAsyncClient.getBlobBatch&#40;&#41;;
*
* Response&lt;Void&gt; deleteResponse1 = batch.deleteBlob&#40;&quot;container&quot;, &quot;blob1&quot;&#41;;
* Response&lt;Void&gt; deleteResponse2 = batch.deleteBlob&#40;&quot;container&quot;, &quot;blob2&quot;, DeleteSnapshotsOptionType.INCLUDE,
* new BlobRequestConditions&#40;&#41;.setLeaseId&#40;&quot;leaseId&quot;&#41;&#41;;
*
* batchAsyncClient.submitBatchWithResponse&#40;batch, true&#41;.subscribe&#40;response -&gt; &#123;
* System.out.printf&#40;&quot;Batch submission completed with status code: %d%n&quot;, response.getStatusCode&#40;&#41;&#41;;
* System.out.printf&#40;&quot;Delete operation 1 completed with status code: %d%n&quot;, deleteResponse1.getStatusCode&#40;&#41;&#41;;
* System.out.printf&#40;&quot;Delete operation 2 completed with status code: %d%n&quot;, deleteResponse2.getStatusCode&#40;&#41;&#41;;
* &#125;, error -&gt; System.err.printf&#40;&quot;Batch submission failed. Error message: %s%n&quot;, error.getMessage&#40;&#41;&#41;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatchAsyncClient.submitBatch#BlobBatch-boolean -->
*
* @param batch Batch to submit.
* @param throwOnAnyFailure Flag to indicate if an exception should be thrown if any request in the batch fails.
Expand Down Expand Up @@ -146,7 +174,19 @@ Mono<Response<Void>> submitBatchWithResponse(BlobBatch batch, boolean throwOnAny
*
* <p><strong>Code samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatchAsyncClient.deleteBlobs#List-DeleteSnapshotsOptionType}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatchAsyncClient.deleteBlobs#List-DeleteSnapshotsOptionType -->
* <pre>
* List&lt;String&gt; blobUrls = new ArrayList&lt;&gt;&#40;&#41;;
* blobUrls.add&#40;blobClient1.getBlobUrl&#40;&#41;&#41;;
* blobUrls.add&#40;blobClient2.getBlobUrl&#40;&#41;&#41;;
* blobUrls.add&#40;blobClient3.getBlobUrl&#40;&#41;&#41;;
*
* batchAsyncClient.deleteBlobs&#40;blobUrls, DeleteSnapshotsOptionType.INCLUDE&#41;.subscribe&#40;response -&gt;
* System.out.printf&#40;&quot;Deleting blob with URL %s completed with status code %d%n&quot;,
* response.getRequest&#40;&#41;.getUrl&#40;&#41;, response.getStatusCode&#40;&#41;&#41;,
* error -&gt; System.err.printf&#40;&quot;Deleting blob failed with exception: %s%n&quot;, error.getMessage&#40;&#41;&#41;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatchAsyncClient.deleteBlobs#List-DeleteSnapshotsOptionType -->
*
* @param blobUrls Urls of the blobs to delete. Blob names must be encoded to UTF-8.
* @param deleteOptions The deletion option for all blobs.
Expand Down Expand Up @@ -180,7 +220,19 @@ private Mono<PagedResponse<Response<Void>>> submitDeleteBlobsBatch(List<String>
*
* <p><strong>Code samples</strong></p>
*
* {@codesnippet com.azure.storage.blob.batch.BlobBatchAsyncClient.setBlobsAccessTier#List-AccessTier}
* <!-- src_embed com.azure.storage.blob.batch.BlobBatchAsyncClient.setBlobsAccessTier#List-AccessTier -->
* <pre>
* List&lt;String&gt; blobUrls = new ArrayList&lt;&gt;&#40;&#41;;
* blobUrls.add&#40;blobClient1.getBlobUrl&#40;&#41;&#41;;
* blobUrls.add&#40;blobClient2.getBlobUrl&#40;&#41;&#41;;
* blobUrls.add&#40;blobClient3.getBlobUrl&#40;&#41;&#41;;
*
* batchAsyncClient.setBlobsAccessTier&#40;blobUrls, AccessTier.HOT&#41;.subscribe&#40;response -&gt;
* System.out.printf&#40;&quot;Setting blob access tier with URL %s completed with status code %d%n&quot;,
* response.getRequest&#40;&#41;.getUrl&#40;&#41;, response.getStatusCode&#40;&#41;&#41;,
* error -&gt; System.err.printf&#40;&quot;Setting blob access tier failed with exception: %s%n&quot;, error.getMessage&#40;&#41;&#41;&#41;;
* </pre>
* <!-- end com.azure.storage.blob.batch.BlobBatchAsyncClient.setBlobsAccessTier#List-AccessTier -->
*
* @param blobUrls Urls of the blobs to set their access tier. Blob names must be encoded to UTF-8.
* @param accessTier {@link AccessTier} to set on each blob.
Expand Down
Loading

0 comments on commit a4293d7

Please sign in to comment.