public class

S3Connector

extends Object
java.lang.Object
   ↳ org.mule.module.s3.S3Connector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Amazon S3 (Simple Storage Service) is an online storage web service offered by Amazon Web Services. Amazon S3 Connector provides storage through web services interfaces provided by AWS SDKs.

Summary

Fields
private AmazonS3 amazonS3
private Config config
Public Constructors
S3Connector()
Public Methods
void abortMultipartUpload(String bucketName, String key, String uploadId)
Aborts a multipart upload.
CompleteMultipartUploadResult completeMultipartUpload(String bucketName, String key, String uploadId, List<PartETag> partETags)
Completes a multipart upload by assembling previously uploaded parts.
ObjectResult copyObject(String sourceBucketName, String sourceKey, String sourceVersionId, String destinationBucketName, String destinationKey, CannedAccessControlList destinationAcl, StorageClass destinationStorageClass, Map<String, String> destinationUserMetadata, Date modifiedSince, Date unmodifiedSince, String encryption)
Copies a source object to a new destination; to copy an object, the caller's account must have read access to the source object and write access to the destination bucket.
Bucket createBucket(String bucketName, Region region, CannedAccessControlList acl)
Creates a new bucket; connector must not be configured as anonymous for this operation to succeed.
ObjectResult createObject(String bucketName, String key, Object content, Long contentLength, String contentMd5, String contentType, String contentDisposition, CannedAccessControlList acl, StorageClass storageClass, Map<String, String> userMetadata, String encryption)
Uploads an object to S3.
URI createObjectPresignedUri(String bucketName, String key, Date expiration, String contentMd5, String contentType, HttpMethod method)
Returns a pre-signed URL for accessing an Amazon S3 object.
void deleteBucket(String bucketName, boolean force)
Deletes the specified bucket.
void deleteBucketCorsConfiguration(String bucketName)
Deletes the Cross Origin Configuration information set for the bucket.
void deleteBucketLifecycleConfiguration(String bucketName)
Deletes the lifecycle configuration from the specified bucket.
void deleteBucketPolicy(String bucketName)
Deletes the bucket's policy.
void deleteBucketTaggingConfiguration(String bucketName)
Deletes the tagging configuration associated with the specified bucket.
void deleteBucketWebsiteConfiguration(String bucketName)
Removes the website configuration for a bucket; this operation requires the DeleteBucketWebsite permission.
void deleteObject(String bucketName, String key, String versionId)
Deletes a given object, only the owner of the bucket containing the version can perform this operation.
void deleteObjects(String bucketName, List<KeyVersion> keys)
Deletes multiple objects in a single bucket from S3.
AccessControlList getBucketAcl(String bucketName)
Answers the access control list of the specified bucket.
List<CORSRule> getBucketCorsConfiguration(String bucketName)
Answers the cors configuration information set for the bucket.
List<BLCRule> getBucketLifecycleConfiguration(String bucketName)
Returns the lifecycle configuration information set on the bucket.
String getBucketLocation(String bucketName)
Gets the geographical region where Amazon S3 stores the specified bucket.
BucketLoggingConfiguration getBucketLoggingConfiguration(String bucketName)
Answers the logging status of a bucket and the permissions users have to view and modify that status.
Map<String, TopicConfiguration> getBucketNotificationConfiguration(String bucketName)
Return the notification configuration of a bucket.
String getBucketPolicy(String bucketName)
Answers the policy for the given bucket.
List<TagSet> getBucketTaggingConfiguration(String bucketName)
Return the tag set associated with the bucket.
BucketVersioningConfiguration getBucketVersioningConfiguration(String bucketName)
Returns the versioning configuration for the specified bucket.
BucketWebsiteConfiguration getBucketWebsiteConfiguration(String bucketName)
Answers the website of the given bucket.
Config getConfig()
S3Object getObject(String bucketName, String key, String versionId, Date modifiedSince, Date unmodifiedSince)
Gets the object stored in Amazon S3 under the specified bucket and key.
AccessControlList getObjectAcl(String bucketName, String key, String versionId)
Returns the access control list (ACL) of an object.
TransformingValue<S3ObjectInputStream, DataType<S3ObjectInputStream>> getObjectContent(String bucketName, String key, String versionId, Date modifiedSince, Date unmodifiedSince, String mimeType, String encoding)
Gets the content of an object stored in Amazon S3 under the specified bucket and key.
S3ObjectMetadata getObjectMetadata(String bucketName, String key, String versionId)
Gets the metadata for the specified Amazon S3 object without actually fetching the object itself.
String initiateMultipartUpload(String bucketName, String key, S3ObjectMetadata objectMetadata, CannedAccessControlList acl, StorageClass storageClass, String redirectLocation)
Initiates a multipart upload and returns an upload ID.
List<Bucket> listBuckets()
Answers a list of all Amazon S3 buckets that the authenticated sender of the request owns.
MultipartUploadListing listMultipartUploads(String bucketName, String delimiter, String encodingType, String keyMarker, Integer maxUploads, String prefix, String uploadIdMarker)
Lists in-progress multipart uploads.
ObjectListing listNextBatchOfObjects(ObjectListing previousObjectListing)
Provides an easy way to continue a truncated object listing and retrieve the next page of results.
VersionListing listNextBatchOfVersions(VersionListing previousVersionListing)
Provides an easy way to continue a truncated VersionListing and retrieve the next page of results.
ObjectListing listObjects(String bucketName, String prefix, String marker, String delimiter, Integer maxKeys, EncodingType encodingType)
Lazily lists all objects for a given prefix.
PartListing listParts(String bucketName, String key, String uploadId, String encodingType, Integer maxParts, Integer partNumberMarker)
Lists the parts that have been uploaded for a specific multipart upload.
VersionListing listVersions(String bucketName, String prefix, String keyMarker, String versionIdMarker, String delimiter, Integer maxResults, EncodingType encodingType)
Lazily lists all object versions for a given bucket that has versioning enabled.
void setBucketAcl(String bucketName, AccessControlList acl)
Set the permissions on an existing bucket using access control lists (ACL)

