Class S3Service
- All Implemented Interfaces:
AWSRequestAuthorizer
,SignedUrlHandler
- Direct Known Subclasses:
RestS3Service
This class must be extended by implementation classes that perform the communication with S3 via
a particular interface, such as REST or SOAP. The JetS3t suite includes a REST implementation
in RestS3Service
.
Implementations of S3Service
must be thread-safe as they will probably be used by
the multi-threaded service class S3ServiceMulti
.
This class uses properties obtained through Jets3tProperties
. For more information on
these properties please refer to
JetS3t Configuration
- Author:
- James Murty, Nikolas Coukouma
-
Field Summary
Fields inherited from class org.jets3t.service.StorageService
BUCKET_STATUS__ALREADY_CLAIMED, BUCKET_STATUS__DOES_NOT_EXIST, BUCKET_STATUS__MY_BUCKET
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
buildPostForm
(String bucketName, String key) Generates an unauthenticated HTML POST form that can be used to upload files or data to S3 from a standard web browser.static String
buildPostForm
(String bucketName, String key, ProviderCredentials credentials, Date expiration, String[] conditions, String[] inputFields, String textInput, boolean isSecureHttp) Generates an HTML POST form that can be used to upload files or data to S3 from a standard web browser.static String
buildPostForm
(String bucketName, String key, ProviderCredentials credentials, Date expiration, String[] conditions, String[] inputFields, String textInput, boolean isSecureHttp, boolean usePathStyleUrl, String submitButtonName) Generates an HTML POST form that can be used to upload files or data to S3 from a standard web browser.copyVersionedObject
(String versionId, String sourceBucketName, String sourceObjectKey, String destinationBucketName, S3Object destinationObject, boolean replaceMetadata) Copy an object with a specific version within your S3 account.copyVersionedObject
(String versionId, String sourceBucketName, String sourceObjectKey, String destinationBucketName, S3Object destinationObject, boolean replaceMetadata, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) Copy an object with a specific version within your S3 account.createBucket
(String bucketName) Creates a bucket.createBucket
(String bucketName, String location) Creates a bucket in a specific location, without checking whether the bucket already exists.createBucket
(String bucketName, String location, AccessControlList acl) Creates a bucket in a specific location, without checking whether the bucket already exists.createBucket
(S3Bucket bucket) Creates a bucket in S3 based on the provided bucket object, with the Access Control List settings and location properties of the bucket object (if any).createSignedDeleteUrl
(String bucketName, String objectKey, Date expiryTime) Generates a signed DELETE URL.createSignedDeleteUrl
(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) Generates a signed DELETE URL.createSignedDeleteUrl
(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime) Deprecated.0.7.4createSignedDeleteUrl
(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) Deprecated.0.7.4createSignedGetUrl
(String bucketName, String objectKey, Date expiryTime) Generates a signed GET URL.createSignedGetUrl
(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) Generates a signed GET URL.createSignedGetUrl
(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime) Deprecated.0.7.4createSignedGetUrl
(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) Deprecated.0.7.4createSignedHeadUrl
(String bucketName, String objectKey, Date expiryTime) Generates a signed HEAD URL.createSignedHeadUrl
(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) Generates a signed HEAD URL.createSignedHeadUrl
(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime) Deprecated.0.7.4createSignedHeadUrl
(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) Deprecated.0.7.4createSignedPutUrl
(String bucketName, String objectKey, Map<String, Object> headersMap, Date expiryTime) Generates a signed PUT URL.createSignedPutUrl
(String bucketName, String objectKey, Map<String, Object> headersMap, Date expiryTime, boolean isVirtualHost) Generates a signed PUT URL.createSignedPutUrl
(String bucketName, String objectKey, Map<String, Object> headersMap, ProviderCredentials credentials, Date expiryTime) Deprecated.0.7.4createSignedPutUrl
(String bucketName, String objectKey, Map<String, Object> headersMap, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) Deprecated.0.7.4createSignedUrl
(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, long secondsSinceEpoch) Generates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified.createSignedUrl
(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, long secondsSinceEpoch, boolean isVirtualHost) Generates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified.createSignedUrl
(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, long secondsSinceEpoch, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) Generates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified.createSignedUrl
(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch) Deprecated.0.7.4createSignedUrl
(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch, boolean isVirtualHost) Deprecated.0.7.4static String
createSignedUrl
(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) Deprecated.0.7.4createTorrentUrl
(String bucketName, String objectKey) Generates a URL string that will return a Torrent file for an object in S3, which file can be downloaded and run in a BitTorrent client.createUnsignedObjectUrl
(String bucketName, String objectKey, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) Returns the URL representing an object in S3 without a signature.void
deleteBucket
(S3Bucket bucket) Deprecated.0.8.0void
deleteBucketPolicy
(String bucketName) Delete the acces control policy document for a bucket.void
deleteObject
(S3Bucket bucket, String objectKey) Deletes an object from a bucket in S3.void
deleteVersionedObject
(String versionId, String bucketName, String objectKey) Deletes a object version from a bucket in S3.void
deleteVersionedObjectWithMFA
(String versionId, String multiFactorSerialNumber, String multiFactorAuthCode, String bucketName, String objectKey) Deletes a object version from a bucket in S3.void
deleteWebsiteConfig
(String bucketName) Delete a bucket's website configuration; removes the effect of any previously-applied configuration.void
disableMFAForVersionedBucket
(String bucketName, String multiFactorSerialNumber, String multiFactorAuthCode) Disable the multi-factor authentication (MFA) feature for a bucket that already has S3 object versioning and MFA enabled.void
enableBucketVersioning
(String bucketName) Enable the S3 object versioning feature for a bucket.void
enableBucketVersioningAndMFA
(String bucketName) Enable the S3 object versioning feature and also enable the multi-factor authentication (MFA) feature for a bucket which does not yet have MFA enabled.void
enableBucketVersioningWithMFA
(String bucketName, String multiFactorSerialNumber, String multiFactorAuthCode) Enable the S3 object versioning feature for a bucket that already has multi-factor authentication (MFA) enabled.static String
generatePostPolicyCondition
(String operation, String name, String value) Generates a policy document condition statement to represent an operation.static String
Generates a policy document condition statement that will allow the named data item in a POST request to take on any value.static String
generatePostPolicyCondition_Equality
(String name, String value) Generates a policy document condition statement to represent an equality test.static String
generatePostPolicyCondition_Equality
(String name, String[] values) Generates a policy document condition statement to represent an equality test.static String
generatePostPolicyCondition_Equality
(String name, List<String> values) Generates a policy document condition statement to represent an equality test.static String
generatePostPolicyCondition_Range
(int min, int max) Generates a policy document condition statement to represent a test that imposes a limit on the minimum and maximum amount of data the user can upload via a POST form.Deprecated.0.8.0 useStorageService.getProviderCredentials()
insteadReturns a bucket in your account by listing all your buckets (usingStorageService.listAllBuckets()
), and looking for the named bucket in this list.getBucketAcl
(S3Bucket bucket) Retrieves the access control settings of a bucket.getBucketLocation
(String bucketName) Retrieves the location of a bucket.getBucketLoggingStatus
(String bucketName) Retrieves the logging status settings of a bucket.getBucketPolicy
(String bucketName) Retrieve the JSON access control policy document for a bucket, or null if the bucket does not have a policy.getBucketVersioningStatus
(String bucketName) Return versioning status of bucket, which reports on whether the given bucket has S3 object versioning enabled and whether multi-factor authentication is required to delete versions.getNotificationConfig
(String bucketName) Returns an object representing the details and data of an item in a service, without applying any preconditions.getObject
(String bucketName, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) Returns an object representing the details and data of an item that meets any given preconditions.Deprecated.0.8.0getObject
(S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) Returns an object representing the details and data of an item in S3 that meets any given preconditions.getObjectAcl
(S3Bucket bucket, String objectKey) Retrieves the access control settings of an object.getObjectDetails
(S3Bucket bucket, String objectKey) Deprecated.0.8.0getObjectDetails
(S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) Returns an object representing the details of an item in S3 that meets any given preconditions.getObjectVersions
(String bucketName, String objectKey) Return version information for a specific object.getOrCreateBucket
(String bucketName) Returns a bucket in your account, and creates the bucket if it does not yet exist.getOrCreateBucket
(String bucketName, String location) Returns a bucket in your S3 account, and creates the bucket in the given S3 location if it does not yet exist.getVersionedObject
(String versionId, String bucketName, String objectKey) Returns an object representing the details and data of an item in S3 with a specific given version, without applying any preconditions.getVersionedObject
(String versionId, String bucketName, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) Returns an object representing the details and data of a versioned object in S3 that also meets any given preconditions.getVersionedObject
(String versionId, S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) Returns an object representing the details and data of a versioned object in S3 that also meets any given preconditions.getVersionedObjectAcl
(String versionId, String bucketName, String objectKey) Retrieves the access control settings of a versioned object.getVersionedObjectAcl
(String versionId, S3Bucket bucket, String objectKey) Retrieves the access control settings of a versioned object.getVersionedObjectDetails
(String versionId, String bucketName, String objectKey) Returns an object representing the details of an item in S3 with a specific given version, without the object's data and without applying any preconditions.getVersionedObjectDetails
(String versionId, String bucketName, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) Returns an object representing the details of a versioned object in S3 that also meets any given preconditions.getVersionedObjectDetails
(String versionId, S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) Returns an object representing the details of a versioned object in S3 that also meets any given preconditions.getWebsiteConfig
(String bucketName) boolean
isRequesterPaysBucket
(String bucketName) Return true if the given bucket is configured as a Requester Pays bucket, in which case the requester must supply their own AWS credentials when accessing objects in the bucket, and will be responsible for request and data transfer fees.S3Bucket[]
Lists the buckets belonging to the service user.S3Object[]
listObjects
(String bucketName) Lists the objects in a bucket.S3Object[]
listObjects
(String bucketName, String prefix, String delimiter) Lists the objects in a bucket matching a prefix and delimiter.S3Object[]
listObjects
(String bucketName, String prefix, String delimiter, long maxListingLength) Lists the objects in a bucket matching a prefix, while instructing the service to send response messages containing no more than a given number of object results.S3Object[]
listObjects
(S3Bucket bucket) Deprecated.0.8.0S3Object[]
listObjects
(S3Bucket bucket, String prefix, String delimiter) Deprecated.0.8.0S3Object[]
listObjects
(S3Bucket bucket, String prefix, String delimiter, long maxListingLength) Deprecated.0.8.0listVersionedObjects
(String bucketName, String prefix, String delimiter) Lists versioning information in a versioned bucket where the objects match a given constraints.listVersionedObjectsChunked
(String bucketName, String prefix, String delimiter, long maxListingLength, String priorLastKey, String priorLastVersionId, boolean completeListing) Lists information for a versioned bucket where the items match given constarints.void
multipartAbortUpload
(MultipartUpload upload) Abort the given multipart upload process.Convenience method to complete a multipart upload by automatically finding its parts.multipartCompleteUpload
(MultipartUpload upload, List<MultipartPart> parts) Complete a multipart upload by combining all the given parts into the final object.multipartListParts
(MultipartUpload upload) List the parts that have been uploaded for a given multipart upload.multipartListUploads
(String bucketName) List the multipart uploads that have been started within a bucket and have not yet been completed or aborted.multipartListUploads
(String bucketName, String nextKeyMarker, String nextUploadIdMarker, Integer maxUploads) List a subset of the multipart uploads that have been started within a bucket and have not yet been completed or aborted.Start a multipart upload process for a given object; must be done before individual parts can be uploaded.multipartStartUpload
(String bucketName, String objectKey, Map<String, Object> metadata, AccessControlList acl, String storageClass) Start a multipart upload process for a given object; must be done before individual parts can be uploaded.multipartStartUpload
(String bucketName, S3Object object) Start a multipart upload process for a given object; must be done before individual parts can be uploaded.multipartUploadPart
(MultipartUpload upload, Integer partNumber, S3Object object) Upload an individual part that will comprise a piece of a multipart upload object.Puts an object inside an existing bucket in S3, creating a new object or overwriting an existing one with the same key.Puts an object inside an existing bucket in S3, creating a new object or overwriting an existing one with the same key.void
putObjectAcl
(String bucketName, S3Object object) Applies access control settings to an object.void
putObjectAcl
(S3Bucket bucket, S3Object object) Applies access control settings to an object.void
putObjectMaybeAsMultipart
(String bucketName, StorageObject object, long maxPartSize) Convenience method that uploads a file-based object to a storage service using the regularStorageService.putObject(String, StorageObject)
mechanism, or as a multipart upload if the object's file data is larger than the given maximum part size parameter.void
putVersionedObjectAcl
(String versionId, String bucketName, String objectKey, AccessControlList acl) Applies access control settings to a versioned object.void
putVersionedObjectAcl
(String versionId, S3Bucket bucket, S3Object object) Applies access control settings to a versioned object.void
setBucketLoggingStatus
(String bucketName, S3BucketLoggingStatus status, boolean updateTargetACLifRequired) Applies logging settings to a bucket, optionally modifying the ACL permissions for the logging target bucket to ensure log files can be written to it.void
setBucketPolicy
(String bucketName, String policyDocument) Apply a JSON access control policy document to a bucket.void
setNotificationConfig
(String bucketName, NotificationConfig config) Apply a notification configuration to a bucket.void
setRequesterPaysBucket
(String bucketName, boolean requesterPays) Applies request payment configuration settings to a bucket, setting the bucket to be either Requester Pays or Bucket Owner pays.void
setWebsiteConfig
(String bucketName, WebsiteConfig config) Apply a website configuration to a bucket.void
suspendBucketVersioning
(String bucketName) Suspend (disable) the S3 object versioning feature for a bucket.void
suspendBucketVersioningWithMFA
(String bucketName, String multiFactorSerialNumber, String multiFactorAuthCode) Suspend (disable) the S3 object versioning feature for a bucket that requires multi-factor authentication.void
unsetNotificationConfig
(String bucketName) Unset (delete) a bucket's notification configuration; removes the effect of any previously-applied configuration.Methods inherited from class org.jets3t.service.impl.rest.httpclient.RestStorageService
authorizeHttpRequest, checkBucketStatus, deleteObjectWithSignedUrl, getCredentialsProvider, getHttpClient, getHttpConnectionManager, getObjectAclWithSignedUrl, getObjectDetailsWithSignedUrl, getObjectWithSignedUrl, isBucketAccessible, putObjectAclWithSignedUrl, putObjectWithSignedUrl, setCredentialsProvider, setHttpClient, setHttpConnectionManager
Methods inherited from class org.jets3t.service.StorageService
copyObject, copyObject, createBucket, deleteBucket, deleteBucket, deleteObject, getAccountOwner, getBucketAcl, getCurrentTimeWithOffset, getEndpoint, getInternalErrorRetryMax, getInvokingApplicationDescription, getJetS3tProperties, getObjectAcl, getObjectDetails, getObjectDetails, getProviderCredentials, getResourceParameterNames, getRestHeaderPrefix, getRestMetadataPrefix, isAuthenticatedConnection, isHttpsOnly, isObjectInBucket, isShutdown, listObjectsChunked, listObjectsChunked, moveObject, putBucketAcl, putBucketAcl, putObject, putObjectAcl, putObjectAcl, renameMetadataKeys, renameObject, shutdown, updateObjectMetadata
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jets3t.service.utils.signedurl.SignedUrlHandler
deleteObjectWithSignedUrl, getObjectAclWithSignedUrl, getObjectDetailsWithSignedUrl, getObjectWithSignedUrl, putObjectAclWithSignedUrl, putObjectWithSignedUrl
-
Method Details
-
getAWSCredentials
Deprecated.0.8.0 useStorageService.getProviderCredentials()
instead- Returns:
- the credentials identifying the service user, or null for anonymous.
-
createUnsignedObjectUrl
public String createUnsignedObjectUrl(String bucketName, String objectKey, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) throws S3ServiceException Returns the URL representing an object in S3 without a signature. This URL can only be used to download publicly-accessible objects.- Parameters:
bucketName
- the name of the bucket that contains the object.objectKey
- the key name of the object.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.isHttps
- if true, the signed URL will use the HTTPS protocol. If false, the signed URL will use the HTTP protocol.isDnsBucketNamingDisabled
- if true, the signed URL will not use the DNS-name format for buckets eg. jets3t.s3.amazonaws.com. Unless you have a specific reason to disable DNS bucket naming, leave this value false.- Returns:
- the object's URL.
- Throws:
S3ServiceException
-
createSignedUrl
public String createSignedUrl(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, long secondsSinceEpoch, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) throws S3ServiceExceptionGenerates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified.- Parameters:
method
- the HTTP method to sign, such as GET or PUT (note that S3 does not support POST requests).bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.specialParamName
- the name of a request parameter to add to the URL generated by this method. 'Special' parameters may include parameters that specify the kind of S3 resource that the URL will refer to, such as 'acl', 'torrent', 'logging', or 'location'.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.secondsSinceEpoch
- the time after which URL's signature will no longer be valid. This time cannot be null. Note: This time is specified in seconds since the epoch, not milliseconds.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.isHttps
- if true, the signed URL will use the HTTPS protocol. If false, the signed URL will use the HTTP protocol.isDnsBucketNamingDisabled
- if true, the signed URL will not use the DNS-name format for buckets eg. jets3t.s3.amazonaws.com. Unless you have a specific reason to disable DNS bucket naming, leave this value false.- Returns:
- a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedUrl
public String createSignedUrl(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, long secondsSinceEpoch, boolean isVirtualHost) throws S3ServiceExceptionGenerates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified. The URL will use the default JetS3t property settings in the jets3t.properties file to determine whether to generate HTTP or HTTPS links (s3service.https-only), and whether to disable DNS bucket naming (s3service.disable-dns-buckets).- Parameters:
method
- the HTTP method to sign, such as GET or PUT (note that S3 does not support POST requests).bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.specialParamName
- the name of a request parameter to add to the URL generated by this method. 'Special' parameters may include parameters that specify the kind of S3 resource that the URL will refer to, such as 'acl', 'torrent', 'logging' or 'location'.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.secondsSinceEpoch
- the time after which URL's signature will no longer be valid. This time cannot be null. Note: This time is specified in seconds since the epoch, not milliseconds.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedUrl
public String createSignedUrl(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, long secondsSinceEpoch) throws S3ServiceExceptionGenerates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified.- Parameters:
method
- the HTTP method to sign, such as GET or PUT (note that S3 does not support POST requests).bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.specialParamName
- the name of a request parameter to add to the URL generated by this method. 'Special' parameters may include parameters that specify the kind of S3 resource that the URL will refer to, such as 'acl', 'torrent', 'logging' or 'location'.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.secondsSinceEpoch
- the time after which URL's signature will no longer be valid. This time cannot be null. Note: This time is specified in seconds since the epoch, not milliseconds.- Returns:
- a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedGetUrl
public String createSignedGetUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) throws S3ServiceException Generates a signed GET URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to grant GET access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedGetUrl
public String createSignedGetUrl(String bucketName, String objectKey, Date expiryTime) throws S3ServiceException Generates a signed GET URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to grant GET access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedPutUrl
public String createSignedPutUrl(String bucketName, String objectKey, Map<String, Object> headersMap, Date expiryTime, boolean isVirtualHost) throws S3ServiceExceptionGenerates a signed PUT URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to allow anyone to PUT an object into S3.
- Throws:
S3ServiceException
-
createSignedPutUrl
public String createSignedPutUrl(String bucketName, String objectKey, Map<String, Object> headersMap, Date expiryTime) throws S3ServiceExceptionGenerates a signed PUT URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to allow anyone to PUT an object into S3.
- Throws:
S3ServiceException
-
createSignedDeleteUrl
public String createSignedDeleteUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) throws S3ServiceException Generates a signed DELETE URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to allow anyone do DELETE an object in S3.
- Throws:
S3ServiceException
-
createSignedDeleteUrl
public String createSignedDeleteUrl(String bucketName, String objectKey, Date expiryTime) throws S3ServiceException Generates a signed DELETE URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to allow anyone do DELETE an object in S3.
- Throws:
S3ServiceException
-
createSignedHeadUrl
public String createSignedHeadUrl(String bucketName, String objectKey, Date expiryTime, boolean isVirtualHost) throws S3ServiceException Generates a signed HEAD URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedHeadUrl
public String createSignedHeadUrl(String bucketName, String objectKey, Date expiryTime) throws S3ServiceException Generates a signed HEAD URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.expiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedUrl
@Deprecated public static String createSignedUrl(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled) throws S3ServiceExceptionDeprecated.0.7.4Generates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified.- Parameters:
method
- the HTTP method to sign, such as GET or PUT (note that S3 does not support POST requests).bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.specialParamName
- the name of a request parameter to add to the URL generated by this method. 'Special' parameters may include parameters that specify the kind of S3 resource that the URL will refer to, such as 'acl', 'torrent', 'logging', or 'location'.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectsecondsSinceEpoch
- the time after which URL's signature will no longer be valid. This time cannot be null. Note: This time is specified in seconds since the epoch, not milliseconds.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.isHttps
- if true, the signed URL will use the HTTPS protocol. If false, the signed URL will use the HTTP protocol.isDnsBucketNamingDisabled
- if true, the signed URL will not use the DNS-name format for buckets eg. jets3t.s3.amazonaws.com. Unless you have a specific reason to disable DNS bucket naming, leave this value false.- Returns:
- a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedUrl
@Deprecated public String createSignedUrl(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch, boolean isVirtualHost) throws S3ServiceExceptionDeprecated.0.7.4Generates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified. The URL will use the default JetS3t property settings in the jets3t.properties file to determine whether to generate HTTP or HTTPS links (s3service.https-only), and whether to disable DNS bucket naming (s3service.disable-dns-buckets).- Parameters:
method
- the HTTP method to sign, such as GET or PUT (note that S3 does not support POST requests).bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.specialParamName
- the name of a request parameter to add to the URL generated by this method. 'Special' parameters may include parameters that specify the kind of S3 resource that the URL will refer to, such as 'acl', 'torrent', 'logging' or 'location'.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectsecondsSinceEpoch
- the time after which URL's signature will no longer be valid. This time cannot be null. Note: This time is specified in seconds since the epoch, not milliseconds.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedUrl
@Deprecated public String createSignedUrl(String method, String bucketName, String objectKey, String specialParamName, Map<String, Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch) throws S3ServiceExceptionDeprecated.0.7.4Generates a signed URL string that will grant access to an S3 resource (bucket or object) to whoever uses the URL up until the time specified.- Parameters:
method
- the HTTP method to sign, such as GET or PUT (note that S3 does not support POST requests).bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.specialParamName
- the name of a request parameter to add to the URL generated by this method. 'Special' parameters may include parameters that specify the kind of S3 resource that the URL will refer to, such as 'acl', 'torrent', 'logging' or 'location'.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectsecondsSinceEpoch
- the time after which URL's signature will no longer be valid. This time cannot be null. Note: This time is specified in seconds since the epoch, not milliseconds.- Returns:
- a URL signed in such a way as to grant access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedGetUrl
@Deprecated public String createSignedGetUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) throws S3ServiceException Deprecated.0.7.4Generates a signed GET URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to grant GET access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedGetUrl
@Deprecated public String createSignedGetUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime) throws S3ServiceException Deprecated.0.7.4Generates a signed GET URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to grant GET access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedPutUrl
@Deprecated public String createSignedPutUrl(String bucketName, String objectKey, Map<String, Object> headersMap, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) throws S3ServiceExceptionDeprecated.0.7.4Generates a signed PUT URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to allow anyone to PUT an object into S3.
- Throws:
S3ServiceException
-
createSignedPutUrl
@Deprecated public String createSignedPutUrl(String bucketName, String objectKey, Map<String, Object> headersMap, ProviderCredentials credentials, Date expiryTime) throws S3ServiceExceptionDeprecated.0.7.4Generates a signed PUT URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.headersMap
- headers to add to the signed URL, may be null. Headers that must match between the signed URL and the actual request include: content-md5, content-type, and any header starting with 'x-amz-'.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to allow anyone to PUT an object into S3.
- Throws:
S3ServiceException
-
createSignedDeleteUrl
@Deprecated public String createSignedDeleteUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) throws S3ServiceException Deprecated.0.7.4Generates a signed DELETE URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to allow anyone do DELETE an object in S3.
- Throws:
S3ServiceException
-
createSignedDeleteUrl
@Deprecated public String createSignedDeleteUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime) throws S3ServiceException Deprecated.0.7.4Generates a signed DELETE URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to allow anyone do DELETE an object in S3.
- Throws:
S3ServiceException
-
createSignedHeadUrl
@Deprecated public String createSignedHeadUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime, boolean isVirtualHost) throws S3ServiceException Deprecated.0.7.4Generates a signed HEAD URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.isVirtualHost
- if this parameter is true, the bucket name is treated as a virtual host name. To use this option, the bucket name must be a valid DNS name that is an alias to an S3 bucket.- Returns:
- a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createSignedHeadUrl
@Deprecated public String createSignedHeadUrl(String bucketName, String objectKey, ProviderCredentials credentials, Date expiryTime) throws S3ServiceException Deprecated.0.7.4Generates a signed HEAD URL.- Parameters:
bucketName
- the name of the bucket to include in the URL, must be a valid bucket name.objectKey
- the name of the object to include in the URL, if null only the bucket name is used.credentials
- the credentials of someone with sufficient privileges to grant access to the bucket/objectexpiryTime
- the time after which URL's signature will no longer be valid. This time cannot be null.- Returns:
- a URL signed in such a way as to grant HEAD access to an S3 resource to whoever uses it.
- Throws:
S3ServiceException
-
createTorrentUrl
Generates a URL string that will return a Torrent file for an object in S3, which file can be downloaded and run in a BitTorrent client.- Parameters:
bucketName
- the name of the bucket containing the object.objectKey
- the name of the object.- Returns:
- a URL to a Torrent file representing the object.
-
generatePostPolicyCondition
Generates a policy document condition statement to represent an operation.- Parameters:
operation
- the name of the test operation this condition statement will apply.name
- the name of the data item the condition applies to.value
- the test value that will be used by the condition operation.- Returns:
- a condition statement that can be included in the policy document belonging to an S3 POST form.
-
generatePostPolicyCondition_AllowAnyValue
Generates a policy document condition statement that will allow the named data item in a POST request to take on any value.- Parameters:
name
- the name of the data item that will be allowed to take on any value.- Returns:
- a condition statement that can be included in the policy document belonging to an S3 POST form.
-
generatePostPolicyCondition_Equality
Generates a policy document condition statement to represent an equality test.- Parameters:
name
- the name of the data item that will be tested.value
- the value that the named data item must match.- Returns:
- a condition statement that can be included in the policy document belonging to an S3 POST form.
-
generatePostPolicyCondition_Equality
Generates a policy document condition statement to represent an equality test.- Parameters:
name
- the name of the data item that will be tested.values
- a list of values, one of which must match the named data item.- Returns:
- a condition statement that can be included in the policy document belonging to an S3 POST form.
-
generatePostPolicyCondition_Equality
Generates a policy document condition statement to represent an equality test.- Parameters:
name
- the name of the data item that will be tested.values
- a list of values, one of which must match the named data item.- Returns:
- a condition statement that can be included in the policy document belonging to an S3 POST form.
-
generatePostPolicyCondition_Range
Generates a policy document condition statement to represent a test that imposes a limit on the minimum and maximum amount of data the user can upload via a POST form.- Parameters:
min
- the minimum number of bytes the user must upload. This value should be greater than or equal to zero.max
- the maximum number of bytes the user can upload. This value must be greater than or equal to the min value.- Returns:
- a condition statement that can be included in the policy document belonging to an S3 POST form.
-
buildPostForm
public static String buildPostForm(String bucketName, String key) throws S3ServiceException, UnsupportedEncodingException Generates an unauthenticated HTML POST form that can be used to upload files or data to S3 from a standard web browser.Because the generated form is unauthenticated, it will not contain a policy document and will only allow uploads to be sent to S3 buckets that are publicly writable.
- Parameters:
bucketName
- the name of the target bucket to which the data will be uploaded.key
- the key name for the object that will store the data. The key name can include the special variable ${filename} which expands to the name of the file the user uploaded in the form.- Returns:
- A form document that can be included in a UTF-8 encoded HTML web page to allow uploads to a publicly-writable S3 bucket via a web browser.
- Throws:
S3ServiceException
UnsupportedEncodingException
-
buildPostForm
public static String buildPostForm(String bucketName, String key, ProviderCredentials credentials, Date expiration, String[] conditions, String[] inputFields, String textInput, boolean isSecureHttp) throws S3ServiceException, UnsupportedEncodingException Generates an HTML POST form that can be used to upload files or data to S3 from a standard web browser.Depending on the parameter values provided, this method will generate an authenticated or unauthenticated form. If the form is unauthenticated, it will not include a policy document and will therefore not have an expiry date or any usage conditions. Unauthenticated forms may only be used to upload data to a publicly writable bucket.
If both the expiration and conditions parameters are non-null, the form will include a policy document and will be authenticated. In this case, you must provide your AWS credentials to sign the authenticated form.
- Parameters:
bucketName
- the name of the target bucket to which the data will be uploaded.key
- the key name for the object that will store the data. The key name can include the special variable ${filename} which expands to the name of the file the user uploaded in the form.credentials
- your Storage Provideer credentials. Credentials are only required if the form includes policy document conditions, otherwise this can be null.expiration
- the expiration date beyond which the form will cease to work. If this parameter is null, the generated form will not include a policy document and will not have an expiry date.conditions
- the policy conditions applied to the form, specified as policy document condition statements. These statements can be generated with the convenience methodgeneratePostPolicyCondition(String, String, String)
and its siblings. If this parameter is null, the generated form will not include a policy document and will not apply any usage conditions.inputFields
- optional input field strings that will be added to the form. Each string must be a valid HTML form input field definition, such as <input type="hidden" name="acl" value="public-read">textInput
- an optional input field definition that is used instead of the default file input field <input name=\"file\" type=\"file\">. If this parameter is null, the default file input field will be used to allow file uploads. If this parameter is non-null, the provided string must define an input field named "file" that allows the user to provide input, such as <textarea name="file" cols="60" rows="3"></textarea>isSecureHttp
- if this parameter is true the form will upload data to S3 using HTTPS, otherwise it will use HTTP.- Returns:
- A form document that can be included in a UTF-8 encoded HTML web page to allow uploads to S3 via a web browser.
- Throws:
S3ServiceException
UnsupportedEncodingException
-
buildPostForm
public static String buildPostForm(String bucketName, String key, ProviderCredentials credentials, Date expiration, String[] conditions, String[] inputFields, String textInput, boolean isSecureHttp, boolean usePathStyleUrl, String submitButtonName) throws S3ServiceException, UnsupportedEncodingException Generates an HTML POST form that can be used to upload files or data to S3 from a standard web browser.Depending on the parameter values provided, this method will generate an authenticated or unauthenticated form. If the form is unauthenticated, it will not include a policy document and will therefore not have an expiry date or any usage conditions. Unauthenticated forms may only be used to upload data to a publicly writable bucket.
If both the expiration and conditions parameters are non-null, the form will include a policy document and will be authenticated. In this case, you must provide your AWS credentials to sign the authenticated form.
- Parameters:
bucketName
- the name of the target bucket to which the data will be uploaded.key
- the key name for the object that will store the data. The key name can include the special variable ${filename} which expands to the name of the file the user uploaded in the form.credentials
- your Storage Provider credentials. Credentials are only required if the form includes policy document conditions, otherwise this can be null.expiration
- the expiration date beyond which the form will cease to work. If this parameter is null, the generated form will not include a policy document and will not have an expiry date.conditions
- the policy conditions applied to the form, specified as policy document condition statements. These statements can be generated with the convenience methodgeneratePostPolicyCondition(String, String, String)
and its siblings. If this parameter is null, the generated form will not include a policy document and will not apply any usage conditions.inputFields
- optional input field strings that will be added to the form. Each string must be a valid HTML form input field definition, such as <input type="hidden" name="acl" value="public-read">textInput
- an optional input field definition that is used instead of the default file input field <input name=\"file\" type=\"file\">. If this parameter is null, the default file input field will be used to allow file uploads. If this parameter is non-null, the provided string must define an input field named "file" that allows the user to provide input, such as <textarea name="file" cols="60" rows="3"></textarea>isSecureHttp
- if this parameter is true the form will upload data to S3 using HTTPS, otherwise it will use HTTP.usePathStyleUrl
- if true the deprecated path style URL will be used to specify the bucket name, for example: http://s3.amazon.com/BUCKET_NAME. If false, the recommended sub-domain style will be used, for example: http://BUCKET_NAME.s3.amazon.com/. The path style can be useful for accessing US-based buckets with SSL, however non-US buckets are inaccessible with this style URL.submitButtonName
- the name to display on the form's submit button.- Returns:
- A form document that can be included in a UTF-8 encoded HTML web page to allow uploads to S3 via a web browser.
- Throws:
S3ServiceException
UnsupportedEncodingException
-
listAllBuckets
Description copied from class:StorageService
Lists the buckets belonging to the service user.This method cannot be performed by anonymous services, and will fail with an exception if the service is not authenticated.
- Overrides:
listAllBuckets
in classStorageService
- Returns:
- the list of buckets owned by the service user.
- Throws:
S3ServiceException
-
getObject
Description copied from class:StorageService
Returns an object representing the details and data of an item in a service, without applying any preconditions.This method can be performed by anonymous services. Anonymous services can get a publicly-readable object.
Important: It is the caller's responsibility to close the object's data input stream. The data stream should be consumed and closed as soon as is practical as network connections may be held open until the streams are closed. Excessive unclosed streams can lead to connection starvation.
- Overrides:
getObject
in classStorageService
- Parameters:
bucketName
- the name of the bucket containing the object.objectKey
- the key identifying the object.- Returns:
- the object with the given key, including the object's data input stream.
- Throws:
S3ServiceException
-
listObjects
Deprecated.0.8.0The objects returned by this method contain only minimal information such as the object's size, ETag, and LastModified timestamp. To retrieve the objects' metadata you must perform follow-up
getObject
orgetObjectDetails
operations.This method can be performed by anonymous services. Anonymous services can only list the objects in a publicly-readable bucket.
Lists the objects in a bucket.- Parameters:
bucket
- the bucket whose contents will be listed. This must be a valid S3Bucket object that is non-null and contains a name.- Returns:
- the set of objects contained in a bucket.
- Throws:
S3ServiceException
-
listObjects
Description copied from class:StorageService
Lists the objects in a bucket.The objects returned by this method contain only minimal information such as the object's size, ETag, and LastModified timestamp. To retrieve the objects' metadata you must perform follow-up
getObject
orgetObjectDetails
operations.This method can be performed by anonymous services. Anonymous services can only list the objects in a publicly-readable bucket.
- Overrides:
listObjects
in classStorageService
- Parameters:
bucketName
- the name of the bucket whose contents will be listed.- Returns:
- the set of objects contained in a bucket.
- Throws:
S3ServiceException
-
listObjects
public S3Object[] listObjects(String bucketName, String prefix, String delimiter, long maxListingLength) throws S3ServiceException Description copied from class:StorageService
Lists the objects in a bucket matching a prefix, while instructing the service to send response messages containing no more than a given number of object results.The objects returned by this method contain only minimal information such as the object's size, ETag, and LastModified timestamp. To retrieve the objects' metadata you must perform follow-up
getObject
orgetObjectDetails
operations.This method can be performed by anonymous services. Anonymous services can list the contents of a publicly-readable bucket.
NOTE: If you supply a delimiter value that could cause virtual path "subdirectories" to be included in the results from the service, use the
StorageService.listObjectsChunked(String, String, String, long, String, boolean)
method instead of this one to obtain both object and path values.- Overrides:
listObjects
in classStorageService
- Parameters:
bucketName
- the name of the the bucket whose contents will be listed.prefix
- only objects with a key that starts with this prefix will be listeddelimiter
- only list objects with key names up to this delimiter, may be null. See note above.maxListingLength
- the maximum number of objects to include in each result message. This value has no effect on the number of objects that will be returned by this method, because it will always return all the objects in the bucket.- Returns:
- the set of objects contained in a bucket whose keys start with the given prefix.
- Throws:
S3ServiceException
-
listObjects
@Deprecated public S3Object[] listObjects(S3Bucket bucket, String prefix, String delimiter) throws S3ServiceException Deprecated.0.8.0The objects returned by this method contain only minimal information such as the object's size, ETag, and LastModified timestamp. To retrieve the objects' metadata you must perform follow-up
getObject
orgetObjectDetails
operations.This method can be performed by anonymous services. Anonymous services can only list the objects in a publicly-readable bucket.
NOTE: If you supply a delimiter value that could cause CommonPrefixes ("subdirectory paths") to be included in the results from S3, use the
StorageService.listObjectsChunked(String, String, String, long, String, boolean)
method instead of this one to obtain both object and CommonPrefix values.Lists the objects in a bucket matching a prefix and delimiter.- Parameters:
bucket
- the bucket whose contents will be listed. This must be a valid S3Bucket object that is non-null and contains a name.prefix
- only objects with a key that starts with this prefix will be listeddelimiter
- only list objects with key names up to this delimiter, may be null. See note above. Note: If a non-null delimiter is specified, the prefix must include enough text to reach the first occurrence of the delimiter in the bucket's keys, or no results will be returned.- Returns:
- the set of objects contained in a bucket whose keys start with the given prefix.
- Throws:
S3ServiceException
-
listObjects
public S3Object[] listObjects(String bucketName, String prefix, String delimiter) throws S3ServiceException Description copied from class:StorageService
Lists the objects in a bucket matching a prefix and delimiter.The objects returned by this method contain only minimal information such as the object's size, ETag, and LastModified timestamp. To retrieve the objects' metadata you must perform follow-up
getObject
orgetObjectDetails
operations.This method can be performed by anonymous services. Anonymous services can only list the objects in a publicly-readable bucket.
NOTE: If you supply a delimiter value that could cause virtual path "subdirectories" to be included in the results from the service, use the
StorageService.listObjectsChunked(String, String, String, long, String, boolean)
method instead of this one to obtain both object and path values.- Overrides:
listObjects
in classStorageService
- Parameters:
bucketName
- the name of the bucket whose contents will be listed.prefix
- only objects with a key that starts with this prefix will be listeddelimiter
- only list objects with key names up to this delimiter, may be null. See note above. Note: If a non-null delimiter is specified, the prefix must include enough text to reach the first occurrence of the delimiter in the bucket's keys, or no results will be returned.- Returns:
- the set of objects contained in a bucket whose keys start with the given prefix.
- Throws:
S3ServiceException
-
createBucket
Description copied from class:StorageService
Creates a bucket. Caution: Performing this operation unnecessarily when a bucket already exists may cause OperationAborted errors with the message "A conflicting conditional operation is currently in progress against this resource.". To avoid this error, use theStorageService.getOrCreateBucket(String)
in situations where the bucket may already exist. This method cannot be performed by anonymous services.- Overrides:
createBucket
in classStorageService
- Parameters:
bucketName
- the name of the bucket to create.- Returns:
- the created bucket object. Note: the object returned has minimal information about the bucket that was created, including only the bucket's name.
- Throws:
S3ServiceException
-
getOrCreateBucket
Description copied from class:StorageService
Returns a bucket in your account, and creates the bucket if it does not yet exist.- Overrides:
getOrCreateBucket
in classStorageService
- Parameters:
bucketName
- the name of the bucket to retrieve or create.- Returns:
- the bucket in your account.
- Throws:
S3ServiceException
-
createBucket
public S3Bucket createBucket(String bucketName, String location, AccessControlList acl) throws S3ServiceException Creates a bucket in a specific location, without checking whether the bucket already exists. Caution: Performing this operation unnecessarily when a bucket already exists may cause OperationAborted errors with the message "A conflicting conditional operation is currently in progress against this resource.". To avoid this error, use thegetOrCreateBucket(String)
in situations where the bucket may already exist.Warning: Prior to version 0.7.0 this method did check whether a bucket already existed using
RestStorageService.isBucketAccessible(String)
. After changes to the way S3 operates, this check started to cause issues so it was removed.This method cannot be performed by anonymous services.
- Parameters:
bucketName
- the name of the bucket to create.location
- the location of the S3 data centre in which the bucket will be created, or null for the defaultS3Bucket.LOCATION_US_STANDARD
location. Valid values includeS3Bucket.LOCATION_EUROPE
,S3Bucket.LOCATION_US_WEST
,S3Bucket.LOCATION_ASIA_PACIFIC
, and the default US location that can be expressed in two ways:S3Bucket.LOCATION_US_STANDARD
orS3Bucket.LOCATION_US
.acl
- the access control settings to apply to the new bucket, or null for default ACL values.- Returns:
- the created bucket object. Note: the object returned has minimal information about the bucket that was created, including only the bucket's name.
- Throws:
S3ServiceException
-
createBucket
Creates a bucket in a specific location, without checking whether the bucket already exists. Caution: Performing this operation unnecessarily when a bucket already exists may cause OperationAborted errors with the message "A conflicting conditional operation is currently in progress against this resource.". To avoid this error, use thegetOrCreateBucket(String)
in situations where the bucket may already exist.Warning: Prior to version 0.7.0 this method did check whether a bucket already existed using
RestStorageService.isBucketAccessible(String)
. After changes to the way S3 operates, this check started to cause issues so it was removed.This method cannot be performed by anonymous services.
- Parameters:
bucketName
- the name of the bucket to create.location
- the location of the S3 data centre in which the bucket will be created, or null for the defaultS3Bucket.LOCATION_US_STANDARD
location. Valid values includeS3Bucket.LOCATION_EUROPE
,S3Bucket.LOCATION_US_WEST
,S3Bucket.LOCATION_ASIA_PACIFIC
, and the default US location that can be expressed in two ways:S3Bucket.LOCATION_US_STANDARD
orS3Bucket.LOCATION_US
.- Returns:
- the created bucket object. Note: the object returned has minimal information about the bucket that was created, including only the bucket's name.
- Throws:
S3ServiceException
-
getObject
Deprecated.0.8.0This method can be performed by anonymous services. Anonymous services can get a publicly-readable object.
Important: It is the caller's responsibility to close the object's data input stream. The data stream should be consumed and closed as soon as is practical as network connections may be held open until the streams are closed. Excessive unclosed streams can lead to connection starvation.
Returns an object representing the details and data of an item in S3, without applying any preconditions.- Parameters:
bucket
- the bucket containing the object. This must be a valid S3Bucket object that is non-null and contains a name.objectKey
- the key identifying the object.- Returns:
- the object with the given key in S3, including the object's data input stream.
- Throws:
S3ServiceException
-
getVersionedObject
public S3Object getVersionedObject(String versionId, String bucketName, String objectKey) throws S3ServiceException Returns an object representing the details and data of an item in S3 with a specific given version, without applying any preconditions. Versioned objects are only available from buckets with versioning enabled, seeenableBucketVersioning(String)
.This method can be performed by anonymous services. Anonymous services can get a publicly-readable object.
Important: It is the caller's responsibility to close the object's data input stream. The data stream should be consumed and closed as soon as is practical as network connections may be held open until the streams are closed. Excessive unclosed streams can lead to connection starvation.
- Parameters:
versionId
- identifier matching an existing object version that will be retrieved.bucketName
- the name of the versioned bucket containing the object.objectKey
- the key identifying the object.- Returns:
- the object with the given key in S3, including the object's data input stream.
- Throws:
S3ServiceException
-
getObjectDetails
@Deprecated public S3Object getObjectDetails(S3Bucket bucket, String objectKey) throws S3ServiceException Deprecated.0.8.0This method can be performed by anonymous services. Anonymous services can get a publicly-readable object's details.
Returns an object representing the details of an item in S3 without the object's data, and without applying any preconditions.- Parameters:
bucket
- the bucket containing the object. This must be a valid S3Bucket object that is non-null and contains a name.objectKey
- the key identifying the object.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
getVersionedObjectDetails
public S3Object getVersionedObjectDetails(String versionId, String bucketName, String objectKey) throws S3ServiceException Returns an object representing the details of an item in S3 with a specific given version, without the object's data and without applying any preconditions. Versioned objects are only available from buckets with versioning enabled, seeenableBucketVersioning(String)
.This method can be performed by anonymous services. Anonymous services can get a publicly-readable object's details.
- Parameters:
versionId
- object's version identifierbucketName
- the name of the versioned bucket containing the object.objectKey
- the key identifying the object.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
listObjects
@Deprecated public S3Object[] listObjects(S3Bucket bucket, String prefix, String delimiter, long maxListingLength) throws S3ServiceException Deprecated.0.8.0The objects returned by this method contain only minimal information such as the object's size, ETag, and LastModified timestamp. To retrieve the objects' metadata you must perform follow-up
getObject
orgetObjectDetails
operations.This method can be performed by anonymous services. Anonymous services can list the contents of a publicly-readable bucket.
NOTE: If you supply a delimiter value that could cause CommonPrefixes ("subdirectory paths") to be included in the results from S3, use the
StorageService.listObjectsChunked(String, String, String, long, String, boolean)
method instead of this one to obtain both object and CommonPrefix values.Lists the objects in a bucket matching a prefix, while instructing S3 to send response messages containing no more than a given number of object results.- Parameters:
bucket
- the bucket whose contents will be listed. This must be a valid S3Bucket object that is non-null and contains a name.prefix
- only objects with a key that starts with this prefix will be listeddelimiter
- only list objects with key names up to this delimiter, may be null. See note above.maxListingLength
- the maximum number of objects to include in each result message sent by S3. This value has no effect on the number of objects that will be returned by this method, because it will always return all the objects in the bucket.- Returns:
- the set of objects contained in a bucket whose keys start with the given prefix.
- Throws:
S3ServiceException
-
listVersionedObjects
public BaseVersionOrDeleteMarker[] listVersionedObjects(String bucketName, String prefix, String delimiter) throws S3ServiceException Lists versioning information in a versioned bucket where the objects match a given constraints. The S3 service will also be instructed to send response messages containing no more than a given number of object results.This operation can only be performed by the bucket owner.
- Parameters:
bucketName
- the name of the the versioned bucket whose contents will be listed.prefix
- only objects with a key that starts with this prefix will be listeddelimiter
- only list objects with key names up to this delimiter, may be null. See note above.- Returns:
- the set of objects contained in a bucket whose keys start with the given prefix.
- Throws:
S3ServiceException
-
getObjectVersions
public BaseVersionOrDeleteMarker[] getObjectVersions(String bucketName, String objectKey) throws S3ServiceException Return version information for a specific object.This is a convenience function that applies logic in addition to the LISTVERSIONS S3 operation to simplify retrieval of an object's version history. This method is *not* the most efficient way of retrieving version history in bulk, so if you need version history for multiple objects you should use the
listVersionedObjects(String, String, String)
orlistVersionedObjectsChunked(String, String, String, long, String, String, boolean)
methods instead.- Parameters:
bucketName
- the name of the versioned bucket containing the object.objectKey
- the key identifying the object.- Returns:
- an array of
S3Version
andS3DeleteMarker
objects that describe the version history of the given object. - Throws:
S3ServiceException
-
listVersionedObjectsChunked
public VersionOrDeleteMarkersChunk listVersionedObjectsChunked(String bucketName, String prefix, String delimiter, long maxListingLength, String priorLastKey, String priorLastVersionId, boolean completeListing) throws S3ServiceException Lists information for a versioned bucket where the items match given constarints. Depending on the value of the completeListing variable, this method can be set to automatically perform follow-up requests to build a complete object listing, or to return only a partial listing.The objects returned by this method contain only minimal information such as the object's size, ETag, and LastModified timestamp. To retrieve the objects' metadata you must perform follow-up
getObject
orgetObjectDetails
operations.This method can be performed by anonymous services. Anonymous services can list the contents of a publicly-readable bucket.
- Parameters:
bucketName
- the name of the versioned bucket whose contents will be listed.prefix
- only objects with a key that starts with this prefix will be listeddelimiter
- only list objects with key names up to this delimiter, may be null.maxListingLength
- the maximum number of objects to include in each result chunkpriorLastKey
- the last object key received in a prior call to this method. The next chunk of items listed will start with the next object in the bucket after this key name. This parameter may be null, in which case the listing will start at the beginning of the bucket's object contents.priorLastVersionId
- the last version ID received in a prior call to this method. The next chunk of items listed will start with the next object version after this version. This parameter can only be used with a non-null priorLastKey.completeListing
- if true, the service class will automatically perform follow-up requests to build a complete bucket object listing.- Returns:
- the set of objects contained in a bucket whose keys start with the given prefix.
- Throws:
S3ServiceException
-
createBucket
Creates a bucket in S3 based on the provided bucket object, with the Access Control List settings and location properties of the bucket object (if any).Caution: Performing this operation unnecessarily when a bucket already exists may cause OperationAborted errors with the message "A conflicting conditional operation is currently in progress against this resource.". To avoid this error, use the
getOrCreateBucket(String)
in situations where the bucket may already exist.This method cannot be performed by anonymous services.
- Parameters:
bucket
- an object representing the bucket to create which must be valid, and which may contain location and ACL settings that will be applied upon creation.- Returns:
- the created bucket object, populated with all metadata made available by the creation operation.
- Throws:
S3ServiceException
-
getBucket
Description copied from class:StorageService
Returns a bucket in your account by listing all your buckets (usingStorageService.listAllBuckets()
), and looking for the named bucket in this list.This method cannot be performed by anonymous services.
- Overrides:
getBucket
in classStorageService
- Returns:
- the bucket in your account, or null if you do not own the named bucket.
- Throws:
S3ServiceException
-
getOrCreateBucket
Returns a bucket in your S3 account, and creates the bucket in the given S3 location if it does not yet exist.Note: This method will not change the location of an existing bucket if you specify a different location from a bucket's current location. To move a bucket between locations you must first delete it in the original location, then re-create it in the new location.
- Parameters:
bucketName
- the name of the bucket to retrieve or create.location
- the location of the S3 data centre in which the bucket will be created. Valid values includeS3Bucket.LOCATION_EUROPE
,S3Bucket.LOCATION_US_WEST
,S3Bucket.LOCATION_ASIA_PACIFIC
, and the default US location that can be expressed in two ways:S3Bucket.LOCATION_US_STANDARD
orS3Bucket.LOCATION_US
.- Returns:
- the bucket in your account.
- Throws:
S3ServiceException
-
deleteBucket
Deprecated.0.8.0This method cannot be performed by anonymous services.
Deletes an S3 bucket. Only the owner of a bucket may delete it.- Parameters:
bucket
- the bucket to delete.- Throws:
S3ServiceException
-
enableBucketVersioning
Enable the S3 object versioning feature for a bucket. Multi-factor authentication will not be required to delete versions.- Parameters:
bucketName
- the name of the bucket that will have versioning enabled.- Throws:
S3ServiceException
-
enableBucketVersioningAndMFA
Enable the S3 object versioning feature and also enable the multi-factor authentication (MFA) feature for a bucket which does not yet have MFA enabled.- Parameters:
bucketName
- the name of the bucket that will have versioning enabled.- Throws:
S3ServiceException
-
enableBucketVersioningWithMFA
public void enableBucketVersioningWithMFA(String bucketName, String multiFactorSerialNumber, String multiFactorAuthCode) throws S3ServiceException Enable the S3 object versioning feature for a bucket that already has multi-factor authentication (MFA) enabled.- Parameters:
bucketName
- the name of the bucket that will have versioning enabled.multiFactorSerialNumber
- the serial number for a multi-factor authentication device.multiFactorAuthCode
- a multi-factor authentication code generated by a device.- Throws:
S3ServiceException
-
disableMFAForVersionedBucket
public void disableMFAForVersionedBucket(String bucketName, String multiFactorSerialNumber, String multiFactorAuthCode) throws S3ServiceException Disable the multi-factor authentication (MFA) feature for a bucket that already has S3 object versioning and MFA enabled.- Parameters:
bucketName
- the name of the bucket that will have versioning enabled. versioning status of the bucket.multiFactorSerialNumber
- the serial number for a multi-factor authentication device.multiFactorAuthCode
- a multi-factor authentication code generated by a device.- Throws:
S3ServiceException
-
suspendBucketVersioning
Suspend (disable) the S3 object versioning feature for a bucket. The bucket must not have the multi-factor authentication (MFA) feature enabled.- Parameters:
bucketName
- the name of the versioned bucket that will have versioning suspended.- Throws:
S3ServiceException
-
suspendBucketVersioningWithMFA
public void suspendBucketVersioningWithMFA(String bucketName, String multiFactorSerialNumber, String multiFactorAuthCode) throws S3ServiceException Suspend (disable) the S3 object versioning feature for a bucket that requires multi-factor authentication.- Parameters:
bucketName
- the name of the versioned bucket that will have versioning suspended.multiFactorSerialNumber
- the serial number for a multi-factor authentication device.multiFactorAuthCode
- a multi-factor authentication code generated by a device.- Throws:
S3ServiceException
-
getBucketVersioningStatus
public S3BucketVersioningStatus getBucketVersioningStatus(String bucketName) throws S3ServiceException Return versioning status of bucket, which reports on whether the given bucket has S3 object versioning enabled and whether multi-factor authentication is required to delete versions.- Parameters:
bucketName
- the name of the bucket.- Returns:
- versioning status of bucket
- Throws:
S3ServiceException
-
putObject
Puts an object inside an existing bucket in S3, creating a new object or overwriting an existing one with the same key.This method can be performed by anonymous services. Anonymous services can put objects into a publicly-writable bucket.
- Parameters:
bucketName
- the name of the bucket inside which the object will be put.object
- the object containing all information that will be written to S3. At very least this object must be valid. Beyond that it may contain: an input stream with the object's data content, metadata, and access control settings.Note: It is very important to set the object's Content-Length to match the size of the data input stream when possible, as this can remove the need to read data into memory to determine its size.
- Returns:
- the object populated with any metadata information made available by S3.
- Throws:
S3ServiceException
-
copyVersionedObject
public Map<String,Object> copyVersionedObject(String versionId, String sourceBucketName, String sourceObjectKey, String destinationBucketName, S3Object destinationObject, boolean replaceMetadata, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) throws S3ServiceException Copy an object with a specific version within your S3 account. You can copy an object within a single bucket or between buckets, and can optionally update the object's metadata at the same time.This method cannot be performed by anonymous services. You must have read access to the source object and write access to the destination bucket.
An object can be copied over itself, in which case you can update its metadata without making any other changes.
- Parameters:
versionId
- identifier matching an existing object version that will be copied.sourceBucketName
- the name of the versioned bucket that contains the original object.sourceObjectKey
- the key name of the original object.destinationBucketName
- the name of the destination bucket to which the object will be copied.destinationObject
- the object that will be created by the copy operation. If this item includes an AccessControlList setting the copied object will be assigned that ACL, otherwise the copied object will be assigned the default private ACL setting.replaceMetadata
- If this parameter is true, the copied object will be assigned the metadata values present in the destinationObject. Otherwise, the copied object will have the same metadata as the original object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.- Returns:
- a map of the header and result information returned by S3 after the object copy. The map includes the object's MD5 hash value (ETag), its size (Content-Length), and update timestamp (Last-Modified).
- Throws:
S3ServiceException
-
copyVersionedObject
public Map<String,Object> copyVersionedObject(String versionId, String sourceBucketName, String sourceObjectKey, String destinationBucketName, S3Object destinationObject, boolean replaceMetadata) throws S3ServiceException Copy an object with a specific version within your S3 account. You can copy an object within a single bucket or between buckets, and can optionally update the object's metadata at the same time.This method cannot be performed by anonymous services. You must have read access to the source object and write access to the destination bucket.
An object can be copied over itself, in which case you can update its metadata without making any other changes.
- Parameters:
versionId
- identifier matching an existing object version that will be copied.sourceBucketName
- the name of the versioned bucket that contains the original object.sourceObjectKey
- the key name of the original object.destinationBucketName
- the name of the destination bucket to which the object will be copied.destinationObject
- the object that will be created by the copy operation. If this item includes an AccessControlList setting the copied object will be assigned that ACL, otherwise the copied object will be assigned the default private ACL setting.replaceMetadata
- If this parameter is true, the copied object will be assigned the metadata values present in the destinationObject. Otherwise, the copied object will have the same metadata as the original object.- Returns:
- a map of the header and result information returned by S3 after the object copy. The map includes the object's MD5 hash value (ETag), its size (Content-Length), and update timestamp (Last-Modified).
- Throws:
S3ServiceException
-
putObject
Puts an object inside an existing bucket in S3, creating a new object or overwriting an existing one with the same key.This method can be performed by anonymous services. Anonymous services can put objects into a publicly-writable bucket.
- Parameters:
bucket
- the bucket inside which the object will be put, which must be valid.object
- the object containing all information that will be written to S3. At very least this object must be valid. Beyond that it may contain: an input stream with the object's data content, metadata, and access control settings.Note: It is very important to set the object's Content-Length to match the size of the data input stream when possible, as this can remove the need to read data into memory to determine its size.
- Returns:
- the object populated with any metadata information made available by S3.
- Throws:
S3ServiceException
-
deleteObject
Deletes an object from a bucket in S3.This method can be performed by anonymous services. Anonymous services can delete objects from publicly-writable buckets.
- Parameters:
bucket
- the bucket containing the object to be deleted.objectKey
- the key representing the object in S3.- Throws:
S3ServiceException
-
deleteVersionedObjectWithMFA
public void deleteVersionedObjectWithMFA(String versionId, String multiFactorSerialNumber, String multiFactorAuthCode, String bucketName, String objectKey) throws S3ServiceException Deletes a object version from a bucket in S3. This will delete only the specific version identified and will not affect any other Version or DeleteMarkers related to the object.This operation can only be performed by the owner of the S3 bucket.
- Parameters:
versionId
- the identifier of an object version that will be deleted.multiFactorSerialNumber
- the serial number for a multi-factor authentication device.multiFactorAuthCode
- a multi-factor authentication code generated by a device.bucketName
- the name of the versioned bucket containing the object to be deleted.objectKey
- the key representing the object in S3.- Throws:
S3ServiceException
-
deleteVersionedObject
public void deleteVersionedObject(String versionId, String bucketName, String objectKey) throws S3ServiceException Deletes a object version from a bucket in S3. This will delete only the specific version identified and will not affect any other Version or DeleteMarkers related to the object.This operation can only be performed by the owner of the S3 bucket.
- Parameters:
versionId
- the identifier of an object version that will be deleted.bucketName
- the name of the versioned bucket containing the object to be deleted.objectKey
- the key representing the object in S3.- Throws:
S3ServiceException
-
getObjectDetails
public S3Object getObjectDetails(S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) throws S3ServiceException Returns an object representing the details of an item in S3 that meets any given preconditions. The object is returned without the object's data.An exception is thrown if any of the preconditions fail. Preconditions are only applied if they are non-null.
This method can be performed by anonymous services. Anonymous services can get details of publicly-readable objects.
- Parameters:
bucket
- the bucket containing the object. This must be a valid S3Bucket object that is non-null and contains a name.objectKey
- the key identifying the object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
getVersionedObjectDetails
public S3Object getVersionedObjectDetails(String versionId, S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) throws S3ServiceException Returns an object representing the details of a versioned object in S3 that also meets any given preconditions. The object is returned without the object's data.An exception is thrown if any of the preconditions fail. Preconditions are only applied if they are non-null.
This method can be performed by anonymous services. Anonymous services can get details of publicly-readable objects.
- Parameters:
versionId
- the identifier of the object version to return.bucket
- the versioned bucket containing the object. This must be a valid S3Bucket object that is non-null and contains a name.objectKey
- the key identifying the object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
getVersionedObjectDetails
public S3Object getVersionedObjectDetails(String versionId, String bucketName, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags) throws S3ServiceException Returns an object representing the details of a versioned object in S3 that also meets any given preconditions. The object is returned without the object's data.An exception is thrown if any of the preconditions fail. Preconditions are only applied if they are non-null.
This method can be performed by anonymous services. Anonymous services can get details of publicly-readable objects.
- Parameters:
versionId
- the identifier of the object version to return.bucketName
- the name of the versioned bucket containing the object.objectKey
- the key identifying the object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
getObject
public S3Object getObject(String bucketName, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) throws S3ServiceException Description copied from class:StorageService
Returns an object representing the details and data of an item that meets any given preconditions.Important: It is the caller's responsibility to close the object's data input stream. The data stream should be consumed and closed as soon as is practical as network connections may be held open until the streams are closed. Excessive unclosed streams can lead to connection starvation.
An exception is thrown if any of the preconditions fail. Preconditions are only applied if they are non-null.
This method can be performed by anonymous services. Anonymous services can get a publicly-readable object.
Implementation notes
Implementations should use
StorageService.assertValidBucket(org.jets3t.service.model.StorageBucket, java.lang.String)
assertion.- Overrides:
getObject
in classStorageService
- Parameters:
bucketName
- the name of the bucket containing the object.objectKey
- the key identifying the object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.byteRangeStart
- include only a portion of the object's data - starting at this point, ignored if null.byteRangeEnd
- include only a portion of the object's data - ending at this point, ignored if null.- Returns:
- the object with the given key, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
getObject
public S3Object getObject(S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) throws S3ServiceException Returns an object representing the details and data of an item in S3 that meets any given preconditions.Important: It is the caller's responsibility to close the object's data input stream. The data stream should be consumed and closed as soon as is practical as network connections may be held open until the streams are closed. Excessive unclosed streams can lead to connection starvation.
An exception is thrown if any of the preconditions fail. Preconditions are only applied if they are non-null.
This method can be performed by anonymous services. Anonymous services can get publicly-readable objects.
Implementation notes
Implementations should use
StorageService.assertValidBucket(org.jets3t.service.model.StorageBucket, java.lang.String)
assertion.- Parameters:
bucket
- the bucket containing the object. This must be a valid S3Bucket object that is non-null and contains a name.objectKey
- the key identifying the object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.byteRangeStart
- include only a portion of the object's data - starting at this point, ignored if null.byteRangeEnd
- include only a portion of the object's data - ending at this point, ignored if null.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
getVersionedObject
public S3Object getVersionedObject(String versionId, S3Bucket bucket, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) throws S3ServiceException Returns an object representing the details and data of a versioned object in S3 that also meets any given preconditions.Important: It is the caller's responsibility to close the object's data input stream. The data stream should be consumed and closed as soon as is practical as network connections may be held open until the streams are closed. Excessive unclosed streams can lead to connection starvation.
An exception is thrown if any of the preconditions fail. Preconditions are only applied if they are non-null.
This method can be performed by anonymous services. Anonymous services can get publicly-readable objects.
Implementation notes
Implementations should use
StorageService.assertValidBucket(org.jets3t.service.model.StorageBucket, java.lang.String)
assertion.- Parameters:
versionId
- the identifier of the object version to return.bucket
- the versioned bucket containing the object. This must be a valid S3Bucket object that is non-null and contains a name.objectKey
- the key identifying the object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.byteRangeStart
- include only a portion of the object's data - starting at this point, ignored if null.byteRangeEnd
- include only a portion of the object's data - ending at this point, ignored if null.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
getVersionedObject
public S3Object getVersionedObject(String versionId, String bucketName, String objectKey, Calendar ifModifiedSince, Calendar ifUnmodifiedSince, String[] ifMatchTags, String[] ifNoneMatchTags, Long byteRangeStart, Long byteRangeEnd) throws S3ServiceException Returns an object representing the details and data of a versioned object in S3 that also meets any given preconditions.Important: It is the caller's responsibility to close the object's data input stream. The data stream should be consumed and closed as soon as is practical as network connections may be held open until the streams are closed. Excessive unclosed streams can lead to connection starvation.
An exception is thrown if any of the preconditions fail. Preconditions are only applied if they are non-null.
This method can be performed by anonymous services. Anonymous services can get a publicly-readable object.
Implementation notes
Implementations should use
StorageService.assertValidBucket(org.jets3t.service.model.StorageBucket, java.lang.String)
assertion.- Parameters:
versionId
- the identifier of the object version to return.bucketName
- the name of the versioned bucket containing the object.objectKey
- the key identifying the object.ifModifiedSince
- a precondition specifying a date after which the object must have been modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the object must not have been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the object must match, ignored if null.ifNoneMatchTags
- a precondition specifying an MD5 hash the object must not match, ignored if null.byteRangeStart
- include only a portion of the object's data - starting at this point, ignored if null.byteRangeEnd
- include only a portion of the object's data - ending at this point, ignored if null.- Returns:
- the object with the given key in S3, including only general details and metadata (not the data input stream)
- Throws:
S3ServiceException
-
putObjectAcl
Applies access control settings to an object. The ACL settings must be included with the object. This method can be performed by anonymous services, but can only succeed if the object's existing ACL already allows write access by the anonymous user. In general, you can only access the ACL of an object if the ACL already in place for that object (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
bucket
- the bucket containing the object to modify.object
- the object with ACL settings that will be applied.- Throws:
S3ServiceException
-
putObjectAcl
Applies access control settings to an object. The ACL settings must be included with the object. This method can be performed by anonymous services, but can only succeed if the object's existing ACL already allows write access by the anonymous user. In general, you can only access the ACL of an object if the ACL already in place for that object (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
bucketName
- the name of the bucket containing the object to modify.object
- the object with ACL settings that will be applied.- Throws:
S3ServiceException
-
putVersionedObjectAcl
public void putVersionedObjectAcl(String versionId, String bucketName, String objectKey, AccessControlList acl) throws S3ServiceException Applies access control settings to a versioned object. This method can be performed by anonymous services, but can only succeed if the object's existing ACL already allows write access by the anonymous user. In general, you can only access the ACL of an object if the ACL already in place for that object (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
versionId
- the identifier of the object version whose ACL will be updated.bucketName
- the name of the versioned bucket containing the object to modify.objectKey
- the key name of the object to which ACL settings will be applied.acl
- ACL settings to apply.- Throws:
S3ServiceException
-
putVersionedObjectAcl
public void putVersionedObjectAcl(String versionId, S3Bucket bucket, S3Object object) throws S3ServiceException Applies access control settings to a versioned object. The ACL settings must be included with the object. This method can be performed by anonymous services, but can only succeed if the object's existing ACL already allows write access by the anonymous user. In general, you can only access the ACL of an object if the ACL already in place for that object (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
versionId
- the identifier of the object version whose ACL will be updated.bucket
- the bucket containing the object to modify.object
- the object with ACL settings that will be applied.- Throws:
S3ServiceException
-
getObjectAcl
Retrieves the access control settings of an object. This method can be performed by anonymous services, but can only succeed if the object's existing ACL already allows read access by the anonymous user. In general, you can only access the ACL of an object if the ACL already in place for that object (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
bucket
- the bucket whose ACL settings will be retrieved (if objectKey is null) or the bucket containing the object whose ACL settings will be retrieved (if objectKey is non-null).objectKey
- if non-null, the key of the object whose ACL settings will be retrieved. Ignored if null.- Returns:
- the ACL settings of the bucket or object.
- Throws:
S3ServiceException
-
getVersionedObjectAcl
public AccessControlList getVersionedObjectAcl(String versionId, S3Bucket bucket, String objectKey) throws S3ServiceException Retrieves the access control settings of a versioned object. This method can be performed by anonymous services, but can only succeed if the object's existing ACL already allows read access by the anonymous user. In general, you can only access the ACL of an object if the ACL already in place for that object (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
versionId
- the identifier of the object version whose ACL will be returned.bucket
- the versioned bucket whose ACL settings will be retrieved (if objectKey is null) or the bucket containing the object whose ACL settings will be retrieved (if objectKey is non-null).objectKey
- if non-null, the key of the object whose ACL settings will be retrieved. Ignored if null.- Returns:
- the ACL settings of the bucket or object.
- Throws:
S3ServiceException
-
getVersionedObjectAcl
public AccessControlList getVersionedObjectAcl(String versionId, String bucketName, String objectKey) throws S3ServiceException Retrieves the access control settings of a versioned object. This method can be performed by anonymous services, but can only succeed if the object's existing ACL already allows write access by the anonymous user. In general, you can only access the ACL of an object if the ACL already in place for that object (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
versionId
- the identifier of the object version whose ACL will be returned.bucketName
- the name of the versioned bucket containing the object whose ACL settings will be retrieved.objectKey
- if non-null, the key of the object whose ACL settings will be retrieved. Ignored if null.- Returns:
- the ACL settings of the bucket or object.
- Throws:
S3ServiceException
-
getBucketAcl
Retrieves the access control settings of a bucket. This method can be performed by anonymous services, but can only succeed if the bucket's existing ACL already allows write access by the anonymous user. In general, you can only access the ACL of a bucket if the ACL already in place for that bucket (in S3) allows you to do so. See the S3 documentation on ACLs for more details on access to ACLs.- Parameters:
bucket
- the bucket whose access control settings will be returned. This must be a valid S3Bucket object that is non-null and contains a name.- Returns:
- the ACL settings of the bucket.
- Throws:
S3ServiceException
-
getBucketLocation
Retrieves the location of a bucket. Only the owner of a bucket may retrieve its location.- Parameters:
bucketName
- the name of the bucket whose location will be returned.- Returns:
- a string representing the location of the bucket, such as "EU" for a bucket located in Europe or null for a bucket in the default US location.
- Throws:
S3ServiceException
-
getBucketLoggingStatus
Retrieves the logging status settings of a bucket. Only the owner of a bucket may retrieve its logging status.- Parameters:
bucketName
- the name of the bucket whose logging status settings will be returned.- Returns:
- the Logging Status settings of the bucket.
- Throws:
S3ServiceException
-
setBucketLoggingStatus
public void setBucketLoggingStatus(String bucketName, S3BucketLoggingStatus status, boolean updateTargetACLifRequired) throws S3ServiceException Applies logging settings to a bucket, optionally modifying the ACL permissions for the logging target bucket to ensure log files can be written to it. Only the owner of a bucket may change its logging status.- Parameters:
bucketName
- the name of the bucket the logging settings will apply to.status
- the logging status settings to apply to the bucket.updateTargetACLifRequired
- if true, when logging is enabled the method will check the target bucket to ensure it has the necessary ACL permissions set to allow logging (that is, WRITE and READ_ACP for the group http://acs.amazonaws.com/groups/s3/LogDelivery). If the target bucket does not have the correct permissions the bucket's ACL will be updated to have the correct permissions. If this parameter is false, no ACL checks or updates will occur.- Throws:
S3ServiceException
-
setBucketPolicy
Apply a JSON access control policy document to a bucket.- Parameters:
bucketName
-policyDocument
-- Throws:
S3ServiceException
-
getBucketPolicy
Retrieve the JSON access control policy document for a bucket, or null if the bucket does not have a policy.- Parameters:
bucketName
-- Returns:
- JSON policy document for bucket, or null if the bucket has no policy.
- Throws:
S3ServiceException
-
deleteBucketPolicy
Delete the acces control policy document for a bucket.- Parameters:
bucketName
-- Throws:
S3ServiceException
-
isRequesterPaysBucket
Return true if the given bucket is configured as a Requester Pays bucket, in which case the requester must supply their own AWS credentials when accessing objects in the bucket, and will be responsible for request and data transfer fees.- Parameters:
bucketName
- the name of the bucket whose request payment configuration setting will be returned.- Returns:
- true if the given bucket is configured to be Requester Pays, false if it is has the default Owner pays configuration.
- Throws:
S3ServiceException
-
setRequesterPaysBucket
public void setRequesterPaysBucket(String bucketName, boolean requesterPays) throws S3ServiceException Applies request payment configuration settings to a bucket, setting the bucket to be either Requester Pays or Bucket Owner pays. Only the owner of a bucket may change its request payment status.- Parameters:
bucketName
- the name of the bucket to which the request payment configuration settings will be applied.requesterPays
- if true, the bucket will be configured to be Requester Pays. If false, the bucket will be configured to be Owner pays (the default configuration setting).- Throws:
S3ServiceException
-
putObjectMaybeAsMultipart
public void putObjectMaybeAsMultipart(String bucketName, StorageObject object, long maxPartSize) throws ServiceException Convenience method that uploads a file-based object to a storage service using the regularStorageService.putObject(String, StorageObject)
mechanism, or as a multipart upload if the object's file data is larger than the given maximum part size parameter. If a multipart upload is performed this method will perform all the necessary steps, including:- Start a new multipart upload process, based on the object's key name, metadata, ACL etc.
- Poll the service for a little while to ensure the just-started upload is actually available for use before proceeding -- this can take some time, we give up after 5 seconds (with 1 lookup attempt per second)
- Divide the object's underlying file into parts with size <= the given maximum part size
- Upload each of these parts in turn, with part numbers 1..n
- Complete the upload once all the parts have been uploaded, or...
- If there was a failure uploading parts or completing the upload, attempt
to clean up by calling
multipartAbortUpload(MultipartUpload)
then throw the original exception
- Parameters:
bucketName
- the name of the bucket in which the object will be stored.object
- a file-based object containing all information that will be written to the service. If the object provided is not file-based -- i.e. it returns null fromStorageObject.getDataInputFile()
-- an exception will be thrown immediately.maxPartSize
- the maximum size in bytes for any single upload part. If the given object's data is less than this value it will be uploaded using a regular PUT. If the object has more data than this value it will be uploaded using a multipart upload. The maximum part size value should be <= 5 GB and >= 5 MB.- Throws:
ServiceException
-
multipartStartUpload
public MultipartUpload multipartStartUpload(String bucketName, String objectKey, Map<String, Object> metadata) throws S3ServiceExceptionStart a multipart upload process for a given object; must be done before individual parts can be uploaded.- Parameters:
bucketName
- the name of the bucket in which the object will be stored.objectKey
- the key name of the object.metadata
- metadata to apply to the completed object, may be null.- Returns:
- object representing this multipart upload.
- Throws:
S3ServiceException
-
multipartStartUpload
public MultipartUpload multipartStartUpload(String bucketName, String objectKey, Map<String, Object> metadata, AccessControlList acl, String storageClass) throws S3ServiceExceptionStart a multipart upload process for a given object; must be done before individual parts can be uploaded.- Parameters:
bucketName
- the name of the bucket in which the object will be stored.objectKey
- the key name of the object.metadata
- metadata to apply to the completed object, may be null.acl
- ACL to apply to the completed upload, may be null.storageClass
- storage class to apply to the completed upload, may be null.- Returns:
- object representing this multipart upload.
- Throws:
S3ServiceException
-
multipartStartUpload
public MultipartUpload multipartStartUpload(String bucketName, S3Object object) throws S3ServiceException Start a multipart upload process for a given object; must be done before individual parts can be uploaded.- Parameters:
bucketName
- the name of the bucket in which the object will be stored.object
- object containing details to apply to the completed object, including: key name, metadata, ACL, storage class- Returns:
- object representing this multipart upload.
- Throws:
S3ServiceException
-
multipartAbortUpload
Abort the given multipart upload process. Also deletes any parts that may have already been uploaded.- Parameters:
upload
- the multipart upload to abort.- Throws:
S3ServiceException
-
multipartListUploads
List the multipart uploads that have been started within a bucket and have not yet been completed or aborted.- Parameters:
bucketName
- the bucket whose multipart uploads will be listed.- Returns:
- a list of incomplete multipart uploads.
- Throws:
S3ServiceException
-
multipartListUploads
public List<MultipartUpload> multipartListUploads(String bucketName, String nextKeyMarker, String nextUploadIdMarker, Integer maxUploads) throws S3ServiceException List a subset of the multipart uploads that have been started within a bucket and have not yet been completed or aborted.- Parameters:
bucketName
- the bucket whose multipart uploads will be listed.nextKeyMarker
- marker indicating where this list subset should start by key name.nextUploadIdMarker
- marker indicating where this list subset should start by upload ID.maxUploads
- maximum number of uploads to list in a subset.- Returns:
- a list of incomplete multipart uploads.
- Throws:
S3ServiceException
-
multipartListParts
List the parts that have been uploaded for a given multipart upload.- Parameters:
upload
- the multipart upload whose parts will be listed.- Returns:
- a list of multipart parts that have been successfully uploaded.
- Throws:
S3ServiceException
-
multipartCompleteUpload
public MultipartCompleted multipartCompleteUpload(MultipartUpload upload, List<MultipartPart> parts) throws S3ServiceException Complete a multipart upload by combining all the given parts into the final object.- Parameters:
upload
- the multipart upload whose parts will be completed.parts
- the parts comprising the final object.- Returns:
- information about the completion operation.
- Throws:
S3ServiceException
-
multipartCompleteUpload
Convenience method to complete a multipart upload by automatically finding its parts. This method does more work than the lower-levelmultipartCompleteUpload(MultipartUpload, List)
API operation, but relieves the caller of having to keep track of all the parts uploaded for a multipart upload.- Parameters:
upload
- the multipart upload whose parts will be completed.- Returns:
- information about the completion operation.
- Throws:
S3ServiceException
-
multipartUploadPart
public MultipartPart multipartUploadPart(MultipartUpload upload, Integer partNumber, S3Object object) throws S3ServiceException Upload an individual part that will comprise a piece of a multipart upload object.- Parameters:
upload
- the multipart upload to which this part will be added.partNumber
- the part's number; must be between 1 and 10,000 and must uniquely identify a given part and represent its order compared to all other parts. Part numbers need not be sequential.object
- an object containing a input stream with data that will be sent to the storage service.- Returns:
- information about the uploaded part, retain this information to eventually complete
the object with
multipartCompleteUpload(MultipartUpload, List)
. - Throws:
S3ServiceException
-
setWebsiteConfig
Apply a website configuration to a bucket.- Parameters:
bucketName
- bucket to which the website configuration will be applied.config
- the website configuration details.- Throws:
S3ServiceException
-
getWebsiteConfig
- Parameters:
bucketName
- a bucket with a website configuration.- Returns:
- the website configuration details.
- Throws:
S3ServiceException
-
deleteWebsiteConfig
Delete a bucket's website configuration; removes the effect of any previously-applied configuration.- Parameters:
bucketName
- a bucket with a website configuration.- Throws:
S3ServiceException
-
setNotificationConfig
public void setNotificationConfig(String bucketName, NotificationConfig config) throws S3ServiceException Apply a notification configuration to a bucket.- Parameters:
bucketName
- the bucket to which the notification configuration will be applied.config
- the notification configuration to apply.- Throws:
S3ServiceException
-
getNotificationConfig
- Parameters:
bucketName
- a bucket with a notification configuration.- Returns:
- the notification configuration details.
- Throws:
S3ServiceException
-
unsetNotificationConfig
Unset (delete) a bucket's notification configuration; removes the effect of any previously-applied configuration.- Parameters:
bucketName
- a bucket with a notification configuration.- Throws:
S3ServiceException
-