public interface

SimpleAmazonS3

org.mule.module.s3.simpleapi.SimpleAmazonS3
Known Indirect Subclasses

Class Overview

A Amazon S3 facade roughly based on com.amazonaws.services.s3.AmazonS3 interface, but that simplifies it by adding consistent versioning support. Otherwise stated, all messages that take S3ObjectId are aware of versioning, that is, if isVersioned(), then operations try to affect the specified version.

Not all messages of com.amazonaws.services.s3.AmazonS3 interface are exposed here. However, those exposed share the same semantics of that interface.

Exception handling:
  • All operations will throw IllegalArgumentException if a non null or non empty constraint is violated
  • All operations will throw com.amazonaws.AmazonServiceException if a s3 restriction is violated, like for example, trying to create a bucket without permissions
  • All operation will throw com.amazonaws.AmazonClientException if any communication or unexpected error occurs

Summary

Nested Classes
interface SimpleAmazonS3.S3ObjectContent The content to be uploaded to S3, capable of creating a PutObjectRequest. 
Public Methods
abstract String copyObject(S3ObjectId source, S3ObjectId destination, ConditionalConstraints conditionalConstraints, CannedAccessControlList acl, StorageClass storageClass, Map<String, String> destinationUserMetadata)
Copies a source object, with optional version, to a destination, with optional destination object acl.
abstract Bucket createBucket(String bucketName, Region region, CannedAccessControlList acl)
Creates a Bucket.
abstract String createObject(S3ObjectId objectId, SimpleAmazonS3.S3ObjectContent content, String contentType, String contentDisposition, CannedAccessControlList acl, StorageClass storageClass, Map<String, String> userMetadata)
Creates an object, uploading its contents, and optionally setting its CannedAccessControlList and StorageClass
abstract URI createObjectPresignedUri(S3ObjectId objectId, Date expiration, HttpMethod method)
Creates a presigned URL for accessing the object of the given id, with an optional http method and date expiration.
abstract URI createObjectUri(S3ObjectId objectId, boolean secure)
abstract URI createObjectUriUsingDefaultServer(S3ObjectId objectId, boolean secure)
abstract void deleteBucket(String bucketName)
Deletes a Bucket
abstract void deleteBucketAndObjects(String bucketName)
Deletes a Bucket, deleting also all its contents if necessary
abstract void deleteBucketPolicy(String bucketName)
abstract void deleteBucketWebsiteConfiguration(String bucketName)
abstract void deleteObject(S3ObjectId objectId)
Deletes an object.
abstract void deleteObjects(String bucketName, List<KeyVersion> keys)
Deletes all objects
abstract String getBucketPolicy(String bucketName)
Answers the bucket policy, or null, if not set .
abstract BucketVersioningConfiguration getBucketVersioningConfiguration(String bucketName)
Returns the bucket versioning configuration for the specified bucket.
abstract BucketWebsiteConfiguration getBucketWebsiteConfiguration(String bucketName)
Returns the versioning configuration for the specified bucket.
abstract S3Object getObject(S3ObjectId objectId, ConditionalConstraints conditionalConstraints)
Retrieves an object from S3 given its id.
abstract S3ObjectInputStream getObjectContent(S3ObjectId objectId, ConditionalConstraints conditionalConstraints)
Answers the object content a given S3ObjectId.
abstract ObjectMetadata getObjectMetadata(S3ObjectId objectId)
Answers the ObjectMetadata for a given S3ObjectId@return
abstract List<Bucket> listBuckets()
abstract Iterable<S3VersionSummary> listObjectVersions(String bucketName)
abstract Iterable<S3ObjectSummary> listObjects(String bucketName, String prefix)
abstract void setBucketPolicy(String bucketName, String policyText)
abstract void setBucketVersioningStatus(String bucketName, VersioningStatus versioningStatus)
abstract void setBucketWebsiteConfiguration(String bucketName, BucketWebsiteConfiguration configuration)
Sets the website configuration for the specified bucket.
abstract void setObjectStorageClass(S3ObjectId objectId, StorageClass newStorageClass)

Public Methods

public abstract String copyObject (S3ObjectId source, S3ObjectId destination, ConditionalConstraints conditionalConstraints, CannedAccessControlList acl, StorageClass storageClass, Map<String, String> destinationUserMetadata)

Copies a source object, with optional version, to a destination, with optional destination object acl.

Parameters
source
destination The destination object. If this id is versioned, its version is ignored
conditionalConstraints The constraints to be matched in order to proceed with copy. If not matched, no copy is performed
acl
storageClass
destinationUserMetadata
Returns
  • the version id of the destination object, if versioning is enabled

public abstract Bucket createBucket (String bucketName, Region region, CannedAccessControlList acl)

Creates a Bucket.