void setBucketCorsConfiguration(String bucketName, List<CORSRule> crossOriginConfigurationRules)
Sets the cors configuration for your bucket.
void setBucketLifecycleConfiguration(String bucketName, List<BLCRule> lifecycleConfigurationRules)
Creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration.
void setBucketLoggingConfiguration(String bucketName, String destinationBucketName, String logFilePrefix)
Set the logging parameters for a bucket and to specify permissions for who can view and modify the logging parameters.
void setBucketNotificationConfiguration(String bucketName, Map<String, TopicConfiguration> topicConfigurations)
Sets the notification configuration for the specified bucket.
void setBucketPolicy(String bucketName, String policyText)
Sets the bucket's policy, overriding any previously set.
void setBucketTaggingConfiguration(String bucketName, List<TagSet> tagSets)
Add a set of tags to an existing bucket

void setBucketVersioningConfiguration(String bucketName, VersioningStatus status)
Sets the versioning status for the given bucket.
void setBucketWebsiteConfiguration(String bucketName, BucketWebsiteConfiguration bucketWebsiteConfiguration)
Sets the given bucket's website configuration.
void setConfig(Config config)
void setObjectAcl(String bucketName, String key, String versionId, AccessControlList acl)
Set the access control list (ACL) permissions for an object that already exists in a bucket

void setObjectStorageClass(String bucketName, String key, StorageClass storageClass)
Sets the Amazon S3 storage class for the given object.
UploadPartResult uploadPart(String bucketName, String key, String uploadId, Integer partNumber, Long partSize, String md5Digest, InputStream content, File file, Long fileOffset, boolean isLastPart)
Uploads a part in a multipart upload.
CopyPartResult uploadPartCopy(String sourceBucketName, String sourceKey, String sourceVersionId, String destinationBucketName, String destinationKey, String uploadId, Integer partNumber, List<String> matchingETagConstraints, Date modifiedSince, Date unmodifiedSince)
Copies a source object to a part of a multipart upload.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private AmazonS3 amazonS3

private Config config

Public Constructors

public S3Connector ()

Public Methods

public void abortMultipartUpload (String bucketName, String key, String uploadId)

Aborts a multipart upload. After a multipart upload is aborted, no additional parts can be uploaded using that upload ID. The storage consumed by any previously uploaded parts will be freed. However, if any part uploads are currently in progress, those part uploads may or may not succeed. As a result, it may be necessary to abort a given multipart upload multiple times in order to completely free all storage consumed by all parts.

