|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface S3Client
Provides access to S3 via their REST API.
All commands return a Future of the result from S3. Any exceptions incurred during
processing will be wrapped in an ExecutionException
as documented in
Future.get()
.
Method Summary | |
---|---|
boolean |
bucketExists(String bucketName)
Issues a HEAD command to determine if the bucket exists or not. |
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. |
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
org.jclouds.s3.domain.internal.BucketListObjectMetadata#NOT_FOUND if not
available. |
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. |
Method Detail |
---|
@Provides S3Object newS3Object()
S3Object getObject(String bucketName, String key, GetOptions... options)
To use GET, you must have READ access to the object. If READ access is granted to the anonymous user, you can request the object without an authorization header.
This command allows you to specify GetObjectOptions
to control delivery of content.
GetObjectOptions#range
GetObjectOptions#startAt
GetObjectOptions#tail
S3AsyncClient
interface}.
bucketName
- namespace of the object you are retrievingkey
- unique key in the s3Bucket identifying the object
S3Object#NOT_FOUND
if not present.
HttpResponseException
- if the conditions requested set were not satisfied by the object on the server.#getObject(String, String)
,
GetObjectOptions
ObjectMetadata headObject(String bucketName, String key)
metadata
of
the object associated with the key or
org.jclouds.s3.domain.internal.BucketListObjectMetadata#NOT_FOUND
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
org.jclouds.s3.domain.internal.BucketListObjectMetadata#NOT_FOUND
if not
present;#getObject(String, String)
,
boolean objectExists(String bucketName, String key)
void deleteObject(String bucketName, String key)
The DELETE request operation removes the specified object from Amazon S3. Once deleted, there is no method to restore or undelete an object.
bucketName
- namespace of the object you are deletingkey
- unique key in the s3Bucket identifying the object
HttpResponseException
- if the bucket is not availableString putObject(String bucketName, S3Object object, PutObjectOptions... options)
This method will store the object with the default private
This returns a byte[] of the eTag hash of what Amazon S3 received
S3AsyncClient
interface}.
bucketName
- namespace of the object you are storingobject
- contains the data and metadata to create or overwriteoptions
- options for creating the object
HttpResponseException
- if the conditions requested set are not satisfied by the object on the server.CannedAccessPolicy.PRIVATE
,
boolean putBucketInRegion(@Nullable String region, String bucketName, PutBucketOptions... options)
you can use 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 bucket
PutBucketOptions
,
boolean deleteBucketIfEmpty(String bucketName)
The DELETE request operation deletes the bucket named in the URI. All objects in the bucket must be deleted before the bucket itself can be deleted.
Only the owner of a bucket can delete it, regardless of the bucket's access control policy.
bucketName
- what to delete
org.jclouds.s3.commands.DeleteBucket
,
boolean bucketExists(String bucketName)
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 list
BoundedList#NOT_FOUND
if not present.ListBucketOptions
,
Set<BucketMetadata> listOwnedBuckets()
ObjectMetadata copyObject(String sourceBucket, String sourceObject, String destinationBucket, String destinationObject, CopyObjectOptions... options)
When copying an object, you can preserve all metadata (default) or
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.org.jclouds.s3.commands.CopyObject
,
,
CopyObjectOptions
,
CannedAccessPolicy
AccessControlList getBucketACL(String bucketName)
To list a bucket's ACL, you must have READ_ACP access to the item.
boolean putBucketACL(String bucketName, AccessControlList acl)
A PUT request operation directed at a bucket URI with the "acl" parameter sets the Access Control List (ACL) settings for that S3 item.
To set a bucket or object's ACL, you must have WRITE_ACP or FULL_CONTROL access to the item.
bucketName
- the bucket whose Access Control List settings will be updated.acl
- the ACL to apply to the bucket. This acl object mustAccessControlList.getOwner()
.
AccessControlList getObjectACL(String bucketName, String key)
To list a object's ACL, you must have READ_ACP access to the item.
boolean putObjectACL(String bucketName, String key, AccessControlList acl)
A PUT request operation directed at an object URI with the "acl" parameter sets the Access Control List (ACL) settings for that S3 item.
To set a bucket or object's ACL, you must have WRITE_ACP or FULL_CONTROL access to the item.
bucket
- the bucket containing the object to be updatedobjectKey
- 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()
.
String getBucketLocation(String bucketName)
To view the location constraint of a bucket, you must be the bucket owner.
bucket
- the bucket you wish to know where exists
Payer getBucketPayer(String bucketName)
Only the bucket owner has permissions to get this value.
bucketName
- the bucket you wish to know the payer status
Payer.REQUESTER
for a Requester Pays bucket, and Payer.BUCKET_OWNER
,
for a normal bucket.void setBucketPayer(String bucketName, Payer payer)
Only a bucket owner is allowed to configure a bucket. As a result any requests for this resource should be signed with the bucket owner's credentials. Anonymous requests are never allowed to create Requester Pays buckets.
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.BucketLogging getBucketLogging(String bucketName)
bucketName
- the bucket you wish to know the logging status
void enableBucketLogging(String bucketName, BucketLogging logging)
bucketName
- the bucket you wish to enable logging forlogging
- configuration including destination, prefix, and access rulesvoid disableBucketLogging(String bucketName)
bucketName
- the bucket you wish to disable logging for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |