public final class BlobBatch extends Object
BlobBatchClient.submitBatch(BlobBatch)
or BlobBatchAsyncClient.submitBatch(BlobBatch)
.
Azure Storage Blob batches are homogeneous which means a delete
and set tier
are not allowed to be in the same batch.
try { Response<Void> deleteResponse = batch.deleteBlob("{url of blob}"); Response<Void> setTierResponse = batch.setBlobAccessTier("{url of another blob}", AccessTier.HOT); } catch (UnsupportedOperationException ex) { System.err.printf("This will fail as Azure Storage Blob batch operations are homogeneous. Exception: %s%n", ex.getMessage()); }
Please refer to the Azure Docs for more information.
Modifier and Type | Method and Description |
---|---|
com.azure.core.http.rest.Response<Void> |
deleteBlob(String blobUrl)
Adds a delete blob operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
deleteBlob(String blobUrl,
DeleteSnapshotsOptionType deleteOptions,
BlobRequestConditions blobRequestConditions)
Adds a delete blob operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
deleteBlob(String containerName,
String blobName)
Adds a delete blob operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
deleteBlob(String containerName,
String blobName,
DeleteSnapshotsOptionType deleteOptions,
BlobRequestConditions blobRequestConditions)
Adds a delete blob operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
setBlobAccessTier(BlobBatchSetBlobAccessTierOptions options)
Adds a set tier operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
setBlobAccessTier(String blobUrl,
AccessTier accessTier)
Adds a set tier operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
setBlobAccessTier(String blobUrl,
AccessTier accessTier,
String leaseId)
Adds a set tier operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
setBlobAccessTier(String containerName,
String blobName,
AccessTier accessTier)
Adds a set tier operation to the batch.
|
com.azure.core.http.rest.Response<Void> |
setBlobAccessTier(String containerName,
String blobName,
AccessTier accessTier,
String leaseId)
Adds a set tier operation to the batch.
|
public com.azure.core.http.rest.Response<Void> deleteBlob(String containerName, String blobName)
Code sample
Response<Void> deleteResponse = batch.deleteBlob("{container name}", "{blob name}");
containerName
- The container of the blob.blobName
- The name of the blob.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> deleteBlob(String containerName, String blobName, DeleteSnapshotsOptionType deleteOptions, BlobRequestConditions blobRequestConditions)
Code sample
BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId("{lease ID}"); Response<Void> deleteResponse = batch.deleteBlob("{container name}", "{blob name}", DeleteSnapshotsOptionType.INCLUDE, blobRequestConditions);
containerName
- The container of the blob.blobName
- The name of the blob.deleteOptions
- Delete options for the blob and its snapshots.blobRequestConditions
- Additional access conditions that must be met to allow this operation.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> deleteBlob(String blobUrl)
Code sample
Response<Void> deleteResponse = batch.deleteBlob("{url of blob}");
blobUrl
- URL of the blob. Blob name must be encoded to UTF-8.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> deleteBlob(String blobUrl, DeleteSnapshotsOptionType deleteOptions, BlobRequestConditions blobRequestConditions)
Code sample
BlobRequestConditions blobRequestConditions = new BlobRequestConditions().setLeaseId("{lease ID}"); Response<Void> deleteResponse = batch.deleteBlob("{url of blob}", DeleteSnapshotsOptionType.INCLUDE, blobRequestConditions);
blobUrl
- URL of the blob. Blob name must be encoded to UTF-8.deleteOptions
- Delete options for the blob and its snapshots.blobRequestConditions
- Additional access conditions that must be met to allow this operation.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> setBlobAccessTier(String containerName, String blobName, AccessTier accessTier)
Code sample
Response<Void> setTierResponse = batch.setBlobAccessTier("{container name}", "{blob name}", AccessTier.HOT);
containerName
- The container of the blob.blobName
- The name of the blob.accessTier
- The tier to set on the blob.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> setBlobAccessTier(String containerName, String blobName, AccessTier accessTier, String leaseId)
Code sample
Response<Void> setTierResponse = batch.setBlobAccessTier("{container name}", "{blob name}", AccessTier.HOT, "{lease ID}");
containerName
- The container of the blob.blobName
- The name of the blob.accessTier
- The tier to set on the blob.leaseId
- The lease ID the active lease on the blob must match.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> setBlobAccessTier(String blobUrl, AccessTier accessTier)
Code sample
Response<Void> setTierResponse = batch.setBlobAccessTier("{url of blob}", AccessTier.HOT);
blobUrl
- URL of the blob. Blob name must be encoded to UTF-8.accessTier
- The tier to set on the blob.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> setBlobAccessTier(String blobUrl, AccessTier accessTier, String leaseId)
Code sample
Response<Void> setTierResponse = batch.setBlobAccessTier("{url of blob}", AccessTier.HOT, "{lease ID}");
blobUrl
- URL of the blob. Blob name must be encoded to UTF-8.accessTier
- The tier to set on the blob.leaseId
- The lease ID the active lease on the blob must match.Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.public com.azure.core.http.rest.Response<Void> setBlobAccessTier(BlobBatchSetBlobAccessTierOptions options)
Code sample
Response<Void> setTierResponse = batch.setBlobAccessTier( new BlobBatchSetBlobAccessTierOptions("{url of blob}", AccessTier.HOT).setLeaseId("{lease ID}"));
options
- BlobBatchSetBlobAccessTierOptions
Response
that will be used to associate this operation to the response when the batch is
submitted.UnsupportedOperationException
- If this batch has already added an operation of another type.Copyright © 2020 Microsoft Corporation. All rights reserved.