Interface S3Operations

All Known Implementing Classes:
S3Template

public interface S3Operations
  • Method Details

    • createBucket

      String createBucket(String bucketName)
      Creates a bucket in S3.
      Parameters:
      bucketName - - the bucket name
      Returns:
      created bucket location CreateBucketResponse.location()
    • deleteBucket

      void deleteBucket(String bucketName)
      Deletes a S3 bucket.
      Parameters:
      bucketName - - the bucket name
    • deleteObject

      void deleteObject(String bucketName, String key)
      Deletes an object from S3 bucket.
      Parameters:
      bucketName - - the bucket name
      key - - the object key
    • deleteObject

      void deleteObject(String s3Url)
      Deletes an object from S3 bucket.
      Parameters:
      s3Url - - the S3 url s3://bucket/key
    • store

      S3Resource store(String bucketName, String key, Object object)
      Stores a Java object in a S3 bucket. Uses S3ObjectConverter for serialization.
      Parameters:
      bucketName - - the bucket name
      key - - the object key
      object - - the Java object to serialize and store
      Returns:
      created S3Resource.
    • read

      <T> T read(String bucketName, String key, Class<T> clazz)
      Reads a Java object from a S3 bucket. Uses S3ObjectConverter for deserialization.
      Type Parameters:
      T - - the type of the read object
      Parameters:
      bucketName - - the bucket name
      key - - the object key
      clazz - - 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 name
      key - - the object key
      inputStream - - the input stream
      objectMetadata - - the object metadata
      Returns:
      created S3Resource
    • upload

      default S3Resource upload(String bucketName, String key, InputStream inputStream)
      Uploads data from an input stream to a S3 bucket.
      Parameters:
      bucketName - - the bucket name
      key - - the object key
      inputStream - - the input stream
      Returns:
      created S3Resource
    • download

      S3Resource download(String bucketName, String key)
      Downloads object from S3.
      Parameters:
      bucketName - - the bucket name
      key - - the object key
      Returns:
      downloaded object represented as S3Resource