Class S3ClientWrapper
- java.lang.Object
-
- app.coronawarn.server.services.distribution.objectstore.client.S3ClientWrapper
-
- All Implemented Interfaces:
ObjectStoreClient
public class S3ClientWrapper extends Object implements ObjectStoreClient
Implementation ofObjectStoreClientthat encapsulates anS3Client.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface app.coronawarn.server.services.distribution.objectstore.client.ObjectStoreClient
ObjectStoreClient.HeaderKey
-
-
Constructor Summary
Constructors Constructor Description S3ClientWrapper(software.amazon.awssdk.services.s3.S3Client s3Client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbucketExists(String bucketName)Checks if an object store bucket with the specified name exists.List<S3Object>getObjects(String bucket, String prefix)Downloads the all objects that match the specified prefix from the specified object store bucket.voidputObject(String bucket, String objectName, Path filePath, Map<ObjectStoreClient.HeaderKey,String> headers)Uploads data from the specified file to an object with the specified name.voidremoveObjects(String bucket, List<String> objectNames)Removes all the specified objects from the specified object store bucket.List<S3Object>skipReadOperation(Throwable cause)
-
-
-
Method Detail
-
bucketExists
public boolean bucketExists(String bucketName)
Description copied from interface:ObjectStoreClientChecks if an object store bucket with the specified name exists.- Specified by:
bucketExistsin interfaceObjectStoreClient- Parameters:
bucketName- The name of the object store bucket.- Returns:
- True if the bucket exists.
-
getObjects
@Retryable(value=software.amazon.awssdk.core.exception.SdkException.class, maxAttemptsExpression="${services.distribution.objectstore.retry-attempts}", backoff=@Backoff(delayExpression="${services.distribution.objectstore.retry-backoff}")) public List<S3Object> getObjects(String bucket, String prefix)Description copied from interface:ObjectStoreClientDownloads the all objects that match the specified prefix from the specified object store bucket.- Specified by:
getObjectsin interfaceObjectStoreClient- Parameters:
bucket- The name of the object store bucket.prefix- The prefix that the names of the returned objects start with.- Returns:
- A list of objects from the object store that match the specified parameters.
-
putObject
@Retryable(value=software.amazon.awssdk.core.exception.SdkException.class, maxAttemptsExpression="${services.distribution.objectstore.retry-attempts}", backoff=@Backoff(delayExpression="${services.distribution.objectstore.retry-backoff}")) public void putObject(String bucket, String objectName, Path filePath, Map<ObjectStoreClient.HeaderKey,String> headers)Description copied from interface:ObjectStoreClientUploads data from the specified file to an object with the specified name.- Specified by:
putObjectin interfaceObjectStoreClient- Parameters:
bucket- The name of the object store bucket.objectName- The name of the target object.filePath- The path associated with the file to upload.headers- The headers to be used during upload.
-
removeObjects
@Retryable(value={software.amazon.awssdk.core.exception.SdkException.class,ObjectStoreOperationFailedException.class}, maxAttemptsExpression="${services.distribution.objectstore.retry-attempts}", backoff=@Backoff(delayExpression="${services.distribution.objectstore.retry-backoff}")) public void removeObjects(String bucket, List<String> objectNames)Description copied from interface:ObjectStoreClientRemoves all the specified objects from the specified object store bucket.- Specified by:
removeObjectsin interfaceObjectStoreClient- Parameters:
bucket- The name of the object store bucket.objectNames- The names of objects to delete.
-
-