Package io.micronaut.objectstorage.azure
Class AzureBlobStorageOperations
java.lang.Object
io.micronaut.objectstorage.azure.AzureBlobStorageOperations
- All Implemented Interfaces:
ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>>
@EachBean(com.azure.storage.blob.BlobContainerClient.class)
@Requires(beans=com.azure.storage.blob.BlobContainerClient.class) @Requires(condition=AzureBlobStorageEnabledCondition.class)
public class AzureBlobStorageOperations
extends Object
implements ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<Void>>
Azure implementation of
ObjectStorageOperations
.- Since:
- 1.0
- Author:
- Pavol Gressa
-
Constructor Summary
ConstructorsConstructorDescriptionAzureBlobStorageOperations
(com.azure.storage.blob.BlobContainerClient blobContainerClient) Deprecated, for removal: This API element is subject to removal in a future version.AzureBlobStorageOperations
(com.azure.storage.blob.BlobContainerClient blobContainerClient, AzureBlobStorageModuleConfiguration moduleConfiguration) Constructs an AzureBlobStorageOperations. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Copies an object stored atsourceKey
todestinationKey
, within the same object storage (bucket/container).@NonNull com.azure.core.http.rest.Response<Void>
Deletes an object from the object storage.boolean
Checks whether an entry with the given key exists in the object storage.protected @NonNull com.azure.storage.blob.options.BlobParallelUploadOptions
getUploadOptions
(@NonNull UploadRequest request) Lists the objects that exist in the object storage.@NonNull PresignResponse
presign
(PresignRequest request) Generates a pre-authorized (signed) request for the given operation.@NonNull Optional<AzureBlobStorageEntry>
Gets the object from object storage.@NonNull UploadResponse<com.azure.storage.blob.models.BlockBlobItem>
upload
(@NonNull UploadRequest request) Uploads an object to the object storage.@NonNull UploadResponse<com.azure.storage.blob.models.BlockBlobItem>
upload
(@NonNull UploadRequest request, @NonNull Consumer<com.azure.storage.blob.options.BlobParallelUploadOptions> requestConsumer) Uploads an object to the object storage.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.objectstorage.ObjectStorageOperations
invalidatePresignedRequest
-
Constructor Details
-
AzureBlobStorageOperations
@Inject public AzureBlobStorageOperations(@Parameter com.azure.storage.blob.BlobContainerClient blobContainerClient, AzureBlobStorageModuleConfiguration moduleConfiguration) Constructs an AzureBlobStorageOperations.- Parameters:
blobContainerClient
- The BlobContainerClient.moduleConfiguration
- The module configuration.
-
AzureBlobStorageOperations
@Deprecated(since="2.10.0", forRemoval=true) public AzureBlobStorageOperations(@Parameter com.azure.storage.blob.BlobContainerClient blobContainerClient) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
blobContainerClient
- The BlobContainerClient.
-
-
Method Details
-
upload
@NonNull public @NonNull UploadResponse<com.azure.storage.blob.models.BlockBlobItem> upload(@NonNull @NonNull UploadRequest request) Description copied from interface:ObjectStorageOperations
Uploads an object to the object storage. If there is an existing entry, it will be updated.- Specified by:
upload
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Parameters:
request
- the upload request- Returns:
- the upload response
-
presign
Description copied from interface:ObjectStorageOperations
Generates a pre-authorized (signed) request for the given operation.- Specified by:
presign
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Parameters:
request
- the presign request parameters- Returns:
- information with the generated URL and its expiration
-
upload
@NonNull public @NonNull UploadResponse<com.azure.storage.blob.models.BlockBlobItem> upload(@NonNull @NonNull UploadRequest request, @NonNull @NonNull Consumer<com.azure.storage.blob.options.BlobParallelUploadOptions> requestConsumer) Description copied from interface:ObjectStorageOperations
Uploads an object to the object storage. If there is an existing entry, it will be updated.- Specified by:
upload
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Parameters:
request
- the upload requestrequestConsumer
- Upload request builder consumer- Returns:
- the upload response
-
retrieve
Description copied from interface:ObjectStorageOperations
Gets the object from object storage.- Specified by:
retrieve
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Parameters:
key
- the object path in the format/foo/bar/file
- Returns:
- the object, or empty optional if the object does not exist
-
delete
@NonNull public @NonNull com.azure.core.http.rest.Response<Void> delete(@NonNull @NonNull String key) Description copied from interface:ObjectStorageOperations
Deletes an object from the object storage.- Specified by:
delete
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Parameters:
key
- object path in the format/foo/bar/file
- Returns:
- Cloud vendor-specific delete response.
-
exists
Description copied from interface:ObjectStorageOperations
Checks whether an entry with the given key exists in the object storage.- Specified by:
exists
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Parameters:
key
- object path in the format/foo/bar/file
- Returns:
- true if the entry exists, false otherwise.
-
listObjects
Description copied from interface:ObjectStorageOperations
Lists the objects that exist in the object storage.- Specified by:
listObjects
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Returns:
- a set of keys (paths) of the existing objects, if any, or an empty list otherwise.
-
copy
@NonNull public void copy(@NonNull @NonNull String sourceKey, @NonNull @NonNull String destinationKey) Description copied from interface:ObjectStorageOperations
Copies an object stored atsourceKey
todestinationKey
, within the same object storage (bucket/container). If the destination exists, it will be overwritten.- Specified by:
copy
in interfaceObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,
com.azure.storage.blob.models.BlockBlobItem, com.azure.core.http.rest.Response<Void>> - Parameters:
sourceKey
- the key of the source objectdestinationKey
- the key of the destination object
-
getUploadOptions
@NonNull protected @NonNull com.azure.storage.blob.options.BlobParallelUploadOptions getUploadOptions(@NonNull @NonNull UploadRequest request) - Parameters:
request
- the upload request- Returns:
- An Azure's
BlobParallelUploadOptions
from a Micronaut'sUploadRequest
.
-
AzureBlobStorageOperations(BlobContainerClient, AzureBlobStorageModuleConfiguration)
.