@EachBean(value=com.azure.storage.blob.BlobContainerClient.class) @Singleton public class AzureBlobStorageOperations extends java.lang.Object implements ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
ObjectStorageOperations
.Constructor and Description |
---|
AzureBlobStorageOperations(com.azure.storage.blob.BlobContainerClient blobContainerClient) |
Modifier and Type | Method and Description |
---|---|
void |
copy(java.lang.String sourceKey,
java.lang.String destinationKey)
Copies an object stored at
sourceKey to destinationKey , within the
same object storage (bucket/container). |
com.azure.core.http.rest.Response<java.lang.Void> |
delete(java.lang.String key)
Deletes an object from the object storage.
|
boolean |
exists(java.lang.String key)
Checks whether an entry with the given key exists in the object storage.
|
protected com.azure.storage.blob.options.BlobParallelUploadOptions |
getUploadOptions(UploadRequest request) |
java.util.Set<java.lang.String> |
listObjects()
Lists the objects that exist in the object storage.
|
java.util.Optional<AzureBlobStorageEntry> |
retrieve(java.lang.String key)
Gets the object from object storage.
|
UploadResponse<com.azure.storage.blob.models.BlockBlobItem> |
upload(UploadRequest request)
Uploads an object to the object storage.
|
UploadResponse<com.azure.storage.blob.models.BlockBlobItem> |
upload(UploadRequest request,
java.util.function.Consumer<com.azure.storage.blob.options.BlobParallelUploadOptions> requestConsumer)
Uploads an object to the object storage.
|
public AzureBlobStorageOperations(@Parameter com.azure.storage.blob.BlobContainerClient blobContainerClient)
@NonNull public UploadResponse<com.azure.storage.blob.models.BlockBlobItem> upload(@NonNull UploadRequest request)
ObjectStorageOperations
upload
in interface ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
request
- the upload request@NonNull public UploadResponse<com.azure.storage.blob.models.BlockBlobItem> upload(@NonNull UploadRequest request, @NonNull java.util.function.Consumer<com.azure.storage.blob.options.BlobParallelUploadOptions> requestConsumer)
ObjectStorageOperations
upload
in interface ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
request
- the upload requestrequestConsumer
- Upload request builder consumer@NonNull public java.util.Optional<AzureBlobStorageEntry> retrieve(@NonNull java.lang.String key)
ObjectStorageOperations
retrieve
in interface ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
key
- the object path in the format /foo/bar/file
@NonNull public com.azure.core.http.rest.Response<java.lang.Void> delete(@NonNull java.lang.String key)
ObjectStorageOperations
delete
in interface ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
key
- object path in the format /foo/bar/file
public boolean exists(@NonNull java.lang.String key)
ObjectStorageOperations
exists
in interface ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
key
- object path in the format /foo/bar/file
@NonNull public java.util.Set<java.lang.String> listObjects()
ObjectStorageOperations
listObjects
in interface ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
@NonNull public void copy(@NonNull java.lang.String sourceKey, @NonNull java.lang.String destinationKey)
ObjectStorageOperations
sourceKey
to destinationKey
, within the
same object storage (bucket/container). If the destination exists, it will be overwritten.copy
in interface ObjectStorageOperations<com.azure.storage.blob.options.BlobParallelUploadOptions,com.azure.storage.blob.models.BlockBlobItem,com.azure.core.http.rest.Response<java.lang.Void>>
sourceKey
- the key of the source objectdestinationKey
- the key of the destination object@NonNull protected com.azure.storage.blob.options.BlobParallelUploadOptions getUploadOptions(@NonNull UploadRequest request)
request
- the upload requestBlobParallelUploadOptions
from a Micronaut's UploadRequest
.