BlobBatchClient class
A BlobBatchClient allows you to make batched requests to the Azure Storage Blob service.
Constructors
Blob |
Creates an instance of BlobBatchClient. |
Blob |
Creates an instance of BlobBatchClient. |
Methods
create |
Creates a <xref:BlobBatch>. A BlobBatch represents an aggregated set of operations on blobs. |
delete |
Create multiple delete operations to mark the specified blobs or snapshots for deletion. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time. See delete operation details. The operation(subrequest) will be authenticated and authorized with specified credential. See blob batch authorization details. |
delete |
Create multiple delete operations to mark the specified blobs or snapshots for deletion. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time. See delete operation details. The operations will be authenticated and authorized with specified credential. See blob batch authorization details. |
set |
Create multiple set tier operations to set 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 account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. See set blob tier details. The operation(subrequest) will be authenticated and authorized with specified credential.See blob batch authorization details. |
set |
Create multiple set tier operations to set 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 account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. See set blob tier details. The operation(subrequest) will be authenticated and authorized with specified credential.See blob batch authorization details. |
submit |
Submit batch request which consists of multiple subrequests.
Get Example usage:
Example using a lease:
|
Constructor Details
BlobBatchClient(string, PipelineLike)
Creates an instance of BlobBatchClient.
new BlobBatchClient(url: string, pipeline: PipelineLike)
Parameters
- url
-
string
A url pointing to Azure Storage blob service, such as "https://myaccount.blob.core.windows.net". You can append a SAS if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net?sasString".
- pipeline
- PipelineLike
Call newPipeline() to create a default pipeline, or provide a customized pipeline.
BlobBatchClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions)
Creates an instance of BlobBatchClient.
new BlobBatchClient(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)
Parameters
- url
-
string
A url pointing to Azure Storage blob service, such as "https://myaccount.blob.core.windows.net". You can append a SAS if using AnonymousCredential, such as "https://myaccount.blob.core.windows.net?sasString".
- credential
-
StorageSharedKeyCredential | AnonymousCredential | TokenCredential
Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity
package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
- options
- StoragePipelineOptions
Options to configure the HTTP pipeline.
Method Details
createBatch()
Creates a <xref:BlobBatch>. A BlobBatch represents an aggregated set of operations on blobs.
function createBatch()
Returns
deleteBlobs(BlobClient[], BlobDeleteOptions)
Create multiple delete operations to mark the specified blobs or snapshots for deletion. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time. See delete operation details. The operation(subrequest) will be authenticated and authorized with specified credential. See blob batch authorization details.
function deleteBlobs(blobClients: BlobClient[], options?: BlobDeleteOptions)
Parameters
- blobClients
The BlobClients for the blobs to delete.
- options
- BlobDeleteOptions
Returns
Promise<BlobBatchDeleteBlobsResponse>
deleteBlobs(string[], StorageSharedKeyCredential | AnonymousCredential | TokenCredential, BlobDeleteOptions)
Create multiple delete operations to mark the specified blobs or snapshots for deletion. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time. See delete operation details. The operations will be authenticated and authorized with specified credential. See blob batch authorization details.
function deleteBlobs(urls: string[], credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: BlobDeleteOptions)
Parameters
- urls
-
string[]
The urls of the blob resources to delete.
- credential
-
StorageSharedKeyCredential | AnonymousCredential | TokenCredential
Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity
package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
- options
- BlobDeleteOptions
Returns
Promise<BlobBatchDeleteBlobsResponse>
setBlobsAccessTier(BlobClient[], AccessTier, BlobSetTierOptions)
Create multiple set tier operations to set 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 account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. See set blob tier details. The operation(subrequest) will be authenticated and authorized with specified credential.See blob batch authorization details.
function setBlobsAccessTier(blobClients: BlobClient[], tier: AccessTier, options?: BlobSetTierOptions)
Parameters
- blobClients
The BlobClients for the blobs which should have a new tier set.
- tier
- AccessTier
- options
- BlobSetTierOptions
Returns
Promise<BlobBatchSetBlobsAccessTierResponse>
setBlobsAccessTier(string[], StorageSharedKeyCredential | AnonymousCredential | TokenCredential, AccessTier, BlobSetTierOptions)
Create multiple set tier operations to set 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 account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. See set blob tier details. The operation(subrequest) will be authenticated and authorized with specified credential.See blob batch authorization details.
function setBlobsAccessTier(urls: string[], credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, tier: AccessTier, options?: BlobSetTierOptions)
Parameters
- urls
-
string[]
The urls of the blob resource to delete.
- credential
-
StorageSharedKeyCredential | AnonymousCredential | TokenCredential
Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity
package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
- tier
- AccessTier
- options
- BlobSetTierOptions
Returns
Promise<BlobBatchSetBlobsAccessTierResponse>
submitBatch(BlobBatch, BlobBatchSubmitBatchOptionalParams)
Submit batch request which consists of multiple subrequests.
Get blobBatchClient
and other details before running the snippets.
blobServiceClient.getBlobBatchClient()
gives the blobBatchClient
Example usage:
let batchRequest = new BlobBatch();
await batchRequest.deleteBlob(urlInString0, credential0);
await batchRequest.deleteBlob(urlInString1, credential1, {
deleteSnapshots: "include"
});
const batchResp = await blobBatchClient.submitBatch(batchRequest);
console.log(batchResp.subResponsesSucceededCount);
Example using a lease:
let batchRequest = new BlobBatch();
await batchRequest.setBlobAccessTier(blockBlobClient0, "Cool");
await batchRequest.setBlobAccessTier(blockBlobClient1, "Cool", {
conditions: { leaseId: leaseId }
});
const batchResp = await blobBatchClient.submitBatch(batchRequest);
console.log(batchResp.subResponsesSucceededCount);
function submitBatch(batchRequest: BlobBatch, options?: BlobBatchSubmitBatchOptionalParams)
Parameters
- batchRequest
- BlobBatch
A set of Delete or SetTier operations.
Returns
Promise<BlobBatchSubmitBatchResponse>
Azure SDK for JavaScript