Parameters
bucketName The name of the bucket containing the multipart upload to abort.
key The key of the multipart upload to abort.
uploadId The ID of the upload to abort.

public CompleteMultipartUploadResult completeMultipartUpload (String bucketName, String key, String uploadId, List<PartETag> partETags)

Completes a multipart upload by assembling previously uploaded parts.

Parameters
bucketName The name of the bucket containing the multipart upload to complete.
key The key under which the multipart upload to complete is stored.
uploadId The ID of the multipart upload to complete.
partETags The list of part numbers and ETags that identify the individual parts of the multipart upload to complete.
Returns
  • A CompleteMultipartUploadResult from S3 containing the ETag for the new object composed of the individual parts.

public ObjectResult copyObject (String sourceBucketName, String sourceKey, String sourceVersionId, String destinationBucketName, String destinationKey, CannedAccessControlList destinationAcl, StorageClass destinationStorageClass, Map<String, String> destinationUserMetadata, Date modifiedSince, Date unmodifiedSince, String encryption)

Copies a source object to a new destination; to copy an object, the caller's account must have read access to the source object and write access to the destination bucket. By default, all object metadata for the source object are copied to the new destination object, unless new object metadata in the specified is provided. The AccessControlList is not copied to the new object, and, unless another ACL specified, PRIVATE is assumed. If no destination bucket is specified, the same that the source bucket is used - local copy.

Parameters
sourceBucketName The source object's bucket
sourceKey The source object's key
sourceVersionId The specific version of the source object to copy, if versioning is enabled. Left unspecified if the latest version is desired, or versioning is not enabled.
destinationBucketName The destination object's bucket. If none provided, a local copy is performed, that is, it is copied within the same bucket.
destinationKey The destination object's key
destinationAcl The acl of the destination object.
destinationStorageClass One of StorageClass enumerated values, defaults to STANDARD
destinationUserMetadata The new metadata of the destination object, that if specified, overrides that copied from the source object
modifiedSince The modified constraint that restricts this request to executing only if the object has been modified after the specified date. This constraint is specified but does not match, no copy is performed
unmodifiedSince The unmodified constraint that restricts this request to executing only if the object has not been modified after this date. This constraint is specified but does not match, no copy is performed
encryption Encryption method for server-side encryption. Supported value AES256.
Returns
  • the version id of the new object, or null, if versioning is not enabled

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

Creates a new bucket; connector must not be configured as anonymous for this operation to succeed. Bucket names must be unique across all of Amazon S3, that is, among all their users. Bucket ownership is similar to the ownership of Internet domain names. Within Amazon S3, only a single user owns each bucket. Once a uniquely named bucket is created in Amazon S3, organize and name the objects within the bucket in any way. Ownership of the bucket is retained as long as the owner has an Amazon S3 account. To conform with DNS requirements, buckets names must: not contain underscores, be between 3 and 63 characters long, not end with a dash, not contain adjacent periods, not contain dashes next to periods and not contain uppercase characters. Do not make bucket create or delete calls in the high availability code path of an application. Create or delete buckets in a separate initialization or setup.

Parameters
bucketName The bucket to create. It must not exist yet.
region The region where to create the new bucket
acl The access control list of the new bucket
Returns
  • the non null, new Bucket

public ObjectResult createObject (String bucketName, String key, Object content, Long contentLength, String contentMd5, String contentType, String contentDisposition, CannedAccessControlList acl, StorageClass storageClass, Map<String, String> userMetadata, String encryption)

Uploads an object to S3. Supported contents are InputStreams, Strings, byte arrays and Files.

Parameters
bucketName The object's bucket
key The object's key
content The content to be uploaded to S3, capable of creating a com.amazonaws.services.s3.model.PutObjectRequest.
contentLength The content length. If content is a InputStream, this parameter should be specified, as not doing so will introduce a performance loss as the contents will have to be persisted on disk before being uploaded. Otherwise, it is ignored. An exception to this rule are InputStreams returned by Mule Http Connector: if stream has Content-Length information, it will be used. In any case a content length of 0 is interpreted as an unspecified content length
contentMd5 The content md5, encoded in base 64. If content is a file, it is ignored.
contentType The content type of the new object.
contentDisposition The content disposition of the new object.
acl The access control list of the new object
storageClass The storage class of the new object
userMetadata A map of arbitrary object properties keys and values
encryption Encryption method for server-side encryption. Supported value AES256.
Returns
  • the objectResult of the created object.
