-
- All Implemented Interfaces:
public interface BucketContainerRepresents 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")
-
-
Method Summary
Modifier and Type Method Description abstract <R extends Any> RwithBucket(BucketName name, Function1<S3Bucket, R> action)Executes the given action on the target bucket. abstract Booleanexists(BucketName name)Tests for the existence of a bucket with the given name. abstract Booleanexists(BucketName name, Function1<BucketExistsParams, Unit> action)Tests for the existence of a bucket with the operation configured by the given action. abstract Booleanexists(BucketName name, BucketExistsParams params)Tests for the existence of a bucket with the operation configured by the given params. abstract S3Bucketcreate(BucketName name)Attempts to create a bucket with the given name. abstract S3Bucketcreate(BucketName name, Function1<BucketPutParams, Unit> action)Attempts to create a bucket with the given name with the operation configured by the given action. abstract S3Bucketcreate(BucketName name, BucketPutParams params)Attempts to create a bucket with the given name with the operation configured by the given params. abstract S3BucketcreateIfNotExists(BucketName name)Attempts to create a bucket with the given name if it does not already exist in the S3 instance. abstract S3BucketcreateIfNotExists(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. abstract S3BucketcreateIfNotExists(BucketName name, BucketUpsertParams params)Attempts to create a bucket with the given name if it does not already exist in the S3 instance. abstract S3Bucketget(BucketName name)Creates a new S3Bucket instance wrapping the target S3 bucket. abstract S3Bucketget(BucketName name, Function1<BucketGetParams, Unit> action)Creates a new S3Bucket instance wrapping the target S3 bucket. abstract S3Bucketget(BucketName name, BucketGetParams params)Creates a new S3Bucket instance wrapping the target S3 bucket. abstract BucketListlist()Fetches a list of all buckets available on the target S3 instance. abstract BucketListlist(Function1<BucketListParams, Unit> action)Fetches a list of all buckets available on the target S3 instance. abstract BucketListlist(BucketListParams params)Fetches a list of all buckets available on the target S3 instance. abstract Unitdelete(BucketName name)Deletes the target bucket from the S3 instance. abstract Unitdelete(BucketName name, Function1<BucketDeleteParams, Unit> action)Deletes the target bucket from the S3 instance. abstract Unitdelete(BucketName name, BucketDeleteParams params)Deletes the target bucket from the S3 instance. abstract UnitdeleteRecursive(BucketName name)Deletes the target bucket and all of its contents. abstract UnitdeleteRecursive(BucketName name, Function1<RecursiveBucketDeleteParams, Unit> action)Deletes the target bucket and all of its contents. abstract UnitdeleteRecursive(BucketName name, RecursiveBucketDeleteParams params)Deletes the target bucket and all of its contents. -
-
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.
-
exists
abstract Boolean exists(BucketName name, Function1<BucketExistsParams, Unit> action)
Tests for the existence of a bucket with the operation configured by the given action.
- Parameters:
action- Action to configure the S3 operation.
-
exists
abstract Boolean exists(BucketName name, BucketExistsParams params)
Tests for the existence of a bucket with the operation configured by the given params.
- Parameters:
params- S3 operation parameters.
-
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.
-
get
abstract S3Bucket get(BucketName name, Function1<BucketGetParams, Unit> action)
Creates a new S3Bucket instance wrapping the target S3 bucket.
- Parameters:
action- Action used to configure the S3 operation parameters.
-
get
abstract S3Bucket get(BucketName name, BucketGetParams params)
Creates a new S3Bucket instance wrapping the target S3 bucket.
- Parameters:
params- S3 operation parameters.
-
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.
-
-
-
-