public abstract class S3Service extends RestStorageService implements SignedUrlHandler
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
RestStorageService.HTTP_METHOD
credentialsProvider, defaultServerSideEncryptionAlgorithm, defaultStorageClass, httpClient, regionEndpointCache, shuttingDown
BUCKET_STATUS__ALREADY_CLAIMED, BUCKET_STATUS__DOES_NOT_EXIST, BUCKET_STATUS__MY_BUCKET, timeOffset
Modifier | Constructor and Description |
---|---|
protected |
S3Service(ProviderCredentials credentials)
Construct an
S3Service identified by the given user credentials. |
protected |
S3Service(ProviderCredentials credentials,
java.lang.String invokingApplicationDescription)
Construct an
S3Service identified by the given user credentials. |
protected |
S3Service(ProviderCredentials credentials,
java.lang.String invokingApplicationDescription,
org.apache.http.client.CredentialsProvider credentialsProvider,
Jets3tProperties jets3tProperties) |
protected |
S3Service(ProviderCredentials credentials,
java.lang.String invokingApplicationDescription,
Jets3tProperties jets3tProperties)
Construct an
S3Service identified by the given user credentials. |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
buildPostForm(java.lang.String bucketName,
java.lang.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 java.lang.String |
buildPostForm(java.lang.String bucketName,
java.lang.String key,
ProviderCredentials credentials,
java.util.Date expiration,
java.lang.String[] conditions,
java.lang.String[] inputFields,
java.lang.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 java.lang.String |
buildPostForm(java.lang.String bucketName,
java.lang.String key,
ProviderCredentials credentials,
java.util.Date expiration,
java.lang.String[] conditions,
java.lang.String[] inputFields,
java.lang.String textInput,
boolean isSecureHttp,
boolean usePathStyleUrl,
java.lang.String submitButtonName)
Generates an HTML POST form that can be used to upload files or data to
S3 from a standard web browser.
|
java.util.Map<java.lang.String,java.lang.Object> |
copyVersionedObject(java.lang.String versionId,
java.lang.String sourceBucketName,
java.lang.String sourceObjectKey,
java.lang.String destinationBucketName,
S3Object destinationObject,
boolean replaceMetadata)
Copy an object with a specific version within your S3 account.
|
java.util.Map<java.lang.String,java.lang.Object> |
copyVersionedObject(java.lang.String versionId,
java.lang.String sourceBucketName,
java.lang.String sourceObjectKey,
java.lang.String destinationBucketName,
S3Object destinationObject,
boolean replaceMetadata,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags)
Copy an object with a specific version within your S3 account.
|
S3Bucket |
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).
|
S3Bucket |
createBucket(java.lang.String bucketName)
Creates a bucket.
|
S3Bucket |
createBucket(java.lang.String bucketName,
java.lang.String location)
Creates a bucket in a specific location, without checking whether the bucket already
exists.
|
S3Bucket |
createBucket(java.lang.String bucketName,
java.lang.String location,
AccessControlList acl)
Creates a bucket in a specific location, without checking whether the bucket already
exists.
|
java.lang.String |
createSignedDeleteUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Date expiryTime)
Generates a signed DELETE URL.
|
java.lang.String |
createSignedDeleteUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Date expiryTime,
boolean isVirtualHost)
Generates a signed DELETE URL.
|
java.lang.String |
createSignedDeleteUrl(java.lang.String bucketName,
java.lang.String objectKey,
ProviderCredentials credentials,
java.util.Date expiryTime)
Deprecated.
0.7.4
|
java.lang.String |
createSignedDeleteUrl(java.lang.String bucketName,
java.lang.String objectKey,
ProviderCredentials credentials,
java.util.Date expiryTime,
boolean isVirtualHost)
Deprecated.
0.7.4
|
java.lang.String |
createSignedGetUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Date expiryTime)
Generates a signed GET URL.
|
java.lang.String |
createSignedGetUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Date expiryTime,
boolean isVirtualHost)
Generates a signed GET URL.
|
java.lang.String |
createSignedGetUrl(java.lang.String bucketName,
java.lang.String objectKey,
ProviderCredentials credentials,
java.util.Date expiryTime)
Deprecated.
0.7.4
|
java.lang.String |
createSignedGetUrl(java.lang.String bucketName,
java.lang.String objectKey,
ProviderCredentials credentials,
java.util.Date expiryTime,
boolean isVirtualHost)
Deprecated.
0.7.4
|
java.lang.String |
createSignedHeadUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Date expiryTime)
Generates a signed HEAD URL.
|
java.lang.String |
createSignedHeadUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Date expiryTime,
boolean isVirtualHost)
Generates a signed HEAD URL.
|
java.lang.String |
createSignedHeadUrl(java.lang.String bucketName,
java.lang.String objectKey,
ProviderCredentials credentials,
java.util.Date expiryTime)
Deprecated.
0.7.4
|
java.lang.String |
createSignedHeadUrl(java.lang.String bucketName,
java.lang.String objectKey,
ProviderCredentials credentials,
java.util.Date expiryTime,
boolean isVirtualHost)
Deprecated.
0.7.4
|
java.lang.String |
createSignedPutUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> headersMap,
java.util.Date expiryTime)
Generates a signed PUT URL.
|
java.lang.String |
createSignedPutUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> headersMap,
java.util.Date expiryTime,
boolean isVirtualHost)
Generates a signed PUT URL.
|
java.lang.String |
createSignedPutUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> headersMap,
ProviderCredentials credentials,
java.util.Date expiryTime)
Deprecated.
0.7.4
|
java.lang.String |
createSignedPutUrl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> headersMap,
ProviderCredentials credentials,
java.util.Date expiryTime,
boolean isVirtualHost)
Deprecated.
0.7.4
|
java.lang.String |
createSignedUrl(java.lang.String method,
java.lang.String bucketName,
java.lang.String objectKey,
java.lang.String specialParamName,
java.util.Map<java.lang.String,java.lang.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.
|
java.lang.String |
createSignedUrl(java.lang.String method,
java.lang.String bucketName,
java.lang.String objectKey,
java.lang.String specialParamName,
java.util.Map<java.lang.String,java.lang.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.
|
java.lang.String |
createSignedUrl(java.lang.String method,
java.lang.String bucketName,
java.lang.String objectKey,
java.lang.String specialParamName,
java.util.Map<java.lang.String,java.lang.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.
|
java.lang.String |
createSignedUrl(java.lang.String method,
java.lang.String bucketName,
java.lang.String objectKey,
java.lang.String specialParamName,
java.util.Map<java.lang.String,java.lang.Object> headersMap,
ProviderCredentials credentials,
long secondsSinceEpoch)
Deprecated.
0.7.4
|
java.lang.String |
createSignedUrl(java.lang.String method,
java.lang.String bucketName,
java.lang.String objectKey,
java.lang.String specialParamName,
java.util.Map<java.lang.String,java.lang.Object> headersMap,
ProviderCredentials credentials,
long secondsSinceEpoch,
boolean isVirtualHost)
Deprecated.
0.7.4
|
static java.lang.String |
createSignedUrl(java.lang.String method,
java.lang.String bucketName,
java.lang.String objectKey,
java.lang.String specialParamName,
java.util.Map<java.lang.String,java.lang.Object> headersMap,
ProviderCredentials credentials,
long secondsSinceEpoch,
boolean isVirtualHost,
boolean isHttps,
boolean isDnsBucketNamingDisabled)
Deprecated.
0.7.4
|
java.lang.String |
createSignedUrlUsingSignatureVersion(java.lang.String requestSignatureVersion,
java.lang.String region,
java.lang.String method,
java.lang.String bucketName,
java.lang.String objectKey,
java.lang.String specialParamName,
java.util.Map<java.lang.String,java.lang.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,
using a given AWS Signature version to sign the request.
|
java.lang.String |
createTorrentUrl(java.lang.String bucketName,
java.lang.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.
|
java.lang.String |
createUnsignedObjectUrl(java.lang.String bucketName,
java.lang.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.0
This method cannot be performed by anonymous services. |
void |
deleteBucketPolicy(java.lang.String bucketName)
Delete the acces control policy document for a bucket.
|
protected abstract void |
deleteBucketPolicyImpl(java.lang.String bucketName) |
void |
deleteLifecycleConfig(java.lang.String bucketName)
Delete a bucket's lifecycle configuration; removes the effect of any previously-applied
configuration.
|
abstract void |
deleteLifecycleConfigImpl(java.lang.String bucketName) |
MultipleDeleteResult |
deleteMultipleObjects(java.lang.String bucketName,
ObjectKeyAndVersion[] objectNameAndVersions)
Delete multiple objects in a bucket with a single request, with all details in the
(non-"quiet") result.
|
MultipleDeleteResult |
deleteMultipleObjects(java.lang.String bucketName,
ObjectKeyAndVersion[] objectNameAndVersions,
boolean isQuiet)
Delete multiple objects in a bucket with a single request.
|
MultipleDeleteResult |
deleteMultipleObjects(java.lang.String bucketName,
java.lang.String[] keys)
Delete multiple objects in a bucket with a single request, with all details in the
(non-"quiet") result.
|
MultipleDeleteResult |
deleteMultipleObjectsWithMFA(java.lang.String bucketName,
ObjectKeyAndVersion[] objectNameAndVersions,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode,
boolean isQuiet)
Delete multiple objects in a bucket with a single request, with optional mult-factor
authentication credentials to permit delete of objects that require it.
|
abstract MultipleDeleteResult |
deleteMultipleObjectsWithMFAImpl(java.lang.String bucketName,
ObjectKeyAndVersion[] objectNameAndVersions,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode,
boolean isQuiet) |
void |
deleteObject(S3Bucket bucket,
java.lang.String objectKey)
Deletes an object from a bucket in S3.
|
void |
deleteVersionedObject(java.lang.String versionId,
java.lang.String bucketName,
java.lang.String objectKey)
Deletes a object version from a bucket in S3.
|
void |
deleteVersionedObjectWithMFA(java.lang.String versionId,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode,
java.lang.String bucketName,
java.lang.String objectKey)
Deletes a object version from a bucket in S3.
|
void |
deleteWebsiteConfig(java.lang.String bucketName)
Delete a bucket's website configuration; removes the effect of any
previously-applied configuration.
|
void |
disableMFAForVersionedBucket(java.lang.String bucketName,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode)
Disable the multi-factor authentication (MFA) feature for a
bucket that already has S3 object versioning and MFA enabled.
|
void |
enableBucketVersioning(java.lang.String bucketName)
Enable the S3 object versioning feature for a bucket.
|
void |
enableBucketVersioningAndMFA(java.lang.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(java.lang.String bucketName,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode)
Enable the S3 object versioning feature for a bucket that
already has multi-factor authentication (MFA) enabled.
|
static java.lang.String |
generatePostPolicyCondition_AllowAnyValue(java.lang.String name)
Generates a policy document condition statement that will allow the named
data item in a POST request to take on any value.
|
static java.lang.String |
generatePostPolicyCondition_Equality(java.lang.String name,
java.util.List<java.lang.String> values)
Generates a policy document condition statement to represent an
equality test.
|
static java.lang.String |
generatePostPolicyCondition_Equality(java.lang.String name,
java.lang.String value)
Generates a policy document condition statement to represent an
equality test.
|
static java.lang.String |
generatePostPolicyCondition_Equality(java.lang.String name,
java.lang.String[] values)
Generates a policy document condition statement to represent an
equality test.
|
static java.lang.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.
|
static java.lang.String |
generatePostPolicyCondition(java.lang.String operation,
java.lang.String name,
java.lang.String value)
Generates a policy document condition statement to represent an operation.
|
S3Bucket |
getBucket(java.lang.String bucketName)
Returns a bucket in your account by listing all your buckets
(using
StorageService.listAllBuckets() ), and looking for the named bucket in
this list. |
AccessControlList |
getBucketAcl(S3Bucket bucket)
Retrieves the access control settings of a bucket.
|
java.lang.String |
getBucketLocation(java.lang.String bucketName)
Retrieves the location of a bucket.
|
S3BucketLoggingStatus |
getBucketLoggingStatus(java.lang.String bucketName)
Retrieves the logging status settings of a bucket.
|
java.lang.String |
getBucketPolicy(java.lang.String bucketName)
Retrieve the JSON access control policy document for a bucket,
or null if the bucket does not have a policy.
|
protected abstract java.lang.String |
getBucketPolicyImpl(java.lang.String bucketName) |
S3BucketVersioningStatus |
getBucketVersioningStatus(java.lang.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.
|
protected abstract S3BucketVersioningStatus |
getBucketVersioningStatusImpl(java.lang.String bucketName) |
LifecycleConfig |
getLifecycleConfig(java.lang.String bucketName) |
abstract LifecycleConfig |
getLifecycleConfigImpl(java.lang.String bucketName) |
NotificationConfig |
getNotificationConfig(java.lang.String bucketName) |
protected abstract NotificationConfig |
getNotificationConfigImpl(java.lang.String bucketName) |
S3Object |
getObject(S3Bucket bucket,
java.lang.String objectKey)
Deprecated.
0.8.0
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. |
S3Object |
getObject(S3Bucket bucket,
java.lang.String objectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags,
java.lang.Long byteRangeStart,
java.lang.Long byteRangeEnd)
Returns an object representing the details and data of an item in S3 that meets any given preconditions.
|
S3Object |
getObject(java.lang.String bucketName,
java.lang.String objectKey)
Returns an object representing the details and data of an item in a service,
without applying any preconditions.
|
S3Object |
getObject(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags,
java.lang.Long byteRangeStart,
java.lang.Long byteRangeEnd)
Returns an object representing the details and data of an item that meets any given preconditions.
|
AccessControlList |
getObjectAcl(S3Bucket bucket,
java.lang.String objectKey)
Retrieves the access control settings of an object.
|
S3Object |
getObjectDetails(S3Bucket bucket,
java.lang.String objectKey)
Deprecated.
0.8.0
This method can be performed by anonymous services. Anonymous services can get a publicly-readable object's details. |
S3Object |
getObjectDetails(S3Bucket bucket,
java.lang.String objectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags)
Returns an object representing the details of an item in S3 that meets any given preconditions.
|
BaseVersionOrDeleteMarker[] |
getObjectVersions(java.lang.String bucketName,
java.lang.String objectKey)
Return version information for a specific object.
|
S3Bucket |
getOrCreateBucket(java.lang.String bucketName)
Returns a bucket in your account, and creates the bucket if
it does not yet exist.
|
S3Bucket |
getOrCreateBucket(java.lang.String bucketName,
java.lang.String location)
Returns a bucket in your S3 account, and creates the bucket in the given S3 location
if it does not yet exist.
|
S3Object |
getVersionedObject(java.lang.String versionId,
S3Bucket bucket,
java.lang.String objectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags,
java.lang.Long byteRangeStart,
java.lang.Long byteRangeEnd)
Returns an object representing the details and data of a versioned object in S3 that
also meets any given preconditions.
|
S3Object |
getVersionedObject(java.lang.String versionId,
java.lang.String bucketName,
java.lang.String objectKey)
Returns an object representing the details and data of an item in S3 with a specific
given version, without applying any preconditions.
|
S3Object |
getVersionedObject(java.lang.String versionId,
java.lang.String bucketName,
java.lang.String objectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags,
java.lang.Long byteRangeStart,
java.lang.Long byteRangeEnd)
Returns an object representing the details and data of a versioned object in S3 that
also meets any given preconditions.
|
AccessControlList |
getVersionedObjectAcl(java.lang.String versionId,
S3Bucket bucket,
java.lang.String objectKey)
Retrieves the access control settings of a versioned object.
|
AccessControlList |
getVersionedObjectAcl(java.lang.String versionId,
java.lang.String bucketName,
java.lang.String objectKey)
Retrieves the access control settings of a versioned object.
|
S3Object |
getVersionedObjectDetails(java.lang.String versionId,
S3Bucket bucket,
java.lang.String objectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags)
Returns an object representing the details of a versioned object in S3 that also
meets any given preconditions.
|
S3Object |
getVersionedObjectDetails(java.lang.String versionId,
java.lang.String bucketName,
java.lang.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.
|
S3Object |
getVersionedObjectDetails(java.lang.String versionId,
java.lang.String bucketName,
java.lang.String objectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags)
Returns an object representing the details of a versioned object in S3 that also meets
any given preconditions.
|
S3WebsiteConfig |
getWebsiteConfig(java.lang.String bucketName) |
boolean |
isRequesterPaysBucket(java.lang.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.
|
protected abstract boolean |
isRequesterPaysBucketImpl(java.lang.String bucketName) |
S3Bucket[] |
listAllBuckets()
Lists the buckets belonging to the service user.
|
S3Object[] |
listObjects(S3Bucket bucket)
Deprecated.
0.8.0
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 This method can be performed by anonymous services. Anonymous services can only list the objects in a publicly-readable bucket. |
S3Object[] |
listObjects(S3Bucket bucket,
java.lang.String prefix,
java.lang.String delimiter)
Deprecated.
0.8.0
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 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
|
S3Object[] |
listObjects(S3Bucket bucket,
java.lang.String prefix,
java.lang.String delimiter,
long maxListingLength)
Deprecated.
0.8.0
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 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
|
S3Object[] |
listObjects(java.lang.String bucketName)
Lists the objects in a bucket.
|
S3Object[] |
listObjects(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter)
Lists the objects in a bucket matching a prefix and delimiter.
|
S3Object[] |
listObjects(java.lang.String bucketName,
java.lang.String prefix,
java.lang.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.
|
BaseVersionOrDeleteMarker[] |
listVersionedObjects(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter)
Lists versioning information in a versioned bucket where the objects
match a given constraints.
|
VersionOrDeleteMarkersChunk |
listVersionedObjectsChunked(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
long maxListingLength,
java.lang.String priorLastKey,
java.lang.String priorLastVersionId,
boolean completeListing)
Lists information for a versioned bucket where the items match given constarints.
|
protected abstract VersionOrDeleteMarkersChunk |
listVersionedObjectsChunkedImpl(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
long maxListingLength,
java.lang.String priorLastKey,
java.lang.String priorLastVersion,
boolean completeListing)
Lists version or delete markers in a versioned bucket, up to the maximum listing
length specified.
|
protected abstract BaseVersionOrDeleteMarker[] |
listVersionedObjectsImpl(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
java.lang.String keyMarker,
java.lang.String versionMarker,
long maxListingLength) |
void |
multipartAbortUpload(MultipartUpload upload)
Abort the given multipart upload process.
|
protected abstract void |
multipartAbortUploadImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.String objectKey) |
MultipartCompleted |
multipartCompleteUpload(MultipartUpload upload)
Convenience method to complete a multipart upload by automatically finding
its parts.
|
MultipartCompleted |
multipartCompleteUpload(MultipartUpload upload,
java.util.List<MultipartPart> parts)
Complete a multipart upload by combining all the given parts into
the final object.
|
protected abstract MultipartCompleted |
multipartCompleteUploadImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.String objectKey,
java.util.List<MultipartPart> parts) |
java.util.List<MultipartPart> |
multipartListParts(MultipartUpload upload)
List the parts that have been uploaded for a given multipart upload.
|
protected abstract java.util.List<MultipartPart> |
multipartListPartsImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.String objectKey) |
java.util.List<MultipartUpload> |
multipartListUploads(java.lang.String bucketName)
List the multipart uploads that have been started within a bucket and
have not yet been completed or aborted.
|
java.util.List<MultipartUpload> |
multipartListUploads(java.lang.String bucketName,
java.lang.String nextKeyMarker,
java.lang.String nextUploadIdMarker,
java.lang.Integer maxUploads) |
java.util.List<MultipartUpload> |
multipartListUploads(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
java.lang.String nextKeyMarker,
java.lang.String nextUploadIdMarker,
java.lang.Integer maxUploads)
List the multipart uploads that have been started within
a bucket and have not yet been completed or aborted.
|
MultipartUploadChunk |
multipartListUploadsChunked(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
java.lang.String keyMarker,
java.lang.String uploadIdMarker,
java.lang.Integer maxUploads,
boolean completeListing)
List all or a subset of the multipart uploads that have been started
within a bucket and have not yet been completed or aborted.
|
protected abstract MultipartUploadChunk |
multipartListUploadsChunkedImpl(java.lang.String bucketName,
java.lang.String prefix,
java.lang.String delimiter,
java.lang.String keyMarker,
java.lang.String uploadIdMarker,
java.lang.Integer maxUploads,
boolean completeListing) |
MultipartUpload |
multipartStartUpload(java.lang.String bucketName,
S3Object object)
Start a multipart upload process for a given object; must be done before
individual parts can be uploaded.
|
MultipartUpload |
multipartStartUpload(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> metadata)
Start a multipart upload process for a given object; must be done before
individual parts can be uploaded.
|
MultipartUpload |
multipartStartUpload(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> metadata,
AccessControlList acl,
java.lang.String storageClass)
Start a multipart upload process for a given object; must be done before
individual parts can be uploaded.
|
protected abstract MultipartUpload |
multipartStartUploadImpl(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.Object> metadata,
AccessControlList acl,
java.lang.String storageClass,
java.lang.String serverSideEncryptionAlgorithm) |
MultipartPart |
multipartUploadPart(MultipartUpload upload,
java.lang.Integer partNumber,
S3Object object)
Upload an individual part that will comprise a piece of a multipart upload object.
|
MultipartPart |
multipartUploadPartCopy(MultipartUpload upload,
java.lang.Integer partNumber,
java.lang.String sourceBucketName,
java.lang.String sourceObjectKey)
From an existing object, copy an individual part that will comprise a piece of a
multipart upload object.
|
MultipartPart |
multipartUploadPartCopy(MultipartUpload upload,
java.lang.Integer partNumber,
java.lang.String sourceBucketName,
java.lang.String sourceObjectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags,
java.lang.Long byteRangeStart,
java.lang.Long byteRangeEnd,
java.lang.String versionId)
From an existing object, copy an individual part that will comprise a piece of a
multipart upload object.
|
MultipartPart |
multipartUploadPartCopy(MultipartUpload upload,
java.lang.Integer partNumber,
java.lang.String sourceBucketName,
java.lang.String sourceObjectKey,
java.lang.String versionId)
From an existing object, copy an individual part that will comprise a piece of a
multipart upload object.
|
protected abstract MultipartPart |
multipartUploadPartCopyImpl(java.lang.String uploadId,
java.lang.String targetBucketName,
java.lang.String targetObjectKey,
java.lang.Integer partNumber,
java.lang.String sourceBucketName,
java.lang.String sourceObjectKey,
java.util.Calendar ifModifiedSince,
java.util.Calendar ifUnmodifiedSince,
java.lang.String[] ifMatchTags,
java.lang.String[] ifNoneMatchTags,
java.lang.Long byteRangeStart,
java.lang.Long byteRangeEnd,
java.lang.String versionId) |
protected abstract MultipartPart |
multipartUploadPartImpl(java.lang.String uploadId,
java.lang.String bucketName,
java.lang.Integer partNumber,
S3Object object) |
S3Object |
putObject(S3Bucket bucket,
S3Object object)
Puts an object inside an existing bucket in S3, creating a new object or overwriting
an existing one with the same key.
|
S3Object |
putObject(java.lang.String bucketName,
S3Object object)
Puts an object inside an existing bucket in S3, creating a new object or overwriting
an existing one with the same key.
|
void |
putObjectAcl(S3Bucket bucket,
S3Object object)
Applies access control settings to an object.
|
void |
putObjectAcl(java.lang.String bucketName,
S3Object object)
Applies access control settings to an object.
|
void |
putObjectMaybeAsMultipart(java.lang.String bucketName,
StorageObject object,
long maxPartSize)
Convenience method that uploads a file-based object to a storage service using
the regular
StorageService.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(java.lang.String versionId,
S3Bucket bucket,
S3Object object)
Applies access control settings to a versioned object.
|
void |
putVersionedObjectAcl(java.lang.String versionId,
java.lang.String bucketName,
java.lang.String objectKey,
AccessControlList acl)
Applies access control settings to a versioned object.
|
void |
setBucketLoggingStatus(java.lang.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(java.lang.String bucketName,
java.lang.String policyDocument)
Apply a JSON access control policy document to a bucket.
|
protected abstract void |
setBucketPolicyImpl(java.lang.String bucketName,
java.lang.String policyDocument) |
void |
setLifecycleConfig(java.lang.String bucketName,
LifecycleConfig config)
Apply a lifecycle configuration to a bucket
|
abstract void |
setLifecycleConfigImpl(java.lang.String bucketName,
LifecycleConfig config) |
void |
setNotificationConfig(java.lang.String bucketName,
NotificationConfig config)
Apply a notification configuration to a bucket.
|
protected abstract void |
setNotificationConfigImpl(java.lang.String bucketName,
NotificationConfig config) |
void |
setRequesterPaysBucket(java.lang.String bucketName,
boolean requesterPays)
Applies
request payment configuration settings to a bucket, setting the bucket to
be either Requester Pays or Bucket Owner pays.
|
protected abstract void |
setRequesterPaysBucketImpl(java.lang.String bucketName,
boolean requesterPays) |
void |
setWebsiteConfig(java.lang.String bucketName,
S3WebsiteConfig config)
Apply a website configuration to a bucket.
|
void |
suspendBucketVersioning(java.lang.String bucketName)
Suspend (disable) the S3 object versioning feature for a bucket.
|
void |
suspendBucketVersioningWithMFA(java.lang.String bucketName,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode)
Suspend (disable) the S3 object versioning feature for a bucket that
requires multi-factor authentication.
|
void |
unsetNotificationConfig(java.lang.String bucketName)
Unset (delete) a bucket's notification configuration; removes the effect of any
previously-applied configuration.
|
protected abstract void |
updateBucketVersioningStatusImpl(java.lang.String bucketName,
boolean enabled,
boolean multiFactorAuthDeleteEnabled,
java.lang.String multiFactorSerialNumber,
java.lang.String multiFactorAuthCode) |
addMetadataToHeaders, addRequestHeadersToConnection, addRequestParametersToUrlPath, authorizeHttpRequest, checkBucketStatus, copyObjectImpl, createBucketImpl, createObjectImpl, deleteBucketImpl, deleteObjectImpl, deleteObjectWithSignedUrl, deleteWebsiteConfigImpl, getAccountOwnerImpl, getBucketAclImpl, getBucketLocationImpl, getBucketLoggingStatusImpl, getCredentialsProvider, getHttpClient, getHttpConnectionManager, getObjectAclImpl, getObjectAclImpl, getObjectAclWithSignedUrl, getObjectDetailsImpl, getObjectDetailsWithSignedUrl, getObjectImpl, getObjectWithSignedUrl, getRegionEndpointCache, getWebsiteConfigImpl, initHttpConnection, initializeDefaults, initializeProxy, isBucketAccessible, isLiveMD5HashingRequired, isRecoverable403, isTargettingGoogleStorageService, isXmlContentType, listAllBucketsImpl, listObjectsChunkedImpl, listObjectsImpl, listObjectsInternal, performRequest, performRequest, performRestDelete, performRestGet, performRestGet, performRestHead, performRestPost, performRestPostWithXmlBuilder, performRestPut, performRestPutWithXmlBuilder, prepareRESTHeaderAcl, prepareServerSideEncryption, prepareStorageClass, putAclImpl, putBucketAclImpl, putObjectAclImpl, putObjectAclWithSignedUrl, putObjectImpl, putObjectWithRequestEntityImpl, putObjectWithSignedUrl, setBucketLoggingStatusImpl, setCredentialsProvider, setHttpClient, setRegionEndpointCache, setupConnection, setWebsiteConfigImpl, shutdownImpl, verifyExpectedAndActualETagValues
assertAuthenticatedConnection, assertValidBucket, assertValidObject, assertValidObject, copyObject, copyObject, createBucket, createBucketImpl, deleteBucket, deleteBucket, deleteObject, getAccountOwner, getBucketAcl, getCurrentTimeWithOffset, getDisableDnsBuckets, getEnableServerSideEncryption, getEnableStorageClasses, getEndpoint, getHttpPort, getHttpsOnly, getHttpsPort, getInternalErrorRetryMax, getInvokingApplicationDescription, getJetS3tProperties, getObjectAcl, getObjectDetails, getObjectDetails, getProviderCredentials, getResourceParameterNames, getRestHeaderPrefix, getRestMetadataPrefix, getSignatureIdentifier, getVirtualPath, getXmlResponseSaxParser, isAuthenticatedConnection, isHttpsOnly, isObjectInBucket, isShutdown, listAllBucketsImpl, listObjectsChunked, listObjectsChunked, moveObject, newBucket, newObject, putBucketAcl, putBucketAcl, putObject, putObjectAcl, putObjectAcl, renameMetadataKeys, renameObject, setProviderCredentials, shutdown, sleepOnInternalError, updateObjectMetadata
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deleteObjectWithSignedUrl, getObjectAclWithSignedUrl, getObjectDetailsWithSignedUrl, getObjectWithSignedUrl, putObjectAclWithSignedUrl, putObjectWithSignedUrl
protected S3Service(ProviderCredentials credentials, java.lang.String invokingApplicationDescription, org.apache.http.client.CredentialsProvider credentialsProvider, Jets3tProperties jets3tProperties)
protected S3Service(ProviderCredentials credentials, java.lang.String invokingApplicationDescription, Jets3tProperties jets3tProperties)
S3Service
identified by the given user credentials.credentials
- the S3 user credentials to use when communicating with S3, may be null in which case the
communication is done as an anonymous user.invokingApplicationDescription
- a short description of the application using the service, suitable for inclusion in a
user agent string for REST/HTTP requests. Ideally this would include the application's
version number, for example: Cockpit/0.7.3
or My App Name/1.0
jets3tProperties
- JetS3t properties that will be applied within this service.protected S3Service(ProviderCredentials credentials, java.lang.String invokingApplicationDescription)
S3Service
identified by the given user credentials.credentials
- the S3 user credentials to use when communicating with S3, may be null in which case the
communication is done as an anonymous user.invokingApplicationDescription
- a short description of the application using the service, suitable for inclusion in a
user agent string for REST/HTTP requests. Ideally this would include the application's
version number, for example: Cockpit/0.7.3
or My App Name/1.0
protected S3Service(ProviderCredentials credentials)
S3Service
identified by the given user credentials.credentials
- the S3 user credentials to use when communicating with S3, may be null in which case the
communication is done as an anonymous user.public java.lang.String createUnsignedObjectUrl(java.lang.String bucketName, java.lang.String objectKey, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled)
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.public java.lang.String createSignedUrlUsingSignatureVersion(java.lang.String requestSignatureVersion, java.lang.String region, java.lang.String method, java.lang.String bucketName, java.lang.String objectKey, java.lang.String specialParamName, java.util.Map<java.lang.String,java.lang.Object> headersMap, long secondsSinceEpoch, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled)
requestSignatureVersion
- String specifying an Amazon signature version: "AWS4-HMAC-SHA256"
(version 4) or "AWS2" (version 2 / default / legacy)region
- region to which the request will be sent
"http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region".
This is ignored for legacy "AWS2" signatures.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.
Note 2: For signature version "AWS4-HMAC-SHA256" this time cannot be more
than 7 days into the future.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.public java.lang.String createSignedUrl(java.lang.String method, java.lang.String bucketName, java.lang.String objectKey, java.lang.String specialParamName, java.util.Map<java.lang.String,java.lang.Object> headersMap, long secondsSinceEpoch, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled)
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.public java.lang.String createSignedUrl(java.lang.String method, java.lang.String bucketName, java.lang.String objectKey, java.lang.String specialParamName, java.util.Map<java.lang.String,java.lang.Object> headersMap, long secondsSinceEpoch, boolean isVirtualHost)
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.public java.lang.String createSignedUrl(java.lang.String method, java.lang.String bucketName, java.lang.String objectKey, java.lang.String specialParamName, java.util.Map<java.lang.String,java.lang.Object> headersMap, long secondsSinceEpoch)
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.public java.lang.String createSignedGetUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Date expiryTime, boolean isVirtualHost)
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.public java.lang.String createSignedGetUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Date expiryTime) throws S3ServiceException
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.S3ServiceException
public java.lang.String createSignedPutUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> headersMap, java.util.Date expiryTime, boolean isVirtualHost)
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.public java.lang.String createSignedPutUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> headersMap, java.util.Date expiryTime)
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.public java.lang.String createSignedDeleteUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Date expiryTime, boolean isVirtualHost)
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.public java.lang.String createSignedDeleteUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Date expiryTime)
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.public java.lang.String createSignedHeadUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Date expiryTime, boolean isVirtualHost)
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.public java.lang.String createSignedHeadUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Date expiryTime) throws S3ServiceException
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.S3ServiceException
@Deprecated public static java.lang.String createSignedUrl(java.lang.String method, java.lang.String bucketName, java.lang.String objectKey, java.lang.String specialParamName, java.util.Map<java.lang.String,java.lang.Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch, boolean isVirtualHost, boolean isHttps, boolean isDnsBucketNamingDisabled)
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.@Deprecated public java.lang.String createSignedUrl(java.lang.String method, java.lang.String bucketName, java.lang.String objectKey, java.lang.String specialParamName, java.util.Map<java.lang.String,java.lang.Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch, boolean isVirtualHost)
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.@Deprecated public java.lang.String createSignedUrl(java.lang.String method, java.lang.String bucketName, java.lang.String objectKey, java.lang.String specialParamName, java.util.Map<java.lang.String,java.lang.Object> headersMap, ProviderCredentials credentials, long secondsSinceEpoch) throws S3ServiceException
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.S3ServiceException
@Deprecated public java.lang.String createSignedGetUrl(java.lang.String bucketName, java.lang.String objectKey, ProviderCredentials credentials, java.util.Date expiryTime, boolean isVirtualHost)
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.@Deprecated public java.lang.String createSignedGetUrl(java.lang.String bucketName, java.lang.String objectKey, ProviderCredentials credentials, java.util.Date expiryTime) throws S3ServiceException
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.S3ServiceException
@Deprecated public java.lang.String createSignedPutUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> headersMap, ProviderCredentials credentials, java.util.Date expiryTime, boolean isVirtualHost)
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.@Deprecated public java.lang.String createSignedPutUrl(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> headersMap, ProviderCredentials credentials, java.util.Date expiryTime) throws S3ServiceException
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.S3ServiceException
@Deprecated public java.lang.String createSignedDeleteUrl(java.lang.String bucketName, java.lang.String objectKey, ProviderCredentials credentials, java.util.Date expiryTime, boolean isVirtualHost)
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.@Deprecated public java.lang.String createSignedDeleteUrl(java.lang.String bucketName, java.lang.String objectKey, ProviderCredentials credentials, java.util.Date expiryTime) throws S3ServiceException
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.S3ServiceException
@Deprecated public java.lang.String createSignedHeadUrl(java.lang.String bucketName, java.lang.String objectKey, ProviderCredentials credentials, java.util.Date expiryTime, boolean isVirtualHost)
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.@Deprecated public java.lang.String createSignedHeadUrl(java.lang.String bucketName, java.lang.String objectKey, ProviderCredentials credentials, java.util.Date expiryTime)
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.public java.lang.String createTorrentUrl(java.lang.String bucketName, java.lang.String objectKey)
bucketName
- the name of the bucket containing the object.objectKey
- the name of the object.public static java.lang.String generatePostPolicyCondition(java.lang.String operation, java.lang.String name, java.lang.String value)
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.public static java.lang.String generatePostPolicyCondition_AllowAnyValue(java.lang.String name)
name
- the name of the data item that will be allowed to take on any value.public static java.lang.String generatePostPolicyCondition_Equality(java.lang.String name, java.lang.String value)
name
- the name of the data item that will be tested.value
- the value that the named data item must match.public static java.lang.String generatePostPolicyCondition_Equality(java.lang.String name, java.lang.String[] values)
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.public static java.lang.String generatePostPolicyCondition_Equality(java.lang.String name, java.util.List<java.lang.String> values)
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.public static java.lang.String generatePostPolicyCondition_Range(int min, int max)
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.public static java.lang.String buildPostForm(java.lang.String bucketName, java.lang.String key) throws S3ServiceException, java.io.UnsupportedEncodingException
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.
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.S3ServiceException
java.io.UnsupportedEncodingException
public static java.lang.String buildPostForm(java.lang.String bucketName, java.lang.String key, ProviderCredentials credentials, java.util.Date expiration, java.lang.String[] conditions, java.lang.String[] inputFields, java.lang.String textInput, boolean isSecureHttp) throws S3ServiceException, java.io.UnsupportedEncodingException
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.
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 method generatePostPolicyCondition(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.S3ServiceException
java.io.UnsupportedEncodingException
public static java.lang.String buildPostForm(java.lang.String bucketName, java.lang.String key, ProviderCredentials credentials, java.util.Date expiration, java.lang.String[] conditions, java.lang.String[] inputFields, java.lang.String textInput, boolean isSecureHttp, boolean usePathStyleUrl, java.lang.String submitButtonName) throws S3ServiceException, java.io.UnsupportedEncodingException
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.
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 method generatePostPolicyCondition(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.S3ServiceException
java.io.UnsupportedEncodingException
public S3Bucket[] listAllBuckets() throws S3ServiceException
StorageService
This method cannot be performed by anonymous services, and will fail with an exception if the service is not authenticated.
listAllBuckets
in class StorageService
S3ServiceException
public S3Object getObject(java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
StorageService
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.
getObject
in class StorageService
bucketName
- the name of the bucket containing the object.objectKey
- the key identifying the object.S3ServiceException
@Deprecated public S3Object[] listObjects(S3Bucket bucket) throws S3ServiceException
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
or getObjectDetails
operations.
This method can be performed by anonymous services. Anonymous services can only list the objects in a publicly-readable bucket.
bucket
- the bucket whose contents will be listed.
This must be a valid S3Bucket object that is non-null and contains a name.S3ServiceException
public S3Object[] listObjects(java.lang.String bucketName) throws S3ServiceException
StorageService
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
or getObjectDetails
operations.
This method can be performed by anonymous services. Anonymous services can only list the objects in a publicly-readable bucket.
listObjects
in class StorageService
bucketName
- the name of the bucket whose contents will be listed.S3ServiceException
public S3Object[] listObjects(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, long maxListingLength) throws S3ServiceException
StorageService
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
or getObjectDetails
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.
listObjects
in class StorageService
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.S3ServiceException
@Deprecated public S3Object[] listObjects(S3Bucket bucket, java.lang.String prefix, java.lang.String delimiter) throws S3ServiceException
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
or getObjectDetails
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.
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.S3ServiceException
public S3Object[] listObjects(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter) throws S3ServiceException
StorageService
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
or getObjectDetails
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.
listObjects
in class StorageService
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.S3ServiceException
public S3Bucket createBucket(java.lang.String bucketName) throws S3ServiceException
StorageService
StorageService.getOrCreateBucket(String)
in situations where the bucket may already exist.
This method cannot be performed by anonymous services.createBucket
in class StorageService
bucketName
- the name of the bucket to create.S3ServiceException
public S3Bucket getOrCreateBucket(java.lang.String bucketName) throws S3ServiceException
StorageService
getOrCreateBucket
in class StorageService
bucketName
- the name of the bucket to retrieve or create.S3ServiceException
public S3Bucket createBucket(java.lang.String bucketName, java.lang.String location, AccessControlList acl) throws S3ServiceException
getOrCreateBucket(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.
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
default S3Bucket.LOCATION_US_STANDARD
location. Valid values
include S3Bucket.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
or S3Bucket.LOCATION_US
.acl
- the access control settings to apply to the new bucket, or null for default ACL values.S3ServiceException
public S3Bucket createBucket(java.lang.String bucketName, java.lang.String location) throws S3ServiceException
getOrCreateBucket(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.
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
default S3Bucket.LOCATION_US_STANDARD
location. Valid values
include S3Bucket.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
or S3Bucket.LOCATION_US
.S3ServiceException
@Deprecated public S3Object getObject(S3Bucket bucket, java.lang.String objectKey) throws S3ServiceException
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.
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.S3ServiceException
public S3Object getVersionedObject(java.lang.String versionId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
enableBucketVersioning(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.
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.S3ServiceException
@Deprecated public S3Object getObjectDetails(S3Bucket bucket, java.lang.String objectKey) throws S3ServiceException
This method can be performed by anonymous services. Anonymous services can get a publicly-readable object's details.
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.S3ServiceException
public S3Object getVersionedObjectDetails(java.lang.String versionId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
enableBucketVersioning(String)
.
This method can be performed by anonymous services. Anonymous services can get a publicly-readable object's details.
versionId
- object's version identifierbucketName
- the name of the versioned bucket containing the object.objectKey
- the key identifying the object.S3ServiceException
@Deprecated public S3Object[] listObjects(S3Bucket bucket, java.lang.String prefix, java.lang.String delimiter, long maxListingLength) throws S3ServiceException
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
or getObjectDetails
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.
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.S3ServiceException
public BaseVersionOrDeleteMarker[] listVersionedObjects(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter) throws S3ServiceException
This operation can only be performed by the bucket owner.
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.S3ServiceException
public BaseVersionOrDeleteMarker[] getObjectVersions(java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
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)
or
listVersionedObjectsChunked(String, String, String, long, String, String, boolean)
methods instead.
bucketName
- the name of the versioned bucket containing the object.objectKey
- the key identifying the object.S3Version
and S3DeleteMarker
objects that describe
the version history of the given object.S3ServiceException
public VersionOrDeleteMarkersChunk listVersionedObjectsChunked(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, long maxListingLength, java.lang.String priorLastKey, java.lang.String priorLastVersionId, boolean completeListing) throws S3ServiceException
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
or getObjectDetails
operations.
This method can be performed by anonymous services. Anonymous services can list the contents of a publicly-readable bucket.
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.S3ServiceException
public S3Bucket createBucket(S3Bucket bucket) throws S3ServiceException
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.
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.S3ServiceException
public S3Bucket getBucket(java.lang.String bucketName) throws S3ServiceException
StorageService
StorageService.listAllBuckets()
), and looking for the named bucket in
this list.
This method cannot be performed by anonymous services.
getBucket
in class StorageService
S3ServiceException
public S3Bucket getOrCreateBucket(java.lang.String bucketName, java.lang.String location) throws S3ServiceException
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.
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
include S3Bucket.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
or S3Bucket.LOCATION_US
.S3ServiceException
@Deprecated public void deleteBucket(S3Bucket bucket) throws S3ServiceException
This method cannot be performed by anonymous services.
bucket
- the bucket to delete.S3ServiceException
public void enableBucketVersioning(java.lang.String bucketName) throws S3ServiceException
bucketName
- the name of the bucket that will have versioning enabled.S3ServiceException
public void enableBucketVersioningAndMFA(java.lang.String bucketName) throws S3ServiceException
bucketName
- the name of the bucket that will have versioning enabled.S3ServiceException
public void enableBucketVersioningWithMFA(java.lang.String bucketName, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode) throws S3ServiceException
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.S3ServiceException
public void disableMFAForVersionedBucket(java.lang.String bucketName, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode) throws S3ServiceException
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.S3ServiceException
public void suspendBucketVersioning(java.lang.String bucketName) throws S3ServiceException
bucketName
- the name of the versioned bucket that will have versioning suspended.S3ServiceException
public void suspendBucketVersioningWithMFA(java.lang.String bucketName, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode) throws S3ServiceException
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.S3ServiceException
public S3BucketVersioningStatus getBucketVersioningStatus(java.lang.String bucketName) throws S3ServiceException
bucketName
- the name of the bucket.S3ServiceException
public S3Object putObject(java.lang.String bucketName, S3Object object) throws S3ServiceException
This method can be performed by anonymous services. Anonymous services can put objects into a publicly-writable bucket.
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.
S3ServiceException
public java.util.Map<java.lang.String,java.lang.Object> copyVersionedObject(java.lang.String versionId, java.lang.String sourceBucketName, java.lang.String sourceObjectKey, java.lang.String destinationBucketName, S3Object destinationObject, boolean replaceMetadata, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags) throws S3ServiceException
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.
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.S3ServiceException
public java.util.Map<java.lang.String,java.lang.Object> copyVersionedObject(java.lang.String versionId, java.lang.String sourceBucketName, java.lang.String sourceObjectKey, java.lang.String destinationBucketName, S3Object destinationObject, boolean replaceMetadata) throws S3ServiceException
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.
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.S3ServiceException
public S3Object putObject(S3Bucket bucket, S3Object object) throws S3ServiceException
This method can be performed by anonymous services. Anonymous services can put objects into a publicly-writable bucket.
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.
S3ServiceException
public void deleteObject(S3Bucket bucket, java.lang.String objectKey) throws S3ServiceException
This method can be performed by anonymous services. Anonymous services can delete objects from publicly-writable buckets.
bucket
- the bucket containing the object to be deleted.objectKey
- the key representing the object in S3.S3ServiceException
public void deleteVersionedObjectWithMFA(java.lang.String versionId, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
This operation can only be performed by the owner of the S3 bucket.
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.S3ServiceException
public void deleteVersionedObject(java.lang.String versionId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
This operation can only be performed by the owner of the S3 bucket.
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.S3ServiceException
public MultipleDeleteResult deleteMultipleObjects(java.lang.String bucketName, java.lang.String[] keys) throws S3ServiceException
bucketName
- the name of the versioned bucket containing the object to be deleted.keys
- key names of objects to delete.
both errors (if any) and a list of object successfully deleted
the key representing the object in S3.S3ServiceException
public MultipleDeleteResult deleteMultipleObjects(java.lang.String bucketName, ObjectKeyAndVersion[] objectNameAndVersions) throws S3ServiceException
bucketName
- the name of the versioned bucket containing the object to be deleted.objectNameAndVersions
- information about one or more objects to delete, including at least the object's
key name and optionally the object's version.
both errors (if any) and a list of object successfully deleted
the key representing the object in S3.S3ServiceException
public MultipleDeleteResult deleteMultipleObjects(java.lang.String bucketName, ObjectKeyAndVersion[] objectNameAndVersions, boolean isQuiet) throws S3ServiceException
bucketName
- the name of the versioned bucket containing the object to be deleted.objectNameAndVersions
- information about one or more objects to delete, including at least the object's
key name and optionally the object's version.isQuiet
- if true result will only include errors, if any. If false, result will include
both errors (if any) and a list of object successfully deleted
the key representing the object in S3.S3ServiceException
public MultipleDeleteResult deleteMultipleObjectsWithMFA(java.lang.String bucketName, ObjectKeyAndVersion[] objectNameAndVersions, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode, boolean isQuiet) throws S3ServiceException
bucketName
- the name of the versioned bucket containing the object to be deleted.objectNameAndVersions
- information about one or more objects to delete, including at least the object's
key name and optionally the object's version.multiFactorSerialNumber
- the serial number for a multi-factor authentication device.multiFactorAuthCode
- a multi-factor authentication code generated by a device.isQuiet
- if true result will only include errors, if any. If false, result will include
both errors (if any) and a list of object successfully deleted
the key representing the object in S3.S3ServiceException
public S3Object getObjectDetails(S3Bucket bucket, java.lang.String objectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags) throws S3ServiceException
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.
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.S3ServiceException
public S3Object getVersionedObjectDetails(java.lang.String versionId, S3Bucket bucket, java.lang.String objectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags) throws S3ServiceException
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.
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.S3ServiceException
public S3Object getVersionedObjectDetails(java.lang.String versionId, java.lang.String bucketName, java.lang.String objectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags) throws S3ServiceException
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.
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.S3ServiceException
public S3Object getObject(java.lang.String bucketName, java.lang.String objectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags, java.lang.Long byteRangeStart, java.lang.Long byteRangeEnd) throws S3ServiceException
StorageService
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.
getObject
in class StorageService
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.S3ServiceException
public S3Object getObject(S3Bucket bucket, java.lang.String objectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags, java.lang.Long byteRangeStart, java.lang.Long byteRangeEnd) throws S3ServiceException
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.
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.S3ServiceException
public S3Object getVersionedObject(java.lang.String versionId, S3Bucket bucket, java.lang.String objectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags, java.lang.Long byteRangeStart, java.lang.Long byteRangeEnd) throws S3ServiceException
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.
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.S3ServiceException
public S3Object getVersionedObject(java.lang.String versionId, java.lang.String bucketName, java.lang.String objectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags, java.lang.Long byteRangeStart, java.lang.Long byteRangeEnd) throws S3ServiceException
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.
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.S3ServiceException
public void putObjectAcl(S3Bucket bucket, S3Object object) throws S3ServiceException
bucket
- the bucket containing the object to modify.object
- the object with ACL settings that will be applied.S3ServiceException
public void putObjectAcl(java.lang.String bucketName, S3Object object) throws S3ServiceException
bucketName
- the name of the bucket containing the object to modify.object
- the object with ACL settings that will be applied.S3ServiceException
public void putVersionedObjectAcl(java.lang.String versionId, java.lang.String bucketName, java.lang.String objectKey, AccessControlList acl) throws S3ServiceException
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.S3ServiceException
public void putVersionedObjectAcl(java.lang.String versionId, S3Bucket bucket, S3Object object) throws S3ServiceException
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.S3ServiceException
public AccessControlList getObjectAcl(S3Bucket bucket, java.lang.String objectKey) throws S3ServiceException
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.S3ServiceException
public AccessControlList getVersionedObjectAcl(java.lang.String versionId, S3Bucket bucket, java.lang.String objectKey) throws S3ServiceException
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.S3ServiceException
public AccessControlList getVersionedObjectAcl(java.lang.String versionId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
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.S3ServiceException
public AccessControlList getBucketAcl(S3Bucket bucket) throws S3ServiceException
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.S3ServiceException
public java.lang.String getBucketLocation(java.lang.String bucketName) throws S3ServiceException
bucketName
- the name of the bucket whose location will be returned.S3ServiceException
public S3BucketLoggingStatus getBucketLoggingStatus(java.lang.String bucketName) throws S3ServiceException
bucketName
- the name of the bucket whose logging status settings will be returned.S3ServiceException
public void setBucketLoggingStatus(java.lang.String bucketName, S3BucketLoggingStatus status, boolean updateTargetACLifRequired) throws S3ServiceException
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.S3ServiceException
public void setBucketPolicy(java.lang.String bucketName, java.lang.String policyDocument) throws S3ServiceException
bucketName
- Name of the bucketpolicyDocument
- JSON access control policy documentS3ServiceException
public java.lang.String getBucketPolicy(java.lang.String bucketName) throws S3ServiceException
bucketName
- Name of the bucketS3ServiceException
public void deleteBucketPolicy(java.lang.String bucketName) throws S3ServiceException
bucketName
- Name of the bucketS3ServiceException
public boolean isRequesterPaysBucket(java.lang.String bucketName) throws S3ServiceException
bucketName
- the name of the bucket whose request payment configuration setting will be returned.S3ServiceException
public void setRequesterPaysBucket(java.lang.String bucketName, boolean requesterPays) throws S3ServiceException
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).S3ServiceException
public void putObjectMaybeAsMultipart(java.lang.String bucketName, StorageObject object, long maxPartSize) throws ServiceException
StorageService.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:
multipartAbortUpload(MultipartUpload)
then throw the original exceptionbucketName
- 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 from
StorageObject.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.ServiceException
public MultipartUpload multipartStartUpload(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> metadata) throws S3ServiceException
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.S3ServiceException
public MultipartUpload multipartStartUpload(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> metadata, AccessControlList acl, java.lang.String storageClass) throws S3ServiceException
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
- Canned ACL to apply to the completed upload, may be null.
NOTE: non-canned ACLs cannot be applied at the start of multipart uploads,
and must be applied to the object after it has been completed.storageClass
- storage class to apply to the completed upload, may be null.S3ServiceException
public MultipartUpload multipartStartUpload(java.lang.String bucketName, S3Object object) throws S3ServiceException
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, server-side encryption algorithmS3ServiceException
public void multipartAbortUpload(MultipartUpload upload) throws S3ServiceException
upload
- the multipart upload to abort.S3ServiceException
public java.util.List<MultipartUpload> multipartListUploads(java.lang.String bucketName) throws S3ServiceException
bucketName
- the bucket whose multipart uploads will be listed.S3ServiceException
public java.util.List<MultipartUpload> multipartListUploads(java.lang.String bucketName, java.lang.String nextKeyMarker, java.lang.String nextUploadIdMarker, java.lang.Integer maxUploads) throws S3ServiceException
S3ServiceException
public java.util.List<MultipartUpload> multipartListUploads(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, java.lang.String nextKeyMarker, java.lang.String nextUploadIdMarker, java.lang.Integer maxUploads) throws S3ServiceException
bucketName
- the bucket whose multipart uploads will be listed.prefix
- the prefix to use gor the started uploadsdelimiter
- the delimiter (e.g. '/')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 retrieve at a time.S3ServiceException
public MultipartUploadChunk multipartListUploadsChunked(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, java.lang.String keyMarker, java.lang.String uploadIdMarker, java.lang.Integer maxUploads, boolean completeListing) throws S3ServiceException
bucketName
- the bucket whose multipart uploads will be listed.prefix
- the prefix to use gor the started uploadsdelimiter
- the delimiter (e.g. '/')keyMarker
- marker indicating where this list subset should start by key name.uploadIdMarker
- marker indicating where this list subset should start by upload ID.maxUploads
- maximum number of uploads to retrieve at a time.completeListing
- true to go on listing as long as there are uploads to be retrievedS3ServiceException
MultipartUploadChunk
public java.util.List<MultipartPart> multipartListParts(MultipartUpload upload) throws S3ServiceException
upload
- the multipart upload whose parts will be listed.S3ServiceException
public MultipartCompleted multipartCompleteUpload(MultipartUpload upload, java.util.List<MultipartPart> parts) throws S3ServiceException
upload
- the multipart upload whose parts will be completed.parts
- the parts comprising the final object.S3ServiceException
public MultipartCompleted multipartCompleteUpload(MultipartUpload upload) throws S3ServiceException
multipartCompleteUpload(MultipartUpload, List)
API operation, but
relieves the caller of having to keep track of all the parts uploaded
for a multipart upload.upload
- the multipart upload whose parts will be completed.S3ServiceException
public MultipartPart multipartUploadPart(MultipartUpload upload, java.lang.Integer partNumber, S3Object object) throws S3ServiceException
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.multipartCompleteUpload(MultipartUpload, List)
.S3ServiceException
public MultipartPart multipartUploadPartCopy(MultipartUpload upload, java.lang.Integer partNumber, java.lang.String sourceBucketName, java.lang.String sourceObjectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags, java.lang.Long byteRangeStart, java.lang.Long byteRangeEnd, java.lang.String versionId) throws S3ServiceException
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.sourceBucketName
- the name of the bucket that contains the original object.sourceObjectKey
- the key name of the original object.ifModifiedSince
- a precondition specifying a date after which the source object must have been
modified, ignored if null.ifUnmodifiedSince
- a precondition specifying a date after which the source object must not have
been modified, ignored if null.ifMatchTags
- a precondition specifying an MD5 hash the source object must match, ignored if
null.ifNoneMatchTags
- a precondition specifying an MD5 hash the source object must not match, ignored
if null.byteRangeStart
- include only a portion of the source object's data - starting at this point, ignored if null.
Byte ranges may only be used for source objects larger than 5 GB.byteRangeEnd
- include only a portion of the source object's data - ending at this point, ignored if null.
Byte ranges may only be used for source objects larger than 5 GB.versionId
- identifier matching an existing source object version that will be retrieved.multipartCompleteUpload(MultipartUpload, List)
.S3ServiceException
public MultipartPart multipartUploadPartCopy(MultipartUpload upload, java.lang.Integer partNumber, java.lang.String sourceBucketName, java.lang.String sourceObjectKey, java.lang.String versionId) throws S3ServiceException
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.sourceBucketName
- the name of the bucket that contains the original object.sourceObjectKey
- the key name of the original object.versionId
- identifier matching an existing source object version that will be retrieved.multipartCompleteUpload(MultipartUpload, List)
.S3ServiceException
public MultipartPart multipartUploadPartCopy(MultipartUpload upload, java.lang.Integer partNumber, java.lang.String sourceBucketName, java.lang.String sourceObjectKey) throws S3ServiceException
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.sourceBucketName
- the name of the bucket that contains the original object.sourceObjectKey
- the key name of the original object.multipartCompleteUpload(MultipartUpload, List)
.S3ServiceException
public void setWebsiteConfig(java.lang.String bucketName, S3WebsiteConfig config) throws S3ServiceException
bucketName
- bucket to which the website configuration will be applied.config
- the website configuration details.S3ServiceException
public S3WebsiteConfig getWebsiteConfig(java.lang.String bucketName) throws S3ServiceException
bucketName
- a bucket with a website configuration.S3ServiceException
public void deleteWebsiteConfig(java.lang.String bucketName) throws S3ServiceException
bucketName
- a bucket with a website configuration.S3ServiceException
public void setNotificationConfig(java.lang.String bucketName, NotificationConfig config) throws S3ServiceException
bucketName
- the bucket to which the notification configuration will be applied.config
- the notification configuration to apply.S3ServiceException
public NotificationConfig getNotificationConfig(java.lang.String bucketName) throws S3ServiceException
bucketName
- a bucket with a notification configuration.S3ServiceException
public void unsetNotificationConfig(java.lang.String bucketName) throws S3ServiceException
bucketName
- a bucket with a notification configuration.S3ServiceException
public LifecycleConfig getLifecycleConfig(java.lang.String bucketName) throws S3ServiceException
bucketName
- a bucket with a lifecycle configuration.S3ServiceException
public void setLifecycleConfig(java.lang.String bucketName, LifecycleConfig config) throws S3ServiceException
bucketName
- the bucket to which the lifecycle configuration will be applied.config
- the lifecycle configuration to apply.S3ServiceException
public void deleteLifecycleConfig(java.lang.String bucketName) throws S3ServiceException
bucketName
- a bucket with a lifecycle configuration.S3ServiceException
protected abstract void setBucketPolicyImpl(java.lang.String bucketName, java.lang.String policyDocument) throws S3ServiceException
S3ServiceException
protected abstract java.lang.String getBucketPolicyImpl(java.lang.String bucketName) throws S3ServiceException
S3ServiceException
protected abstract void deleteBucketPolicyImpl(java.lang.String bucketName) throws S3ServiceException
S3ServiceException
protected abstract void setRequesterPaysBucketImpl(java.lang.String bucketName, boolean requesterPays) throws S3ServiceException
S3ServiceException
protected abstract boolean isRequesterPaysBucketImpl(java.lang.String bucketName) throws S3ServiceException
S3ServiceException
protected abstract BaseVersionOrDeleteMarker[] listVersionedObjectsImpl(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, java.lang.String keyMarker, java.lang.String versionMarker, long maxListingLength) throws S3ServiceException
S3ServiceException
protected abstract VersionOrDeleteMarkersChunk listVersionedObjectsChunkedImpl(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, long maxListingLength, java.lang.String priorLastKey, java.lang.String priorLastVersion, boolean completeListing) throws S3ServiceException
Implementation notes The implementation of this method returns only as many items as requested in the chunk size. It is the responsibility of the caller to build a complete object listing from multiple chunks, should this be necessary.
bucketName
- prefix
- delimiter
- only list objects with key names up to this delimiter, may be null.maxListingLength
- priorLastKey
- completeListing
- S3ServiceException
protected abstract void updateBucketVersioningStatusImpl(java.lang.String bucketName, boolean enabled, boolean multiFactorAuthDeleteEnabled, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode) throws S3ServiceException
S3ServiceException
protected abstract S3BucketVersioningStatus getBucketVersioningStatusImpl(java.lang.String bucketName) throws S3ServiceException
S3ServiceException
protected abstract MultipartUpload multipartStartUploadImpl(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.Object> metadata, AccessControlList acl, java.lang.String storageClass, java.lang.String serverSideEncryptionAlgorithm) throws S3ServiceException
S3ServiceException
protected abstract void multipartAbortUploadImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
S3ServiceException
protected abstract MultipartUploadChunk multipartListUploadsChunkedImpl(java.lang.String bucketName, java.lang.String prefix, java.lang.String delimiter, java.lang.String keyMarker, java.lang.String uploadIdMarker, java.lang.Integer maxUploads, boolean completeListing) throws S3ServiceException
S3ServiceException
protected abstract java.util.List<MultipartPart> multipartListPartsImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.String objectKey) throws S3ServiceException
S3ServiceException
protected abstract MultipartCompleted multipartCompleteUploadImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.String objectKey, java.util.List<MultipartPart> parts) throws S3ServiceException
S3ServiceException
protected abstract MultipartPart multipartUploadPartImpl(java.lang.String uploadId, java.lang.String bucketName, java.lang.Integer partNumber, S3Object object) throws S3ServiceException
S3ServiceException
protected abstract MultipartPart multipartUploadPartCopyImpl(java.lang.String uploadId, java.lang.String targetBucketName, java.lang.String targetObjectKey, java.lang.Integer partNumber, java.lang.String sourceBucketName, java.lang.String sourceObjectKey, java.util.Calendar ifModifiedSince, java.util.Calendar ifUnmodifiedSince, java.lang.String[] ifMatchTags, java.lang.String[] ifNoneMatchTags, java.lang.Long byteRangeStart, java.lang.Long byteRangeEnd, java.lang.String versionId) throws S3ServiceException
S3ServiceException
protected abstract void setNotificationConfigImpl(java.lang.String bucketName, NotificationConfig config) throws S3ServiceException
S3ServiceException
protected abstract NotificationConfig getNotificationConfigImpl(java.lang.String bucketName) throws S3ServiceException
S3ServiceException
public abstract MultipleDeleteResult deleteMultipleObjectsWithMFAImpl(java.lang.String bucketName, ObjectKeyAndVersion[] objectNameAndVersions, java.lang.String multiFactorSerialNumber, java.lang.String multiFactorAuthCode, boolean isQuiet) throws S3ServiceException
S3ServiceException
public abstract LifecycleConfig getLifecycleConfigImpl(java.lang.String bucketName) throws S3ServiceException
S3ServiceException
public abstract void setLifecycleConfigImpl(java.lang.String bucketName, LifecycleConfig config) throws S3ServiceException
S3ServiceException
public abstract void deleteLifecycleConfigImpl(java.lang.String bucketName) throws S3ServiceException
S3ServiceException