Throws
IOException if there are problems manipulating the File or InputStream content

public URI createObjectPresignedUri (String bucketName, String key, Date expiration, String contentMd5, String contentType, HttpMethod method)

Returns a pre-signed URL for accessing an Amazon S3 object. The pre-signed URL can be shared to other users, allowing access to the resource without providing an account's AWS security credentials.

Parameters
bucketName The name of the bucket involved in this request.
key The key of the object involved in this request.
expiration The expiration date at which point the new pre-signed URL will no longer be accepted by Amazon S3.
contentMd5 The expected content-md5 header of the request.
contentType The expected content-type of the request.
method The HTTP method (GET, PUT, DELETE, HEAD) to be used in this request.
Returns
  • A non null pre-signed URI that can be used to access an Amazon S3 resource without requiring the user of the URL to know the account's AWS security credentials.

public void deleteBucket (String bucketName, boolean force)

Deletes the specified bucket. All objects (and all object versions, if versioning was ever enabled) in the bucket must be deleted before the bucket itself can be deleted; this restriction can be relaxed by specifying the attribute force="true".

Parameters
bucketName The bucket to delete
force Optional true if the bucket must be deleted even if it is not empty, false if operation should fail in such scenario.

public void deleteBucketCorsConfiguration (String bucketName)

Deletes the Cross Origin Configuration information set for the bucket. To use this operation, you must have permission to perform the s3:PutCORSConfiguration action. The bucket owner has this permission by default and can grant this permission to others.

Parameters
bucketName The bucket to delete Cross Origin Configuration.

public void deleteBucketLifecycleConfiguration (String bucketName)

Deletes the lifecycle configuration from the specified bucket. Amazon S3 removes all the lifecycle configuration rules in the lifecycle subresource associated with the bucket. Your objects never expire, and Amazon S3 no longer automatically deletes any objects on the basis of rules contained in the deleted lifecycle configuration.

Parameters
bucketName The bucket whose lifecycle configuration to delete.

public void deleteBucketPolicy (String bucketName)

Deletes the bucket's policy. Only the owner of the bucket can delete the bucket policy. Bucket policies provide access control management at the bucket level for both the bucket resource and contained object resources.

Parameters
bucketName The bucket whose policy to delete

public void deleteBucketTaggingConfiguration (String bucketName)

Deletes the tagging configuration associated with the specified bucket. By default, the bucket owner has this permission and can grant this permission to others.

Parameters
bucketName The bucket whose tag to delete.

public void deleteBucketWebsiteConfiguration (String bucketName)

Removes the website configuration for a bucket; this operation requires the DeleteBucketWebsite permission. By default, only the bucket owner can delete the website configuration attached to a bucket. However, bucket owners can grant other users permission to delete the website configuration by writing a bucket policy granting them the S3:DeleteBucketWebsite permission. Calling this operation on a bucket with no website configuration does not fail, but calling this operation a bucket that does not exist does.

Parameters
bucketName The bucket whose website configuration to delete

public void deleteObject (String bucketName, String key, String versionId)

Deletes a given object, only the owner of the bucket containing the version can perform this operation. If version is specified, versioning must be enabled, and once deleted, there is no method to restore such version. Otherwise, once deleted, the object can only be restored if versioning was enabled when the object was deleted. If attempting to delete an object that does not exist, Amazon S3 will return a success message instead of an error message.

Parameters
bucketName The object's bucket
key The object's key
versionId The specific version of the object to delete, if versioning is enabled.

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

Deletes multiple objects in a single bucket from S3. Version of the keys is optional.

In some cases, some objects will be successfully deleted, while some attempts will cause an error. If any object in the request cannot be deleted, this method throws a com.amazonaws.services.s3.model.MultiObjectDeleteException with details of the error.

Parameters
bucketName The objects bucket name
keys The objects keys, version is optional

public AccessControlList getBucketAcl (String bucketName)

Answers the access control list of the specified bucket.

Parameters
bucketName The bucket whose acl to retrieve.
Returns
  • a AccessControlList object.

public List<CORSRule> getBucketCorsConfiguration (String bucketName)

Answers the cors configuration information set for the bucket.

Parameters
bucketName The bucket whose cors to retrieve.
Returns
  • a list of CORSRules elements.

