Package 

Interface BucketContainer

  • All Implemented Interfaces:

    
    public interface BucketContainer
    
                        

    Represents the root of an S3 store on which bucket operations may be performed.

    This interface does not define any methods for managing bucket tags. To work with bucket tags use one of the bucket access methods contained in this type, such as withBucket or get which give access to an S3Bucket instance without performing any additional operations.

    Example:

    container.withBucket("my-bucket") {
      tags.put("something", "some value")
    }
    
    container["my-bucket"].tags.put("something", "some value")
    • Constructor Detail

    • Method Detail

      • withBucket

         abstract <R extends Any> R withBucket(BucketName name, Function1<S3Bucket, R> action)

        Executes the given action on the target bucket.

        Parameters:
        name - Name of the target bucket.
        action - Action that will be called on the S3Bucket handle on the target bucket.
      • exists

         abstract Boolean exists(BucketName name)

        Tests for the existence of a bucket with the given name.

        Parameters:
        name - Name of the bucket to test for.
      • create

         abstract S3Bucket create(BucketName name)

        Attempts to create a bucket with the given name.

        Warning This may not be allowed based on the security policy/ permissions granted on the target S3 instance.

        Parameters:
        name - Name of the bucket to create.
      • create

         abstract S3Bucket create(BucketName name, Function1<BucketPutParams, Unit> action)

        Attempts to create a bucket with the given name with the operation configured by the given action.

        Warning This may not be allowed based on the security policy/ permissions granted on the target S3 instance.

        Parameters:
        action - Action to configure the S3 operation.
      • create

         abstract S3Bucket create(BucketName name, BucketPutParams params)

        Attempts to create a bucket with the given name with the operation configured by the given params.

        Warning This may not be allowed based on the security policy/ permissions granted on the target S3 instance.

        Parameters:
        params - S3 operation parameters.
      • createIfNotExists

         abstract S3Bucket createIfNotExists(BucketName name)

        Attempts to create a bucket with the given name if it does not already exist in the S3 instance.

        Warning This may not be allowed based on the security policy/ permissions granted on the target S3 instance.

        Parameters:
        name - Name of the bucket to create.
      • createIfNotExists

         abstract S3Bucket createIfNotExists(BucketName name, Function1<BucketUpsertParams, Unit> action)

        Attempts to create a bucket with the given name if it does not already exist in the S3 instance.

        Warning This may not be allowed based on the security policy/ permissions granted on the target S3 instance.

        Parameters:
        action - Action used to configure the S3 operation parameters.
      • createIfNotExists

         abstract S3Bucket createIfNotExists(BucketName name, BucketUpsertParams params)

        Attempts to create a bucket with the given name if it does not already exist in the S3 instance.

        Warning This may not be allowed based on the security policy/ permissions granted on the target S3 instance.

        Parameters:
        params - S3 operation parameters.
      • get

         abstract S3Bucket get(BucketName name)

        Creates a new S3Bucket instance wrapping the target S3 bucket.

        Parameters:
        name - Name of the bucket to wrap.
      • list

         abstract BucketList list()

        Fetches a list of all buckets available on the target S3 instance.

      • list

         abstract BucketList list(Function1<BucketListParams, Unit> action)

        Fetches a list of all buckets available on the target S3 instance.

        Parameters:
        action - Action used to configure the S3 operation parameters.
      • list

         abstract BucketList list(BucketListParams params)

        Fetches a list of all buckets available on the target S3 instance.

        Parameters:
        params - S3 operation parameters.
      • delete

         abstract Unit delete(BucketName name)

        Deletes the target bucket from the S3 instance.

        If the target bucket does not exist, this method does nothing.

        Parameters:
        name - Name of the bucket to delete.
      • delete

         abstract Unit delete(BucketName name, Function1<BucketDeleteParams, Unit> action)

        Deletes the target bucket from the S3 instance.

        If the target bucket does not exist, this method does nothing.

        Parameters:
        action - Action used to configure the S3 operation parameters.
      • delete

         abstract Unit delete(BucketName name, BucketDeleteParams params)

        Deletes the target bucket from the S3 instance.

        If the target bucket does not exist, this method does nothing.

        Parameters:
        params - S3 operation parameters.
      • deleteRecursive

         abstract Unit deleteRecursive(BucketName name)

        Deletes the target bucket and all of its contents.

        If the target bucket does not exist, this method does nothing.

        This is a 'complex operation' in that it happens in multiple phases. The phases are as follows:

        • Fetch a list of all the contents of the target bucket.

        • Delete all the contents of the target bucket.

        • Delete the bucket itself.

        Due to the nature of S3 operations, there exists the possibility of a race condition where additional objects are inserted into the bucket after phase 1 or 2 which will cause the bucket delete operation to fail with an S3ErrorCode.BucketNotEmpty error.

        Parameters:
        name - Name of the bucket to delete.
      • deleteRecursive

         abstract Unit deleteRecursive(BucketName name, Function1<RecursiveBucketDeleteParams, Unit> action)

        Deletes the target bucket and all of its contents.

        If the target bucket does not exist, this method does nothing.

        This is a 'complex operation' in that it happens in multiple phases. The phases are as follows:

        • Fetch a list of all the contents of the target bucket.

        • Delete all the contents of the target bucket.

        • Delete the bucket itself.

        Due to the nature of S3 operations, there exists the possibility of a race condition where additional objects are inserted into the bucket after phase 1 or 2 which will cause the bucket delete operation to fail with an S3ErrorCode.BucketNotEmpty error.

        Parameters:
        action - Action used to configure the S3 operation parameters.
      • deleteRecursive

         abstract Unit deleteRecursive(BucketName name, RecursiveBucketDeleteParams params)

        Deletes the target bucket and all of its contents.

        If the target bucket does not exist, this method does nothing.

        This is a 'complex operation' in that it happens in multiple phases. The phases are as follows:

        • Fetch a list of all the contents of the target bucket.

        • Delete all the contents of the target bucket.

        • Delete the bucket itself.

        Due to the nature of S3 operations, there exists the possibility of a race condition where additional objects are inserted into the bucket after phase 1 or 2 which will cause the bucket delete operation to fail with an S3ErrorCode.BucketNotEmpty error.

        Parameters:
        params - S3 operation parameters.