Class EncryptedBlobAsyncClient
Please refer to the Azure Docs For Client-Side Encryption for more information.
This client is instantiated through EncryptedBlobClientBuilder
For operations on a specific blob type (i.e. append, block, or page) use getAppendBlobAsyncClient, getBlockBlobAsyncClient, or getPageBlobAsyncClient to construct a client that allows blob specific operations. Note,
these types do not support client-side encryption, though decryption is possible in case the associated
block/page/append blob contains encrypted data.
Please refer to the Azure Docs for more information.
-
Field Summary
Fields inherited from class com.azure.storage.blob.BlobAsyncClient
BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE, BLOB_DEFAULT_NUMBER_OF_BUFFERS, BLOB_DEFAULT_UPLOAD_BLOCK_SIZEFields inherited from class com.azure.storage.blob.specialized.BlobAsyncClientBase
accountName, azureBlobStorage, blobName, containerName, encryptionScope, serviceVersion -
Method Summary
Modifier and TypeMethodDescriptiondownload()Deprecated.Mono<com.azure.core.util.BinaryData>downloadContentWithResponse(DownloadRetryOptions options, BlobRequestConditions requestConditions) downloadStreamWithResponse(BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5) downloadToFile(String filePath) downloadToFile(String filePath, boolean overwrite) Mono<com.azure.core.http.rest.Response<BlobProperties>>Mono<com.azure.core.http.rest.Response<BlobProperties>>downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean rangeGetContentMd5) Mono<com.azure.core.http.rest.Response<BlobProperties>>downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions) downloadWithResponse(BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5) Deprecated.getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey) Creates a newEncryptedBlobAsyncClientwith the specifiedcustomerProvidedKey.getEncryptionScopeAsyncClient(String encryptionScope) Creates a newEncryptedBlobAsyncClientwith the specifiedencryptionScope.Unsupported.queryWithResponse(BlobQueryOptions queryOptions) Unsupported.upload(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions) Creates a new block blob.upload(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, boolean overwrite) Creates a new block blob, or updates the content of an existing block blob.uploadFromFile(String filePath) Creates a new block blob with the content of the specified file.uploadFromFile(String filePath, boolean overwrite) Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file.uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions) Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file.Mono<com.azure.core.http.rest.Response<BlockBlobItem>>Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file.Mono<com.azure.core.http.rest.Response<BlockBlobItem>>Creates a new block blob, or updates the content of an existing block blob.Mono<com.azure.core.http.rest.Response<BlockBlobItem>>uploadWithResponse(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions) Creates a new block blob, or updates the content of an existing block blob.Methods inherited from class com.azure.storage.blob.BlobAsyncClient
getAppendBlobAsyncClient, getBlockBlobAsyncClient, getPageBlobAsyncClient, getSnapshotClient, getVersionClient, upload, upload, uploadFileResourceSupplierMethods inherited from class com.azure.storage.blob.specialized.BlobAsyncClientBase
abortCopyFromUrl, abortCopyFromUrlWithResponse, beginCopy, beginCopy, beginCopy, copyFromUrl, copyFromUrlWithResponse, copyFromUrlWithResponse, createSnapshot, createSnapshotWithResponse, delete, deleteIfExists, deleteIfExistsWithResponse, deleteImmutabilityPolicy, deleteImmutabilityPolicyWithResponse, deleteWithResponse, exists, existsWithResponse, generateSas, generateSas, generateUserDelegationSas, generateUserDelegationSas, getAccountInfo, getAccountInfoWithResponse, getAccountName, getAccountUrl, getBlobName, getBlobUrl, getContainerAsyncClient, getContainerName, getCustomerProvidedKey, getEncryptionScope, getHttpPipeline, getProperties, getPropertiesWithResponse, getServiceVersion, getSnapshotId, getTags, getTagsWithResponse, getVersionId, isSnapshot, setAccessTier, setAccessTierWithResponse, setAccessTierWithResponse, setHttpHeaders, setHttpHeadersWithResponse, setImmutabilityPolicy, setImmutabilityPolicyWithResponse, setLegalHold, setLegalHoldWithResponse, setMetadata, setMetadataWithResponse, setTags, setTagsWithResponse, undelete, undeleteWithResponse
-
Method Details
-
getEncryptionScopeAsyncClient
Creates a newEncryptedBlobAsyncClientwith the specifiedencryptionScope.- Overrides:
getEncryptionScopeAsyncClientin classBlobAsyncClient- Parameters:
encryptionScope- the encryption scope for the blob, passnullto use no encryption scope.- Returns:
- a
EncryptedBlobAsyncClientwith the specifiedencryptionScope.
-
getCustomerProvidedKeyAsyncClient
public EncryptedBlobAsyncClient getCustomerProvidedKeyAsyncClient(CustomerProvidedKey customerProvidedKey) Creates a newEncryptedBlobAsyncClientwith the specifiedcustomerProvidedKey.- Overrides:
getCustomerProvidedKeyAsyncClientin classBlobAsyncClient- Parameters:
customerProvidedKey- theCustomerProvidedKeyfor the blob, passnullto use no customer provided key.- Returns:
- a
EncryptedBlobAsyncClientwith the specifiedcustomerProvidedKey.
-
upload
public Mono<BlockBlobItem> upload(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions) Creates a new block blob. By default, this method will not overwrite an existing blob.Updating an existing block blob overwrites any existing blob metadata. Partial updates are not supported with this method; the content of the existing blob is overwritten with the new content. To perform a partial update of block blob's, use
stageBlockandBlockBlobAsyncClient.commitBlockList(List)on a regular blob client. For more information, see the Azure Docs for Put Block and the Azure Docs for Put Block List.The data passed need not support multiple subscriptions/be replayable as is required in other upload methods when retries are enabled, and the length of the data need not be known in advance. Therefore, this method should support uploading any arbitrary data source, including network streams. This behavior is possible because this method will perform some internal buffering as configured by the blockSize and numBuffers parameters, so while this method may offer additional convenience, it will not be as performant as other options, which should be preferred when possible.
Typically, the greater the number of buffers used, the greater the possible parallelism when transferring the data. Larger buffers means we will have to stage fewer blocks and therefore require fewer IO operations. The trade-offs between these values are context-dependent, so some experimentation may be required to optimize inputs for a given scenario.
Code Samples
ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() .setBlockSizeLong(blockSize) .setMaxConcurrency(maxConcurrency); client.upload(data, parallelTransferOptions).subscribe(response -> System.out.printf("Uploaded BlockBlob MD5 is %s%n", Base64.getEncoder().encodeToString(response.getContentMd5())));- Overrides:
uploadin classBlobAsyncClient- Parameters:
data- The data to write to the blob. Unlike other upload methods, this method does not require that theFluxbe replayable. In other words, it does not have to support multiple subscribers and is not expected to produce the same values across subscriptions.parallelTransferOptions-ParallelTransferOptionsused to configure buffered uploading.- Returns:
- A reactive response containing the information of the uploaded block blob.
-
upload
public Mono<BlockBlobItem> upload(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, boolean overwrite) Creates a new block blob, or updates the content of an existing block blob.Updating an existing block blob overwrites any existing blob metadata. Partial updates are not supported with this method; the content of the existing blob is overwritten with the new content. To perform a partial update of block blob's, use
stageBlockandBlockBlobAsyncClient.commitBlockList(List)on a regular blob client. For more information, see the Azure Docs for Put Block and the Azure Docs for Put Block List.The data passed need not support multiple subscriptions/be replayable as is required in other upload methods when retries are enabled, and the length of the data need not be known in advance. Therefore, this method should support uploading any arbitrary data source, including network streams. This behavior is possible because this method will perform some internal buffering as configured by the blockSize and numBuffers parameters, so while this method may offer additional convenience, it will not be as performant as other options, which should be preferred when possible.
Typically, the greater the number of buffers used, the greater the possible parallelism when transferring the data. Larger buffers means we will have to stage fewer blocks and therefore require fewer IO operations. The trade-offs between these values are context-dependent, so some experimentation may be required to optimize inputs for a given scenario.
Code Samples
ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() .setBlockSizeLong(blockSize) .setMaxConcurrency(maxConcurrency); boolean overwrite = false; // Default behavior client.upload(data, parallelTransferOptions, overwrite).subscribe(response -> System.out.printf("Uploaded BlockBlob MD5 is %s%n", Base64.getEncoder().encodeToString(response.getContentMd5())));- Overrides:
uploadin classBlobAsyncClient- Parameters:
data- The data to write to the blob. Unlike other upload methods, this method does not require that theFluxbe replayable. In other words, it does not have to support multiple subscribers and is not expected to produce the same values across subscriptions.parallelTransferOptions-ParallelTransferOptionsused to configure buffered uploading.overwrite- Whether to overwrite if the blob exists.- Returns:
- A reactive response containing the information of the uploaded block blob.
-
uploadWithResponse
public Mono<com.azure.core.http.rest.Response<BlockBlobItem>> uploadWithResponse(Flux<ByteBuffer> data, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions) Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing blob metadata. Partial updates are not supported with this method; the content of the existing blob is overwritten with the new content. To perform a partial update of a block blob's, usestageBlockandBlockBlobAsyncClient.commitBlockList(List), which this method uses internally. For more information, see the Azure Docs for Put Block and the Azure Docs for Put Block List.The data passed need not support multiple subscriptions/be replayable as is required in other upload methods when retries are enabled, and the length of the data need not be known in advance. Therefore, this method should support uploading any arbitrary data source, including network streams. This behavior is possible because this method will perform some internal buffering as configured by the blockSize and numBuffers parameters, so while this method may offer additional convenience, it will not be as performant as other options, which should be preferred when possible.
Typically, the greater the number of buffers used, the greater the possible parallelism when transferring the data. Larger buffers means we will have to stage fewer blocks and therefore require fewer IO operations. The trade-offs between these values are context-dependent, so some experimentation may be required to optimize inputs for a given scenario.
Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = new HashMap<>(Collections.singletonMap("metadata", "value")); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() .setBlockSizeLong(blockSize) .setMaxConcurrency(maxConcurrency); client.uploadWithResponse(data, parallelTransferOptions, headers, metadata, AccessTier.HOT, requestConditions) .subscribe(response -> System.out.printf("Uploaded BlockBlob MD5 is %s%n", Base64.getEncoder().encodeToString(response.getValue().getContentMd5())));- Overrides:
uploadWithResponsein classBlobAsyncClient- Parameters:
data- The data to write to the blob. Unlike other upload methods, this method does not require that theFluxbe replayable. In other words, it does not have to support multiple subscribers and is not expected to produce the same values across subscriptions.parallelTransferOptions-ParallelTransferOptionsused to configure buffered uploading.headers-BlobHttpHeadersmetadata- Metadata to associate with the blob. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.tier-AccessTierfor the destination blob.requestConditions-BlobRequestConditions- Returns:
- A reactive response containing the information of the uploaded block blob.
-
uploadWithResponse
public Mono<com.azure.core.http.rest.Response<BlockBlobItem>> uploadWithResponse(BlobParallelUploadOptions options) Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob overwrites any existing blob metadata. Partial updates are not supported with this method; the content of the existing blob is overwritten with the new content. To perform a partial update of a block blob's, usestageBlockandBlockBlobAsyncClient.commitBlockList(List), which this method uses internally. For more information, see the Azure Docs for Put Block and the Azure Docs for Put Block List.The data passed need not support multiple subscriptions/be replayable as is required in other upload methods when retries are enabled, and the length of the data need not be known in advance. Therefore, this method should support uploading any arbitrary data source, including network streams. This behavior is possible because this method will perform some internal buffering as configured by the blockSize and numBuffers parameters, so while this method may offer additional convenience, it will not be as performant as other options, which should be preferred when possible.
Typically, the greater the number of buffers used, the greater the possible parallelism when transferring the data. Larger buffers means we will have to stage fewer blocks and therefore require fewer IO operations. The trade-offs between these values are context-dependent, so some experimentation may be required to optimize inputs for a given scenario.
Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = new HashMap<>(Collections.singletonMap("metadata", "value")); Map<String, String> tags = new HashMap<>(Collections.singletonMap("tag", "value")); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() .setBlockSizeLong(blockSize) .setMaxConcurrency(maxConcurrency); client.uploadWithResponse(new BlobParallelUploadOptions(data) .setParallelTransferOptions(parallelTransferOptions).setHeaders(headers).setMetadata(metadata) .setTags(tags).setTier(AccessTier.HOT).setRequestConditions(requestConditions)) .subscribe(response -> System.out.printf("Uploaded BlockBlob MD5 is %s%n", Base64.getEncoder().encodeToString(response.getValue().getContentMd5())));Fluxbe replayable. In other words, it does not have to support multiple subscribers and is not expected to produce the same values across subscriptions.- Overrides:
uploadWithResponsein classBlobAsyncClient- Parameters:
options-BlobParallelUploadOptions- Returns:
- A reactive response containing the information of the uploaded block blob.
-
uploadFromFile
Creates a new block blob with the content of the specified file. By default, this method will not overwrite existing dataCode Samples
client.uploadFromFile(filePath) .doOnError(throwable -> System.err.printf("Failed to upload from file %s%n", throwable.getMessage())) .subscribe(completion -> System.out.println("Upload from file succeeded"));- Overrides:
uploadFromFilein classBlobAsyncClient- Parameters:
filePath- Path to the upload file- Returns:
- An empty response
-
uploadFromFile
Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file.Code Samples
boolean overwrite = false; // Default behavior client.uploadFromFile(filePath, overwrite) .doOnError(throwable -> System.err.printf("Failed to upload from file %s%n", throwable.getMessage())) .subscribe(completion -> System.out.println("Upload from file succeeded"));- Overrides:
uploadFromFilein classBlobAsyncClient- Parameters:
filePath- Path to the upload fileoverwrite- Whether to overwrite should the blob exist.- Returns:
- An empty response
-
uploadFromFile
public Mono<Void> uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions requestConditions) Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file.Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = new HashMap<>(Collections.singletonMap("metadata", "value")); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() .setBlockSizeLong(blockSize); client.uploadFromFile(filePath, parallelTransferOptions, headers, metadata, AccessTier.HOT, requestConditions) .doOnError(throwable -> System.err.printf("Failed to upload from file %s%n", throwable.getMessage())) .subscribe(completion -> System.out.println("Upload from file succeeded"));- Overrides:
uploadFromFilein classBlobAsyncClient- Parameters:
filePath- Path to the upload fileparallelTransferOptions-ParallelTransferOptionsto use to upload from file.headers-BlobHttpHeadersmetadata- Metadata to associate with the blob. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.tier-AccessTierfor the destination blob.requestConditions-BlobRequestConditions- Returns:
- An empty response
- Throws:
IllegalArgumentException- IfblockSizeis less than 0 or greater than 4000 MBUncheckedIOException- If an I/O error occurs
-
uploadFromFileWithResponse
public Mono<com.azure.core.http.rest.Response<BlockBlobItem>> uploadFromFileWithResponse(BlobUploadFromFileOptions options) Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file.Code Samples
BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = new HashMap<>(Collections.singletonMap("metadata", "value")); Map<String, String> tags = new HashMap<>(Collections.singletonMap("tag", "value")); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() .setBlockSizeLong(blockSize); client.uploadFromFileWithResponse(new BlobUploadFromFileOptions(filePath) .setParallelTransferOptions(parallelTransferOptions).setHeaders(headers).setMetadata(metadata).setTags(tags) .setTier(AccessTier.HOT).setRequestConditions(requestConditions)) .doOnError(throwable -> System.err.printf("Failed to upload from file %s%n", throwable.getMessage())) .subscribe(completion -> System.out.println("Upload from file succeeded"));- Overrides:
uploadFromFileWithResponsein classBlobAsyncClient- Parameters:
options-BlobUploadFromFileOptions- Returns:
- A reactive response containing the information of the uploaded block blob.
- Throws:
IllegalArgumentException- IfblockSizeis less than 0 or greater than 4000 MBUncheckedIOException- If an I/O error occurs
-
download
Deprecated.- Overrides:
downloadin classBlobAsyncClientBase
-
downloadStream
- Overrides:
downloadStreamin classBlobAsyncClientBase
-
downloadContent
- Overrides:
downloadContentin classBlobAsyncClientBase
-
downloadWithResponse
@Deprecated public Mono<BlobDownloadAsyncResponse> downloadWithResponse(BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5) Deprecated.- Overrides:
downloadWithResponsein classBlobAsyncClientBase
-
downloadStreamWithResponse
public Mono<BlobDownloadAsyncResponse> downloadStreamWithResponse(BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5) - Overrides:
downloadStreamWithResponsein classBlobAsyncClientBase
-
downloadContentWithResponse
public Mono<BlobDownloadContentAsyncResponse> downloadContentWithResponse(DownloadRetryOptions options, BlobRequestConditions requestConditions) - Overrides:
downloadContentWithResponsein classBlobAsyncClientBase
-
downloadToFile
- Overrides:
downloadToFilein classBlobAsyncClientBase
-
downloadToFile
- Overrides:
downloadToFilein classBlobAsyncClientBase
-
downloadToFileWithResponse
public Mono<com.azure.core.http.rest.Response<BlobProperties>> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean rangeGetContentMd5) - Overrides:
downloadToFileWithResponsein classBlobAsyncClientBase
-
downloadToFileWithResponse
public Mono<com.azure.core.http.rest.Response<BlobProperties>> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions) - Overrides:
downloadToFileWithResponsein classBlobAsyncClientBase
-
downloadToFileWithResponse
public Mono<com.azure.core.http.rest.Response<BlobProperties>> downloadToFileWithResponse(BlobDownloadToFileOptions options) - Overrides:
downloadToFileWithResponsein classBlobAsyncClientBase
-
query
Unsupported. Cannot query data encrypted on client side.- Overrides:
queryin classBlobAsyncClientBase
-
queryWithResponse
Unsupported. Cannot query data encrypted on client side.- Overrides:
queryWithResponsein classBlobAsyncClientBase
-