public List<BLCRule> getBucketLifecycleConfiguration (String bucketName)

Returns the lifecycle configuration information set on the bucket.

Parameters
bucketName The bucket whose lifecycle configuration information to retrieve.
Returns
  • a list of BucketLifecycleConfiguration rules.

public String getBucketLocation (String bucketName)

Gets the geographical region where Amazon S3 stores the specified bucket.

Parameters
bucketName The target bucket name.
Returns
  • the location of the specified Amazon S3 bucket.

public BucketLoggingConfiguration getBucketLoggingConfiguration (String bucketName)

Answers the logging status of a bucket and the permissions users have to view and modify that status.

Parameters
bucketName The bucket whose logging status to retrieve.
Returns
  • the BucketLoggingConfiguration element.

public Map<String, TopicConfiguration> getBucketNotificationConfiguration (String bucketName)

Return the notification configuration of a bucket. Currently only topic configuration is supported.

Parameters
bucketName The bucket whose notification configuration to retrieve.
Returns
  • the list of TopicConfigurations.

public String getBucketPolicy (String bucketName)

Answers the policy for the given bucket. Only the owner of the bucket can retrieve it. If no policy has been set for the bucket, then a null policy text field will be returned.

Parameters
bucketName The bucket whose policy to retrieve
Returns
  • the bucket policy, or null, if not set

public List<TagSet> getBucketTaggingConfiguration (String bucketName)

Return the tag set associated with the bucket.

Parameters
bucketName The bucket whose tagging configuration to retrieve.
Returns
  • the list of tag sets.

