public interface SimpleStorageService
Modifier and Type | Method and Description |
---|---|
default void |
createBucket()
Creates new bucket of the name specified as
aws.s3.bucket property. |
void |
createBucket(java.lang.String bucketName)
Creates new bucket.
|
default void |
deleteBucket()
Creates new bucket of the name specified as
aws.s3.bucket property. |
void |
deleteBucket(java.lang.String bucketName)
Deletes existing bucket.
|
default boolean |
deleteFile(java.lang.String key)
Delete file specified by the object key.
|
boolean |
deleteFile(java.lang.String bucketName,
java.lang.String key)
Delete file specified by the object key.
|
default boolean |
deleteFiles(java.lang.String prefix)
Delete all files specified by the common prefix (aka folder).
|
boolean |
deleteFiles(java.lang.String bucketName,
java.lang.String prefix)
Delete all files specified by the common prefix (aka folder).
|
default boolean |
exists(java.lang.String key)
Check whether the object exists.
|
boolean |
exists(java.lang.String bucketName,
java.lang.String key)
Check whether the object exists.
|
default java.lang.String |
generatePresignedUrl(java.lang.String key,
java.util.Date expirationDate)
Generates the pre-signed URL for downloading an object by clients.
|
java.lang.String |
generatePresignedUrl(java.lang.String bucketName,
java.lang.String key,
java.util.Date expirationDate)
Generates the pre-signed URL for downloading an object by clients.
|
default java.lang.String |
generateUploadUrl(java.lang.String key,
java.util.Date expirationDate)
Generates the pre-signed URL for uploading an object by clients.
|
java.lang.String |
generateUploadUrl(java.lang.String bucketName,
java.lang.String key,
java.util.Date expirationDate)
Generates the pre-signed URL for uploading an object by clients.
|
java.lang.String |
getDefaultBucketName() |
default java.io.File |
getFile(java.lang.String key,
java.io.File localPath)
Downloads the file locally.
|
default java.io.File |
getFile(java.lang.String key,
java.lang.String localPath)
Downloads the file locally.
|
java.io.File |
getFile(java.lang.String bucketName,
java.lang.String key,
java.io.File localFile)
Downloads the file locally.
|
default java.io.File |
getFile(java.lang.String bucketName,
java.lang.String key,
java.lang.String localPath)
Downloads the file locally.
|
default software.amazon.awssdk.services.s3.model.GetObjectResponse |
getObject(java.lang.String key)
Returns the information about the object
|
software.amazon.awssdk.services.s3.model.GetObjectResponse |
getObject(java.lang.String bucketName,
java.lang.String key)
Returns the information about the object
|
default software.amazon.awssdk.services.s3.model.S3Object |
getObjectSummary(java.lang.String key)
Returns the object summary of an object
|
default software.amazon.awssdk.services.s3.model.S3Object |
getObjectSummary(java.lang.String bucketName,
java.lang.String key)
Returns the object summary of an object
|
java.util.List<java.lang.String> |
listBucketNames() |
default org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.ListObjectsV2Response> |
listObjects()
Returns the flowable of ObjectListing which each contains list of objects.
|
default org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.ListObjectsV2Response> |
listObjects(java.lang.String prefix)
Returns the flowable of ObjectListing which each contains list of objects.
|
org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.ListObjectsV2Response> |
listObjects(java.lang.String bucketName,
java.lang.String prefix)
Returns the flowable of ObjectListing which each contains list of objects.
|
default org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.S3Object> |
listObjectSummaries()
Returns the flowable of object summaries.
|
default org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.S3Object> |
listObjectSummaries(java.lang.String prefix)
Returns the flowable of object summaries.
|
default org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.S3Object> |
listObjectSummaries(java.lang.String bucketName,
java.lang.String prefix)
Returns the flowable of object summaries.
|
default java.lang.String |
moveObject(java.lang.String sourceKey,
java.lang.String destinationBucketName,
java.lang.String destinationKey)
Move S3 object to different location (key).
|
java.lang.String |
moveObject(java.lang.String sourceBucketName,
java.lang.String sourceKey,
java.lang.String destinationBucketName,
java.lang.String destinationKey)
Move S3 object to different location (key).
|
default java.lang.String |
storeFile(java.lang.String path,
java.io.File file)
Uploads data from the file to desired path on S3.
|
default java.lang.String |
storeFile(java.lang.String path,
java.io.File file,
java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
Uploads data from the file to desired path on S3.
|
default java.lang.String |
storeFile(java.lang.String bucketName,
java.lang.String path,
java.io.File file)
Uploads data from the file to desired path on S3.
|
java.lang.String |
storeFile(java.lang.String bucketName,
java.lang.String path,
java.io.File file,
java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
Uploads data from the file to desired path on S3.
|
default java.lang.String |
storeInputStream(java.lang.String path,
java.io.InputStream input)
Uploads data from the input stream to desired path on S3.
|
default java.lang.String |
storeInputStream(java.lang.String path,
java.io.InputStream input,
java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
Uploads data from the input stream to desired path on S3.
|
default java.lang.String |
storeInputStream(java.lang.String bucketName,
java.lang.String path,
java.io.InputStream input)
Uploads data from the input stream to desired path on S3.
|
java.lang.String |
storeInputStream(java.lang.String bucketName,
java.lang.String path,
java.io.InputStream input,
java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
Uploads data from the input stream to desired path on S3.
|
default java.lang.String |
storeMultipartFile(java.lang.String path,
io.micronaut.http.multipart.PartData multipartFile)
Uploads data from the multipart file to desired path on S3.
|
default java.lang.String |
storeMultipartFile(java.lang.String path,
io.micronaut.http.multipart.PartData multipartFile,
java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
Uploads data from the multipart file to desired path on S3.
|
default java.lang.String |
storeMultipartFile(java.lang.String bucketName,
java.lang.String path,
io.micronaut.http.multipart.PartData partData)
Uploads data from the multipart file to desired path on S3.
|
java.lang.String |
storeMultipartFile(java.lang.String bucketName,
java.lang.String path,
io.micronaut.http.multipart.PartData partData,
java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
Uploads data from the multipart file to desired path on S3.
|
java.lang.String getDefaultBucketName()
void createBucket(java.lang.String bucketName)
bucketName
- the name of the bucket.default void createBucket()
aws.s3.bucket
property.void deleteBucket(java.lang.String bucketName)
bucketName
- the name of the bucketdefault void deleteBucket()
aws.s3.bucket
property.boolean deleteFile(java.lang.String bucketName, java.lang.String key)
bucketName
- the name of the bucketkey
- the key of the objectdefault boolean deleteFile(java.lang.String key)
key
- the key of the objectboolean deleteFiles(java.lang.String bucketName, java.lang.String prefix)
bucketName
- the name of the bucketprefix
- common prefix of the objects to be deleteddefault boolean deleteFiles(java.lang.String prefix)
prefix
- common prefix of the objects to be deletedboolean exists(java.lang.String bucketName, java.lang.String key)
bucketName
- the name of the bucketkey
- the file keydefault boolean exists(java.lang.String key)
key
- the file keyjava.io.File getFile(java.lang.String bucketName, java.lang.String key, java.io.File localFile)
bucketName
- the name of the bucketkey
- the key of the objectlocalFile
- the destination filedefault java.io.File getFile(java.lang.String bucketName, java.lang.String key, java.lang.String localPath)
bucketName
- the name of the bucketkey
- the key of the objectlocalPath
- the destination file's pathdefault java.io.File getFile(java.lang.String key, java.io.File localPath)
key
- the key of the objectlocalPath
- the destination file's pathdefault java.io.File getFile(java.lang.String key, java.lang.String localPath)
key
- the key of the objectlocalPath
- the destination file's pathjava.util.List<java.lang.String> listBucketNames()
org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.ListObjectsV2Response> listObjects(java.lang.String bucketName, java.lang.String prefix)
listObjectSummaries()
to get flowable of object summaries themselves.bucketName
- the name of the bucketprefix
- the common prefix of the object being fetcheddefault org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.ListObjectsV2Response> listObjects(java.lang.String prefix)
listObjectSummaries()
to get flowable of object summaries themselves.prefix
- the common prefix of the object being fetcheddefault org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.ListObjectsV2Response> listObjects()
listObjectSummaries()
to get flowable of object summaries themselves.default org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.S3Object> listObjectSummaries(java.lang.String bucketName, java.lang.String prefix)
bucketName
- the name of the bucketprefix
- the common prefix of the object being fetcheddefault software.amazon.awssdk.services.s3.model.GetObjectResponse getObject(java.lang.String key)
key
- the key of the objectsoftware.amazon.awssdk.services.s3.model.GetObjectResponse getObject(java.lang.String bucketName, java.lang.String key)
bucketName
- the name of the bucketkey
- the key of the objectdefault software.amazon.awssdk.services.s3.model.S3Object getObjectSummary(java.lang.String key)
key
- the key of the objectdefault software.amazon.awssdk.services.s3.model.S3Object getObjectSummary(java.lang.String bucketName, java.lang.String key)
bucketName
- the name of the bucketkey
- the key of the objectdefault org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.S3Object> listObjectSummaries(java.lang.String prefix)
prefix
- the common prefix of the object being fetcheddefault org.reactivestreams.Publisher<software.amazon.awssdk.services.s3.model.S3Object> listObjectSummaries()
java.lang.String generatePresignedUrl(java.lang.String bucketName, java.lang.String key, java.util.Date expirationDate)
bucketName
- the name of the bucketkey
- the key of the objectexpirationDate
- the expiration date of the linkdefault java.lang.String generatePresignedUrl(java.lang.String key, java.util.Date expirationDate)
key
- the key of the objectexpirationDate
- the expiration date of the linkjava.lang.String generateUploadUrl(java.lang.String bucketName, java.lang.String key, java.util.Date expirationDate)
bucketName
- the name of the bucketkey
- the key of the objectexpirationDate
- the expiration date of the linkdefault java.lang.String generateUploadUrl(java.lang.String key, java.util.Date expirationDate)
key
- the key of the objectexpirationDate
- the expiration date of the linkjava.lang.String storeInputStream(java.lang.String bucketName, java.lang.String path, java.io.InputStream input, java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
bucketName
- the name of the bucketpath
- the destination path (key) on S3input
- the input data as streammetadataDefinition
- the object metadata definitiondefault java.lang.String storeInputStream(java.lang.String path, java.io.InputStream input, java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
path
- the destination path (key) on S3input
- the input data as streammetadataDefinition
- the object metadata definitiondefault java.lang.String storeInputStream(java.lang.String bucketName, java.lang.String path, java.io.InputStream input)
bucketName
- the name of the bucketpath
- the destination path (key) on S3input
- the input data as streamdefault java.lang.String storeInputStream(java.lang.String path, java.io.InputStream input)
path
- the destination path (key) on S3input
- the input data as streamjava.lang.String storeFile(java.lang.String bucketName, java.lang.String path, java.io.File file, java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
bucketName
- the name of the bucketpath
- the destination path (key) on S3file
- the input filedefault java.lang.String storeFile(java.lang.String path, java.io.File file, java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition)
path
- the destination path (key) on S3file
- the input filedefault java.lang.String storeFile(java.lang.String bucketName, java.lang.String path, java.io.File file)
bucketName
- the name of the bucketpath
- the destination path (key) on S3file
- the input filedefault java.lang.String storeFile(java.lang.String path, java.io.File file)
path
- the destination path (key) on S3file
- the input filejava.lang.String storeMultipartFile(java.lang.String bucketName, java.lang.String path, io.micronaut.http.multipart.PartData partData, java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition) throws java.io.IOException
bucketName
- the name of the bucketpath
- the destination path (key) on S3partData
- the input datametadataDefinition
- the object metadata definitionjava.io.IOException
default java.lang.String storeMultipartFile(java.lang.String bucketName, java.lang.String path, io.micronaut.http.multipart.PartData partData) throws java.io.IOException
bucketName
- the name of the bucketpath
- the destination path (key) on S3partData
- the input datajava.io.IOException
default java.lang.String storeMultipartFile(java.lang.String path, io.micronaut.http.multipart.PartData multipartFile) throws java.io.IOException
path
- the destination path (key) on S3java.io.IOException
default java.lang.String storeMultipartFile(java.lang.String path, io.micronaut.http.multipart.PartData multipartFile, java.util.function.Consumer<software.amazon.awssdk.services.s3.model.PutObjectRequest.Builder> metadataDefinition) throws java.io.IOException
path
- the destination path (key) on S3multipartFile
- the input datametadataDefinition
- the object metadata definitionjava.io.IOException
java.lang.String moveObject(java.lang.String sourceBucketName, java.lang.String sourceKey, java.lang.String destinationBucketName, java.lang.String destinationKey)
sourceBucketName
- the name of the source bucketsourceKey
- the key of the source objectdestinationBucketName
- the name of the destination bucketdestinationKey
- the key of the destination objectnull
if the file wasn't moveddefault java.lang.String moveObject(java.lang.String sourceKey, java.lang.String destinationBucketName, java.lang.String destinationKey)
sourceKey
- the key of the source objectdestinationBucketName
- the name of the destination bucketdestinationKey
- the key of the destination objectnull
if the file wasn't moved