Class AwsS3ReactiveOperations
java.lang.Object
io.micronaut.objectstorage.aws.AwsS3ReactiveOperations
- All Implemented Interfaces:
ReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>
@EachBean(AwsS3Configuration.class)
@Requires(beans=AwsS3Configuration.class) @Requires(beans=software.amazon.awssdk.services.s3.S3AsyncClient.class)
public final class AwsS3ReactiveOperations
extends Object
implements ReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>
Reactive AWS S3 object storage operations backed by the native async SDK client.
- Since:
- 3.0.0
- Author:
- Álvaro Sánchez-Mariscal
-
Constructor Summary
ConstructorsConstructorDescriptionAwsS3ReactiveOperations(AwsS3Configuration configuration, software.amazon.awssdk.services.s3.S3AsyncClient s3AsyncClient, ExecutorService blockingExecutor) -
Method Summary
Modifier and TypeMethodDescription@NonNull org.reactivestreams.Publisher<Void> Copies an object stored atsourceKeytodestinationKey, within the same object storage (bucket/container).@NonNull org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.DeleteObjectResponse> Deletes an object from the object storage.@NonNull org.reactivestreams.Publisher<Boolean> Checks whether an entry with the given key exists in the object storage.Lists the objects that exist in the object storage.@NonNull org.reactivestreams.Publisher<ListObjectsResponse> listObjects(@NonNull ListObjectsRequest request) Lists a page of objects that exist in the object storage.<E extends ObjectStorageEntry<?>>
@NonNull org.reactivestreams.Publisher<Optional<E>> Gets the object from object storage.@NonNull org.reactivestreams.Publisher<UploadResponse<software.amazon.awssdk.services.s3.model.PutObjectResponse>> upload(@NonNull UploadRequest request) Uploads an object to the object storage.@NonNull org.reactivestreams.Publisher<UploadResponse<software.amazon.awssdk.services.s3.model.PutObjectResponse>> upload(@NonNull UploadRequest request, @NonNull Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> requestConsumer) Uploads an object to the object storage.
-
Constructor Details
-
AwsS3ReactiveOperations
public AwsS3ReactiveOperations(@Parameter AwsS3Configuration configuration, software.amazon.awssdk.services.s3.S3AsyncClient s3AsyncClient, @Named("blocking") ExecutorService blockingExecutor)
-
-
Method Details
-
upload
public @NonNull org.reactivestreams.Publisher<UploadResponse<software.amazon.awssdk.services.s3.model.PutObjectResponse>> upload(@NonNull UploadRequest request) Description copied from interface:ReactiveObjectStorageOperationsUploads an object to the object storage. If there is an existing entry, it will be updated.- Specified by:
uploadin interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Parameters:
request- the upload request- Returns:
- a publisher that emits the upload response
-
upload
public @NonNull org.reactivestreams.Publisher<UploadResponse<software.amazon.awssdk.services.s3.model.PutObjectResponse>> upload(@NonNull UploadRequest request, @NonNull Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> requestConsumer) Description copied from interface:ReactiveObjectStorageOperationsUploads an object to the object storage. If there is an existing entry, it will be updated.- Specified by:
uploadin interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Parameters:
request- the upload requestrequestConsumer- upload request builder consumer- Returns:
- a publisher that emits the upload response
-
retrieve
public <E extends ObjectStorageEntry<?>> @NonNull org.reactivestreams.Publisher<Optional<E>> retrieve(@NonNull String key) Description copied from interface:ReactiveObjectStorageOperationsGets the object from object storage.- Specified by:
retrievein interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Type Parameters:
E- an instance ofObjectStorageEntry- Parameters:
key- the object path in the format/foo/bar/file- Returns:
- a publisher that emits an optional object storage entry
-
delete
public @NonNull org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.DeleteObjectResponse> delete(@NonNull String key) Description copied from interface:ReactiveObjectStorageOperationsDeletes an object from the object storage.- Specified by:
deletein interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Parameters:
key- object path in the format/foo/bar/file- Returns:
- a publisher that emits the cloud vendor-specific delete response
-
exists
Description copied from interface:ReactiveObjectStorageOperationsChecks whether an entry with the given key exists in the object storage.- Specified by:
existsin interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Parameters:
key- object path in the format/foo/bar/file- Returns:
- a publisher that emits true if the entry exists, false otherwise
-
listObjects
Description copied from interface:ReactiveObjectStorageOperationsLists the objects that exist in the object storage.- Specified by:
listObjectsin interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Returns:
- a publisher that emits the full set of keys
-
listObjects
public @NonNull org.reactivestreams.Publisher<ListObjectsResponse> listObjects(@NonNull ListObjectsRequest request) Description copied from interface:ReactiveObjectStorageOperationsLists a page of objects that exist in the object storage.- Specified by:
listObjectsin interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Parameters:
request- the paginated listing request- Returns:
- a publisher that emits the current page of object keys
-
copy
public @NonNull org.reactivestreams.Publisher<Void> copy(@NonNull String sourceKey, @NonNull String destinationKey) Description copied from interface:ReactiveObjectStorageOperationsCopies an object stored atsourceKeytodestinationKey, within the same object storage (bucket/container). If the destination exists, it will be overwritten.- Specified by:
copyin interfaceReactiveObjectStorageOperations<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder, software.amazon.awssdk.services.s3.model.PutObjectResponse, software.amazon.awssdk.services.s3.model.DeleteObjectResponse>- Parameters:
sourceKey- the key of the source objectdestinationKey- the key of the destination object- Returns:
- a completion-only publisher
-