Parameters
bucketName Mandatory
region Optional
acl Optional
Returns
  • the new Bucket
Throws
AmazonServiceException

public abstract String createObject (S3ObjectId objectId, SimpleAmazonS3.S3ObjectContent content, String contentType, String contentDisposition, CannedAccessControlList acl, StorageClass storageClass, Map<String, String> userMetadata)

Creates an object, uploading its contents, and optionally setting its CannedAccessControlList and StorageClass

Parameters
objectId The id of the object to be created. If its versioned, its version is ignored
content
contentType
contentDisposition
acl
storageClass
userMetadata
Returns
  • the version id, if the versioning was enabled

public abstract URI createObjectPresignedUri (S3ObjectId objectId, Date expiration, HttpMethod method)

Creates a presigned URL for accessing the object of the given id, with an optional http method and date expiration.

Parameters
objectId
expiration If no expiration is supplied, a default expiration provided by AmazonS3 will be used
method If no method is supplied, PUT method is assumed
See Also
  • AmazonS3#generatePresignedUrl(com.amazonaws.services.s3.model. GeneratePresignedUrlRequest)

public abstract URI createObjectUri (S3ObjectId objectId, boolean secure)

Parameters
objectId
secure

public abstract URI createObjectUriUsingDefaultServer (S3ObjectId objectId, boolean secure)

Parameters
objectId
secure

public abstract void deleteBucket (String bucketName)

Deletes a Bucket

Parameters
bucketName

public abstract void deleteBucketAndObjects (String bucketName)

Deletes a Bucket, deleting also all its contents if necessary

Parameters
bucketName

public abstract void deleteBucketPolicy (String bucketName)

Parameters
bucketName

public abstract void deleteBucketWebsiteConfiguration (String bucketName)

Parameters
bucketName

public abstract void deleteObject (S3ObjectId objectId)

Deletes an object.

Parameters
objectId

public abstract void deleteObjects (String bucketName, List<KeyVersion> keys)

Deletes all objects

Parameters
bucketName Mandatory bucket name
keys Keys to delete, with optional version
Throws
MultiObjectDeleteException if one or more of the objects couldn't be deleted.
AmazonClientException If any errors are encountered in the client while making the request or handling the response.
AmazonServiceException If any errors occurred in Amazon S3 while processing the request.

public abstract String getBucketPolicy (String bucketName)

Answers the bucket policy, or null, if not set .

Parameters
bucketName
Returns
  • the nullable bucket policy text

public abstract BucketVersioningConfiguration getBucketVersioningConfiguration (String bucketName)

Returns the bucket versioning configuration for the specified bucket.

Parameters
bucketName The bucket versioning configuration for the specified bucket.
Returns
  • The bucket versioning configuration for the specified bucket.

public abstract BucketWebsiteConfiguration getBucketWebsiteConfiguration (String bucketName)

Returns the versioning configuration for the specified bucket.

Parameters
bucketName The bucket whose versioning configuration will be retrieved.
Returns
  • The bucket versioning configuration for the specified bucket.

public abstract S3Object getObject (S3ObjectId objectId, ConditionalConstraints conditionalConstraints)

Retrieves an object from S3 given its id. Warning: use this method with caution, as the retrieved object has an already open inputStream to the object contents. It should be closed quickly.

Parameters
objectId
conditionalConstraints
Returns
  • the object, or null, if conditional request constraints were not met

public abstract S3ObjectInputStream getObjectContent (S3ObjectId objectId, ConditionalConstraints conditionalConstraints)

Answers the object content a given S3ObjectId.

Parameters
objectId
conditionalConstraints
Returns
  • an input stream to the contents of the object, or null, if there conditional request contraints were not met
See Also
  • AmazonS3#getObject(com.amazonaws.services.s3.model.GetObjectMetadataRequest)

public abstract ObjectMetadata getObjectMetadata (S3ObjectId objectId)

Answers the ObjectMetadata for a given S3ObjectId@return

Parameters
objectId

public abstract List<Bucket> listBuckets ()

public abstract Iterable<S3VersionSummary> listObjectVersions (String bucketName)

Parameters
bucketName

public abstract Iterable<S3ObjectSummary> listObjects (String bucketName, String prefix)

Parameters
bucketName
prefix

public abstract void setBucketPolicy (String bucketName, String policyText)

Parameters
bucketName
policyText

public abstract void setBucketVersioningStatus (String bucketName, VersioningStatus versioningStatus)

Parameters
bucketName
versioningStatus

public abstract void setBucketWebsiteConfiguration (String bucketName, BucketWebsiteConfiguration configuration)

Sets the website configuration for the specified bucket.

Parameters
bucketName
configuration

public abstract void setObjectStorageClass (S3ObjectId objectId, StorageClass newStorageClass)

Parameters
objectId
newStorageClass