Package io.awspring.cloud.s3
Interface S3Operations
- All Known Implementing Classes:
S3Template
public interface S3Operations
-
Method Summary
Modifier and TypeMethodDescriptioncreateBucket
(String bucketName) Creates a bucket in S3.void
deleteBucket
(String bucketName) Deletes a S3 bucket.void
deleteObject
(String s3Url) Deletes an object from S3 bucket.void
deleteObject
(String bucketName, String key) Deletes an object from S3 bucket.Downloads object from S3.<T> T
Reads a Java object from a S3 bucket.Stores a Java object in a S3 bucket.default S3Resource
upload
(String bucketName, String key, InputStream inputStream) Uploads data from an input stream to a S3 bucket.upload
(String bucketName, String key, InputStream inputStream, ObjectMetadata objectMetadata) Uploads data from an input stream to a S3 bucket.
-
Method Details
-
createBucket
Creates a bucket in S3.- Parameters:
bucketName
- - the bucket name- Returns:
- created bucket location
CreateBucketResponse.location()
-
deleteBucket
Deletes a S3 bucket.- Parameters:
bucketName
- - the bucket name
-
deleteObject
Deletes an object from S3 bucket.- Parameters:
bucketName
- - the bucket namekey
- - the object key
-
deleteObject
Deletes an object from S3 bucket.- Parameters:
s3Url
- - the S3 url s3://bucket/key
-
store
Stores a Java object in a S3 bucket. UsesS3ObjectConverter
for serialization.- Parameters:
bucketName
- - the bucket namekey
- - the object keyobject
- - the Java object to serialize and store- Returns:
- created
S3Resource
.
-
read
Reads a Java object from a S3 bucket. UsesS3ObjectConverter
for deserialization.- Type Parameters:
T
- - the type of the read object- Parameters:
bucketName
- - the bucket namekey
- - the object keyclazz
- - the class of the read object- Returns:
- an object
-
upload
S3Resource upload(String bucketName, String key, InputStream inputStream, @Nullable ObjectMetadata objectMetadata) Uploads data from an input stream to a S3 bucket.- Parameters:
bucketName
- - the bucket namekey
- - the object keyinputStream
- - the input streamobjectMetadata
- - the object metadata- Returns:
- created
S3Resource
-
upload
Uploads data from an input stream to a S3 bucket.- Parameters:
bucketName
- - the bucket namekey
- - the object keyinputStream
- - the input stream- Returns:
- created
S3Resource
-
download
Downloads object from S3.- Parameters:
bucketName
- - the bucket namekey
- - the object key- Returns:
- downloaded object represented as
S3Resource
-