public interface S3Client extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
abortMultipartUpload(String bucketName,
String key,
String uploadId)
This operation aborts a multipart upload.
|
boolean |
bucketExists(String bucketName)
Issues a HEAD command to determine if the bucket exists or not.
|
String |
completeMultipartUpload(String bucketName,
String key,
String uploadId,
Map<Integer,String> parts)
This operation completes a multipart upload by assembling previously uploaded parts.
|
ObjectMetadata |
copyObject(String sourceBucket,
String sourceObject,
String destinationBucket,
String destinationObject,
CopyObjectOptions... options)
Copies one object to another bucket, retaining UserMetadata from the source.
|
boolean |
deleteBucketIfEmpty(String bucketName)
Deletes the bucket, if it is empty.
|
void |
deleteObject(String bucketName,
String key)
Removes the object and metadata associated with the key.
|
DeleteResult |
deleteObjects(String bucketName,
Iterable<String> keys)
The Multi-Object Delete operation enables you to delete multiple objects from a bucket using a
single HTTP request.
|
void |
disableBucketLogging(String bucketName)
Disables logging for a bucket.
|
void |
enableBucketLogging(String bucketName,
BucketLogging logging)
Enables logging for a bucket.
|
AccessControlList |
getBucketACL(String bucketName)
A GET request operation directed at an object or bucket URI with the "acl" parameter retrieves
the Access Control List (ACL) settings for that S3 item.
|
String |
getBucketLocation(String bucketName)
A GET location request operation using a bucket URI lists the location constraint of the
bucket.
|
BucketLogging |
getBucketLogging(String bucketName)
Inspects the logging status for a bucket.
|
Payer |
getBucketPayer(String bucketName)
A GET request operation on a requestPayment resource returns the request payment configuration
of a bucket.
|
S3Object |
getObject(String bucketName,
String key,
GetOptions... options)
Retrieves the S3Object associated with the Key or KeyNotFoundException if not available;
To use GET, you must have READ access to the object.
|
AccessControlList |
getObjectACL(String bucketName,
String key)
A GET request operation directed at an object or bucket URI with the "acl" parameter retrieves
the Access Control List (ACL) settings for that S3 item.
|
ObjectMetadata |
headObject(String bucketName,
String key)
Retrieves the
metadata of
the object associated with the key or null if not available. |
String |
initiateMultipartUpload(String bucketName,
ObjectMetadata objectMetadata,
PutObjectOptions... options)
This operation initiates a multipart upload and returns an upload ID.
|
ListBucketResponse |
listBucket(String bucketName,
ListBucketOptions... options)
Retrieve a
S3Bucket listing. |
Set<BucketMetadata> |
listOwnedBuckets()
Returns a list of all of the buckets owned by the authenticated sender of the request.
|
S3Object |
newS3Object()
Creates a default implementation of S3Object
|
boolean |
objectExists(String bucketName,
String key) |
boolean |
putBucketACL(String bucketName,
AccessControlList acl)
Update a bucket's Access Control List settings.
|
boolean |
putBucketInRegion(String region,
String bucketName,
PutBucketOptions... options)
Create and name your own bucket in which to store your objects.
|
String |
putObject(String bucketName,
S3Object object,
PutObjectOptions... options)
Store data by creating or overwriting an object.
|
boolean |
putObjectACL(String bucketName,
String key,
AccessControlList acl)
Update an object's Access Control List settings.
|
void |
setBucketPayer(String bucketName,
Payer payer)
The PUT request operation with a requestPayment URI configures an existing bucket to be
Requester Pays or not.
|
String |
uploadPart(String bucketName,
String key,
int partNumber,
String uploadId,
Payload part)
This operation uploads a part in a multipart upload.
|
@Provides S3Object newS3Object()
@Named(value="GetObject") S3Object getObject(String bucketName, String key, GetOptions... options)
GetOptions
to control delivery of content.
bucketName
- namespace of the object you are retrievingkey
- unique key in the s3Bucket identifying the objectHttpResponseException
- if the conditions requested set were not satisfied by the object on the server.@Named(value="GetObject") ObjectMetadata headObject(String bucketName, String key)
metadata
of
the object associated with the key or null if not available.
The HEAD operation is used to retrieve information about a specific object or object size,
without actually fetching the object itself. This is useful if you're only interested in the
object metadata, and don't want to waste bandwidth on the object data.bucketName
- namespace of the metadata you are retrievingkey
- unique key in the s3Bucket identifying the object@Named(value="DeleteObject") void deleteObject(String bucketName, String key)
bucketName
- namespace of the object you are deletingkey
- unique key in the s3Bucket identifying the objectHttpResponseException
- if the bucket is not available@Named(value="DeleteObject") DeleteResult deleteObjects(String bucketName, Iterable<String> keys)
bucketName
- namespace of the objects you are deletingkeys
- set of unique keys identifying objects@Named(value="PutObject") String putObject(String bucketName, S3Object object, PutObjectOptions... options)
private
This returns a byte[] of the eTag hash of what Amazon S3 received
bucketName
- namespace of the object you are storingobject
- contains the data and metadata to create or overwriteoptions
- options for creating the objectHttpResponseException
- if the conditions requested set are not satisfied by the object on the server.CannedAccessPolicy.PRIVATE
@Named(value="CreateBucket") boolean putBucketInRegion(@Nullable String region, String bucketName, PutBucketOptions... options)
PutBucketOptions
to create the bucket in EU.
The PUT request operation with a bucket URI creates a new bucket. Depending on your latency
and legal requirements, you can specify a location constraint that will affect where your data
physically resides. You can currently specify a Europe (EU) location constraint via
PutBucketOptions
.options
- for creating your bucketPutBucketOptions
@Named(value="DeleteBucket") boolean deleteBucketIfEmpty(String bucketName)
bucketName
- what to delete@Named(value="BucketExists") boolean bucketExists(String bucketName)
@Named(value="ListBucket") ListBucketResponse listBucket(String bucketName, ListBucketOptions... options)
S3Bucket
listing. A GET request operation using a bucket URI lists
information about the objects in the bucket. You can use ListBucketOptions
to control
the amount of S3Objects to return.
To list the keys of a bucket, you must have READ access to the bucket.
bucketName
- namespace of the objects you wish to listListBucketOptions
@Named(value="ListAllMyBuckets") Set<BucketMetadata> listOwnedBuckets()
@Named(value="PutObject") ObjectMetadata copyObject(String sourceBucket, String sourceObject, String destinationBucket, String destinationObject, CopyObjectOptions... options)
CopyObjectOptions.overrideMetadataWith(java.util.Map)
specify new
metadata}. However, the ACL is not preserved and is set to private for the user making the
request. To override the default ACL setting,
specify a
new ACL
when generating a copy request.HttpResponseException
- if the conditions requested set are not satisfied by the object on the server.CopyObjectOptions
,
CannedAccessPolicy
@Named(value="GetBucketAcl") AccessControlList getBucketACL(String bucketName)
@Named(value="PutBucketAcl") boolean putBucketACL(String bucketName, AccessControlList acl)
bucketName
- the bucket whose Access Control List settings will be updated.acl
- the ACL to apply to the bucket. This acl object mustAccessControlList.getOwner()
.@Named(value="GetObjectAcl") AccessControlList getObjectACL(String bucketName, String key)
@Named(value="PutObjectAcl") boolean putObjectACL(String bucketName, String key, AccessControlList acl)
bucketName
- the bucket containing the object to be updatedkey
- the key of the object whose Access Control List settings will be updated.acl
- the ACL to apply to the object. This acl object mustAccessControlList.getOwner()
.@Named(value="GetBucketLocation") String getBucketLocation(String bucketName)
bucketName
- the bucket you wish to know where exists@Named(value="GetBucketRequestPayment") Payer getBucketPayer(String bucketName)
bucketName
- the bucket you wish to know the payer statusPayer.REQUESTER
for a Requester Pays bucket, and Payer.BUCKET_OWNER
,
for a normal bucket.@Named(value="PutBucketRequestPayment") void setBucketPayer(String bucketName, Payer payer)
bucketName
- the bucket you wish to know the payer statuspayer
- Payer.REQUESTER
for a Requester Pays bucket, and Payer.BUCKET_OWNER
,
for a normal bucket.@Named(value="GetBucketLogging") BucketLogging getBucketLogging(String bucketName)
bucketName
- the bucket you wish to know the logging status@Named(value="PutBucketLogging") void enableBucketLogging(String bucketName, BucketLogging logging)
bucketName
- the bucket you wish to enable logging forlogging
- configuration including destination, prefix, and access rules@Named(value="PutBucketLogging") void disableBucketLogging(String bucketName)
bucketName
- the bucket you wish to disable logging for@Named(value="PutObject") String initiateMultipartUpload(String bucketName, ObjectMetadata objectMetadata, PutObjectOptions... options)
bucketName
- namespace of the object you are to uploadobjectMetadata
- metadata around the object you wish to uploadoptions
- controls optional parameters such as canned ACL@Named(value="AbortMultipartUpload") void abortMultipartUpload(String bucketName, String key, String uploadId)
bucketName
- namespace of the object you are deletingkey
- unique key in the s3Bucket identifying the objectuploadId
- id of the multipart upload in progress.@Named(value="PutObject") String uploadPart(String bucketName, String key, int partNumber, String uploadId, Payload part)
bucketName
- namespace of the object you are storingkey
- unique key in the s3Bucket identifying the objectpartNumber
- which part is this.uploadId
- id of the multipart upload in progress.part
- contains the data to create or overwrite@Named(value="PutObject") String completeMultipartUpload(String bucketName, String key, String uploadId, Map<Integer,String> parts)
bucketName
- namespace of the object you are deletingkey
- unique key in the s3Bucket identifying the objectuploadId
- id of the multipart upload in progress.parts
- a map of part id to eTag from the uploadPart(java.lang.String, java.lang.String, int, java.lang.String, org.jclouds.io.Payload)
command.Copyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.