public BucketVersioningConfiguration getBucketVersioningConfiguration (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 BucketWebsiteConfiguration getBucketWebsiteConfiguration (String bucketName)

Answers the website of the given bucket. This operation requires the GetBucketWebsite permission. By default, only the bucket owner can read the bucket website configuration. However, bucket owners can allow other users to read the website configuration by writing a bucket policy granting them the GetBucketWebsite permission.

Parameters
bucketName The target bucket's name
Returns
  • the bucket website configuration for the specified bucket.

public Config getConfig ()

public S3Object getObject (String bucketName, String key, String versionId, Date modifiedSince, Date unmodifiedSince)

Gets the object stored in Amazon S3 under the specified bucket and key. Returns null if the specified constraints weren't met. To get an object from Amazon S3, the caller must have Read access to the object. Callers should be very careful when using this method; the returned Amazon S3 object contains a direct stream of data from the HTTP connection. The underlying HTTP connection cannot be closed until the user finishes reading the data and closes the stream. Regarding conditional get constraints, Amazon S3 will ignore any dates occurring in the future.

Parameters
bucketName The object's bucket
key The object's key
versionId The specific version of the object to get its contents, if versioning is enabled. Left unspecified if the latest version is desired, or versioning is not enabled.
modifiedSince The modified constraint that restricts this request to executing only if the object has been modified after the specified date.
unmodifiedSince The unmodified constraint that restricts this request to executing only if the object has not been modified after this date.
Returns
  • the S3Object, or null, if conditional get constraints did not match

public AccessControlList getObjectAcl (String bucketName, String key, String versionId)

Returns the access control list (ACL) of an object. By default, GET returns ACL information about the current version of an object. To return ACL information about a different version, use the versionId attribute.

Parameters
bucketName The object's bucket
key The object's key
versionId The object's version id
Returns
  • the access control list

public TransformingValue<S3ObjectInputStream, DataType<S3ObjectInputStream>> getObjectContent (String bucketName, String key, String versionId, Date modifiedSince, Date unmodifiedSince, String mimeType, String encoding)

Gets the content of an object stored in Amazon S3 under the specified bucket and key. Be extremely careful when using this method; the returned Amazon S3 object contains a direct stream of data from the HTTP connection. The underlying HTTP connection cannot be closed until the user finishes reading the data and closes the stream. Callers should therefore:

  • Use the data from the input stream as soon as possible,
  • Close the input stream as soon as possible.
If callers do not follow those rules, then the client can run out of resources if allocating too many open, but unused, HTTP connections.

Parameters
bucketName The object's bucket
key The object's key
versionId The specific version of the object to get its contents, if versioning is enabled, left unspecified if the latest version is desired, or versioning is not enabled.
modifiedSince The modified constraint that restricts this request to executing only if the object has been modified after the specified date.
unmodifiedSince The unmodified constraint that restricts this request to executing only if the object has not been modified after this date.
mimeType Specifies the mimetype of the object
encoding Specifies the encding used for the ObjectContent
Returns
  • The object stream stored in Amazon S3 in the specified bucket and key. Returns null if constraints were specified but not met.

public S3ObjectMetadata getObjectMetadata (String bucketName, String key, String versionId)

Gets the metadata for the specified Amazon S3 object without actually fetching the object itself. This is useful in obtaining only the object metadata, and avoids wasting bandwidth on fetching the object data.

Parameters
bucketName The object's bucket
key The object's key
versionId The object metadata for the given bucketName and key
Returns
  • the non null object metadata

public String initiateMultipartUpload (String bucketName, String key, S3ObjectMetadata objectMetadata, CannedAccessControlList acl, StorageClass storageClass, String redirectLocation)

Initiates a multipart upload and returns an upload ID. This upload ID is used to associate all the parts in the specific multipart upload. You specify this upload ID in each of your subsequent upload part requests. You also include this upload ID in the final request to either complete or abort the multipart upload request.

Parameters
bucketName The name of the bucket in which to create the new multipart upload.
key The key by which to store the new multipart upload.
objectMetadata The additional information about the new object being created, such as content type, content encoding, user metadata, etc.
acl The optional canned Access Control List (ACL) to set permissions for the new object created when the multipart upload is completed.
storageClass The optional storage class to use when storing this upload's data in S3.
redirectLocation Gets the optional redirect location for the new object.
Returns
  • An Upload ID from Amazon S3.

public List<Bucket> listBuckets ()

Answers a list of all Amazon S3 buckets that the authenticated sender of the request owns. Users must authenticate with a valid AWS Access Key ID that is registered with Amazon S3. Anonymous requests cannot list buckets, and users cannot list buckets that they did not create.

Returns
  • A list of all of the Amazon S3 buckets owned by the authenticated sender of the request.

public MultipartUploadListing listMultipartUploads (String bucketName, String delimiter, String encodingType, String keyMarker, Integer maxUploads, String prefix, String uploadIdMarker)

Lists in-progress multipart uploads. An in-progress multipart upload is a multipart upload that has been initiated, using the InitiateMultipartUpload request, but has not yet been completed or aborted.

Parameters
bucketName The name of the bucket containing the uploads to list.
delimiter The optional delimiter parameter that causes multipart uploads for keys that contain the same string between the prefix and the first occurrence of the delimiter to be combined into a single result element
encodingType The optional encodingType parameter indicating the encoding method to be applied on the response.
keyMarker The optional key marker indicating where in the results to begin listing.
maxUploads The optional maximum number of uploads to return, or null if no maximum number of uploads has been set for this request.
prefix The optional prefix parameter that restricts the response to multipart uploads for keys that begin with the specified prefix.
uploadIdMarker The optional upload ID marker indicating where in the results to begin listing.
Returns
  • A MultipartUploadListing from Amazon S3.

public ObjectListing listNextBatchOfObjects (ObjectListing previousObjectListing)

Provides an easy way to continue a truncated object listing and retrieve the next page of results.

Parameters
previousObjectListing The previous truncated ObjectListing. If a non-truncated ObjectListing is passed in, an empty ObjectListing is returned without ever contacting Amazon S3.
Returns
  • The next set of ObjectListing results, beginning immediately after the last result in the specified previous ObjectListing.

public VersionListing listNextBatchOfVersions (VersionListing previousVersionListing)

Provides an easy way to continue a truncated VersionListing and retrieve the next page of results.

Parameters
previousVersionListing The previous truncated VersionListing. If a non-truncated VersionListing is passed in, an empty VersionListing is returned without ever contacting Amazon S3.
Returns
  • The next set of VersionListing results, beginning immediately after the last result in the specified previous VersionListing.

public ObjectListing listObjects (String bucketName, String prefix, String marker, String delimiter, Integer maxKeys, EncodingType encodingType)

Lazily lists all objects for a given prefix. As S3 does not limit in any way the number of objects, such listing can retrieve an arbitrary amount of objects, and may need to perform extra calls to the api while it is iterated.

Parameters
bucketName The target bucket's name
prefix The prefix of the objects to be listed. If unspecified, all objects are listed
marker Where in the bucket to begin listing. The list will only include keys that occur lexicographically after the marker
delimiter Causes keys that contain the same string between a prefix and the first occurrence of the delimiter to be rolled up into a single result element. These rolled-up keys are not returned elsewhere in the response. The most commonly used delimiter is "/", which simulates a hierarchical organization similar to a file system directory structure.
maxKeys The maximum number of keys to include in the response. If maxKeys is not specified, Amazon S3 will limit the number of results in the response.
encodingType The encoding method to be applied on the response.
Returns
  • An iterable

public PartListing listParts (String bucketName, String key, String uploadId, String encodingType, Integer maxParts, Integer partNumberMarker)

Lists the parts that have been uploaded for a specific multipart upload.

Parameters
bucketName The name of the bucket containing the multipart upload whose parts are being listed.
key The key of the associated multipart upload whose parts are being listed.
uploadId The ID of the multipart upload whose parts are being listed.
encodingType The optional encodingType parameter indicating the encoding method to be applied on the response.
maxParts The optional maximum number of parts to be returned in the part listing.
partNumberMarker The optional part number marker indicating where in the results to being listing parts.
Returns
  • Returns a PartListing from Amazon S3.

public VersionListing listVersions (String bucketName, String prefix, String keyMarker, String versionIdMarker, String delimiter, Integer maxResults, EncodingType encodingType)

Lazily lists all object versions for a given bucket that has versioning enabled. As S3 does not limit in any way the number of objects, such listing can retrieve an arbitrary amount of object versions, and may need to perform extra calls to the api while it is iterated.

Parameters
bucketName The target bucket's name
prefix Optional parameter restricting the response to keys which begin with the specified prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders.
keyMarker Where in the sorted list of all versions in the specified bucket to begin returning results. Results are always ordered first lexicographically (i.e. alphabetically) and then from most recent version to least recent version. If a keyMarker is used without a versionIdMarker, results begin immediately after that key's last version. When a keyMarker is used with a versionIdMarker, results begin immediately after the version with the specified key and version ID.
versionIdMarker Where in the sorted list of all versions in the specified bucket to begin returning results. Results are always ordered first lexicographically (i.e. alphabetically) and then from most recent version to least recent version. A keyMarker must be specified when specifying a versionIdMarker. Results begin immediately after the version with the specified key and version ID.
delimiter Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the getCommonPrefixes() list. These rolled-up keys are not returned elsewhere in the response. The most commonly used delimiter is "/", which simulates a hierarchical organization similar to a file system directory structure.
maxResults The maximum number of results to include in the response.
encodingType The encoding method to be applied on the response. An object key can contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response.
Returns
  • An iterable

public void setBucketAcl (String bucketName, AccessControlList acl)

Set the permissions on an existing bucket using access control lists (ACL)

Parameters
bucketName The bucket name
acl The ACL of a bucket.

public void setBucketCorsConfiguration (String bucketName, List<CORSRule> crossOriginConfigurationRules)

Sets the cors configuration for your bucket. If the configuration exists, Amazon S3 replaces it.

Parameters
bucketName The bucket name
crossOriginConfigurationRules The cross-origin rules of a bucket.

public void setBucketLifecycleConfiguration (String bucketName, List<BLCRule> lifecycleConfigurationRules)

Creates a new lifecycle configuration for the bucket or replaces an existing lifecycle configuration.

Parameters
bucketName The bucket name
lifecycleConfigurationRules The lifecycle configuration rules of a bucket.

public void setBucketLoggingConfiguration (String bucketName, String destinationBucketName, String logFilePrefix)

Set the logging parameters for a bucket and to specify permissions for who can view and modify the logging parameters.

Parameters
bucketName The bucket name
destinationBucketName The destination bucket name
logFilePrefix The prefix for the keys that the log files will be stored under.

public void setBucketNotificationConfiguration (String bucketName, Map<String, TopicConfiguration> topicConfigurations)

Sets the notification configuration for the specified bucket. By default, new buckets have no notification configuration set.

Parameters
bucketName The name of the Amazon S3 bucket whose notification configuration is being set.
topicConfigurations The request object containing all options for setting the bucket notification configuration.

public void setBucketPolicy (String bucketName, String policyText)

Sets the bucket's policy, overriding any previously set. Only the owner of the bucket can set a bucket policy. Bucket policies provide access control management at the bucket level for both the bucket resource and contained object resources. Only one policy can be specified per-bucket.

Parameters
bucketName The bucket name
policyText The policy text

public void setBucketTaggingConfiguration (String bucketName, List<TagSet> tagSets)

Add a set of tags to an existing bucket

Parameters
bucketName The bucket name
tagSets A set of tags

public void setBucketVersioningConfiguration (String bucketName, VersioningStatus status)

Sets the versioning status for the given bucket. A bucket's versioning configuration can be in one of three possible states: Off, Enabled and Suspended. By default, new buckets are in the Off state. Once versioning is enabled for a bucket the status can never be reverted to Off.

Parameters
bucketName The bucket name
status The version status to set

public void setBucketWebsiteConfiguration (String bucketName, BucketWebsiteConfiguration bucketWebsiteConfiguration)

Sets the given bucket's website configuration. This operation requires the PutBucketWebsite permission. By default, only the bucket owner can configure the website attached to a bucket. However, bucket owners can allow other users to set the website configuration by writing a bucket policy granting them the S3:PutBucketWebsite permission.

Parameters
bucketName The bucket name
bucketWebsiteConfiguration The bucket website configuration

public void setConfig (Config config)

Parameters
config

public void setObjectAcl (String bucketName, String key, String versionId, AccessControlList acl)

Set the access control list (ACL) permissions for an object that already exists in a bucket

Parameters
bucketName The object's bucket name
key The object's key
versionId The specific version of the object
acl The access control list of the object

public void setObjectStorageClass (String bucketName, String key, StorageClass storageClass)

Sets the Amazon S3 storage class for the given object. Changing the storage class of an object in a bucket that has enabled versioning creates a new version of the object with the new storage class. The existing version of the object preservers the previous storage class.

Parameters
bucketName The object's bucket name
key The object's key
storageClass The storage class to set

public UploadPartResult uploadPart (String bucketName, String key, String uploadId, Integer partNumber, Long partSize, String md5Digest, InputStream content, File file, Long fileOffset, boolean isLastPart)

Uploads a part in a multipart upload. You must initiate a multipart upload before you can upload any part.

Parameters
bucketName The name of the bucket containing the existing, initiated multipart upload, with which this new part will be associated.
key The key of the initiated multipart upload.
uploadId The ID of the existing, initiated multipart upload with which this new part will be associated.
partNumber The part number describing this part's position relative to the other parts in the multipart upload.
partSize The size of this part, in bytes.
md5Digest Optional, but recommended, MD5 hash of the content of this part.
content The stream containing the data to upload for the new part.
file The file containing the data to upload.
fileOffset The optional offset in the specified file, at which to begin uploading data for this part.
isLastPart True if the creator of this request has indicated this part is the last part being uploaded in a multipart upload.
Returns
  • An UploadPartResult from Amazon S3 containing the part number and ETag of the new part.

public CopyPartResult uploadPartCopy (String sourceBucketName, String sourceKey, String sourceVersionId, String destinationBucketName, String destinationKey, String uploadId, Integer partNumber, List<String> matchingETagConstraints, Date modifiedSince, Date unmodifiedSince)

Copies a source object to a part of a multipart upload. To copy an object, the caller's account must have read access to the source object and write access to the destination bucket.

Parameters
sourceBucketName The name of the bucket containing the source object to be copied.
sourceKey The source bucket key under which the source object to be copied is stored.
sourceVersionId The version of the source object that was copied, if you have enabled versioning on the source bucket.
destinationBucketName The destination bucket name which will contain the new, copied object.
destinationKey The destination bucket key under which the new, copied object will be stored.
uploadId The ID of the existing, initiated multipart upload with which this new part will be associated.
partNumber The part number describing this part's position relative to the other parts in the multipart upload.
matchingETagConstraints Perform a copy if the source object entity tag (ETag) matches the specified value.
modifiedSince The optional modified constraint that restricts this request to executing only if the source object has been modified after the specified date.
unmodifiedSince The optional unmodified constraint that restricts this request to executing only if the source object has not been modified after the specified date.
Returns
  • A CopyPartResult object containing the information returned by Amazon S3 about the newly created object, or null if constraints were specified that weren't met when Amazon S3 attempted to copy the object.