public class S3JerseyClient extends AbstractJerseyClient implements S3Client
This implementation uses the JAX-RS reference implementation (Jersey) as it's REST client. When sending or receiving data, the following content handlers are supported by default. Be sure to use the appropriate content-type associated with each object type or the handlers will not understand the request.
Object Type (class) | Expected Content-Type(s) |
---|---|
byte[] | *any* |
java.lang.String | *any* |
java.io.File (send-only) | *any* |
java.io.InputStream (send-only) | *any* |
any annotated JAXB root element bean | text/xml, application/xml |
Also keep in mind that you can always send/receive byte[] and do your own conversion.
To use, simply pass a new S3Config
object to the constructor like so:
// for client-side load balancing and direct connection to all nodes // single-VDC (client will auto-discover the remaining nodes): S3Config config1 = new S3Config(Protocol.HTTP, "10.10.10.11", "10.10.10.12"); // multiple VDCs (client will auto-discover remaining nodes in specified VDCs): Vdc boston = new Vdc("10.10.10.11", "10.10.10.12").withName("Boston"); Vdc seattle = new Vdc("10.20.20.11", "10.20.20.12").withName("Seattle"); S3Config config2 = new S3Config(Protocol.HTTPS, boston, seattle); // to use a load balancer will full wildcard DNS setup S3Config config3 = new S3Config(new URI("https://s3.company.com")).withUseVHost(true); // in all cases, you need to provide your credentials configX.withIdentity("my_full_token_id").withSecretKey("my_secret_key"); S3Client s3Client = new S3JerseyClient(configX);
To create an object, simply pass the object in to one of the putObject methods. The object type must be one of the supported types above.
String stringContent = "Hello World!"; s3Client.putObject("my-bucket", "my-key", stringContent, "text/plain"); File fileContent = new File( "spreadsheet.xls" ); s3Client.putObject("my-bucket", "my-data", fileContent, "application/vnd.ms-excel"); byte[] binaryContent; ... // load binary content to store as an object s3Client.putObject("my-bucket", "my-bits", binaryContent, null ); // default content-type is application/octet-stream
To read an object, specify the type of object you want to receive from a readObject method. The same rules apply to this type.
String stringContent = s3Client.readObject("my-bucket", "my-key", String.class); byte[] fileContent = s3Client.readObject("my-bucket", "my-data", byte[].class); // do something with file content (stream to client? save in local filesystem?) byte[] binaryContent = s3Client.readObject("my-bucket", "my-bits", byte[].class);
Performance
If you are experiencing performance issues, you might try tuning Jersey's IO buffer size, which defaults to 8k.
System.setProperty(ReaderWriter.BUFFER_SIZE_SYSTEM_PROPERTY, "" + 128 * 1024); // 128kYou can also try using Jersey's URLConnectionClientHandler, but be aware that this handler does not support
Expect: 100-Continue
behavior if that is important to you. You should also increase
http.maxConnections
to match your thread count.
System.setProperty("http.maxConnections", "" + 32); // if you have 32 threads S3Client s3Client = new S3JerseyClient(configX, new URLConnectionClientHandler());
Modifier and Type | Field and Description |
---|---|
protected com.sun.jersey.api.client.Client |
client |
protected com.emc.rest.smart.LoadBalancer |
loadBalancer |
protected S3Config |
s3Config |
protected S3Signer |
signer |
objectConfig
Constructor and Description |
---|
S3JerseyClient(S3Config s3Config) |
S3JerseyClient(S3Config config,
com.sun.jersey.api.client.ClientHandler clientHandler)
Provide a specific Jersey ClientHandler implementation (default is ApacheHttpClient4Handler).
|
Modifier and Type | Method and Description |
---|---|
void |
abortMultipartUpload(AbortMultipartUploadRequest request) |
long |
appendObject(java.lang.String bucketName,
java.lang.String key,
java.lang.Object content)
Atomically appends to the end of object
key in bucket bucketName with
content and returns the starting offset of the append operation |
boolean |
bucketExists(java.lang.String bucketName)
Returns whether
bucketName exists in the user's namespace (or the configured namespace of the
client). |
CompleteMultipartUploadResult |
completeMultipartUpload(CompleteMultipartUploadRequest request) |
CopyObjectResult |
copyObject(CopyObjectRequest request)
Remotely copies an object using the parameters specified in
request |
CopyObjectResult |
copyObject(java.lang.String sourceBucketName,
java.lang.String sourceKey,
java.lang.String bucketName,
java.lang.String key)
Remotely copies object
sourceKey in bucket sourceBucketName to key in
bucketName |
CopyPartResult |
copyPart(CopyPartRequest request) |
CopyRangeResult |
copyRange(CopyRangeRequest request)
This API is an ECS extension API.
|
void |
createBucket(CreateBucketRequest request)
Creates a bucket using the parameters specified in
request |
void |
createBucket(java.lang.String bucketName)
Creates a bucket with the specified name in the default namespace and with the default replication group
|
void |
deleteBucket(DeleteBucketRequest request)
Deletes
bucketName . |
void |
deleteBucket(java.lang.String bucketName)
Deletes
bucketName . |
void |
deleteBucketCors(java.lang.String bucketName)
Removes the CORS configuration for
bucketName |
void |
deleteBucketLifecycle(java.lang.String bucketName)
Deletes the lifecycle configuration for
bucketName |
void |
deleteBucketPolicy(java.lang.String bucketName)
Deletes the bucket policy for
bucketName |
void |
deleteObject(DeleteObjectRequest request)
Deletes object using the parameters specified in
request |
void |
deleteObject(java.lang.String bucketName,
java.lang.String key)
Deletes object
key from bucket bucketName |
DeleteObjectsResult |
deleteObjects(DeleteObjectsRequest request)
Deletes objects using the parameters specified in
request |
void |
deleteObjectTagging(DeleteObjectTaggingRequest request) |
void |
deleteVersion(java.lang.String bucketName,
java.lang.String key,
java.lang.String versionId)
Delets version
versionId of object key in bucket bucketName . |
void |
destroy()
Destroy the client.
|
void |
enableObjectLock(java.lang.String bucketName)
Enable Object Lock for bucket
bucketName . |
protected <T> T |
executeRequest(com.sun.jersey.api.client.Client client,
ObjectRequest request,
java.lang.Class<T> responseType) |
void |
extendRetentionPeriod(java.lang.String bucketName,
java.lang.String key,
java.lang.Long period)
Extend retention
period (seconds) on object key in bucket bucketName . |
protected void |
finalize() |
AccessControlList |
getBucketAcl(java.lang.String bucketName)
Retrieves the ACL of
bucketName |
CorsConfiguration |
getBucketCors(java.lang.String bucketName)
Retrieves the CORS configuration for
bucketName . |
BucketDeletionStatus |
getBucketDeletionStatus(java.lang.String bucketName)
Gets status of background bucket cleanup tasks for
bucketName if present |
BucketInfo |
getBucketInfo(java.lang.String bucketName)
Gets information about a bucket
|
LifecycleConfiguration |
getBucketLifecycle(java.lang.String bucketName)
Retrieves the lifecycle configuration for
bucketName . |
LocationConstraint |
getBucketLocation(java.lang.String bucketName)
Gets the location of
bucketName . |
BucketPolicy |
getBucketPolicy(java.lang.String bucketName)
Gets the bucket policy for
bucketName |
VersioningConfiguration |
getBucketVersioning(java.lang.String bucketName)
Retrieves the versioning status of
bucketName (none, enabled or suspended) |
com.emc.rest.smart.LoadBalancer |
getLoadBalancer() |
<T> GetObjectResult<T> |
getObject(GetObjectRequest request,
java.lang.Class<T> objectType)
Gets an object using the parameters specified in
request . |
GetObjectResult<java.io.InputStream> |
getObject(java.lang.String bucketName,
java.lang.String key)
Gets object
key in bucket bucketName . |
AccessControlList |
getObjectAcl(GetObjectAclRequest request) |
AccessControlList |
getObjectAcl(java.lang.String bucketName,
java.lang.String key) |
ObjectLockLegalHold |
getObjectLegalHold(GetObjectLegalHoldRequest request)
Get Object Legal Hold configuration using parameters in
request . |
ObjectLockConfiguration |
getObjectLockConfiguration(java.lang.String bucketName)
Get the Object Lock configuration for bucket
bucketName . |
S3ObjectMetadata |
getObjectMetadata(GetObjectMetadataRequest request)
Gets metadata using the parameters specified in
request |
S3ObjectMetadata |
getObjectMetadata(java.lang.String bucketName,
java.lang.String key)
Gets metadata for object
key in bucket bucketName |
ObjectLockRetention |
getObjectRetention(GetObjectRetentionRequest request)
Get Object Lock Retention using parameters in
request . |
ObjectTagging |
getObjectTagging(GetObjectTaggingRequest request) |
java.net.URL |
getPresignedUrl(PresignedUrlRequest request)
Generates a pre-signed URL using the parameters specified in
request |
java.net.URL |
getPresignedUrl(java.lang.String bucketName,
java.lang.String key,
java.util.Date expirationTime)
Generates a pre-signed URL to read object
key in bucket bucketName . |
S3Config |
getS3Config() |
InitiateMultipartUploadResult |
initiateMultipartUpload(InitiateMultipartUploadRequest request) |
java.lang.String |
initiateMultipartUpload(java.lang.String bucketName,
java.lang.String key) |
MetadataSearchList |
listBucketMetadataSearchKeys(java.lang.String bucketName)
Lists the metadata search keys associated with the givne bucket.
|
ListBucketsResult |
listBuckets()
Lists the buckets owned by the user
|
ListBucketsResult |
listBuckets(ListBucketsRequest request)
List the buckets owned by the user using the parameters specified in
request |
ListDataNode |
listDataNodes()
Lists all of the data nodes in the current VDC
|
ListObjectsResult |
listMoreObjects(ListObjectsResult lastResult)
Gets the next page of objects using the results of a previous list-objects call
|
ListVersionsResult |
listMoreVersions(ListVersionsResult lastResult)
Gets the next page of object versions using the results of a previous list-versions call
|
ListMultipartUploadsResult |
listMultipartUploads(ListMultipartUploadsRequest request) |
ListMultipartUploadsResult |
listMultipartUploads(java.lang.String bucketName) |
ListObjectsResult |
listObjects(ListObjectsRequest request)
Lists objects in a bucket using parameters specified in
request |
ListObjectsResult |
listObjects(java.lang.String bucketName)
Lists all objects in
bucketName with no restrictions |
ListObjectsResult |
listObjects(java.lang.String bucketName,
java.lang.String prefix)
Lists objects in
bucketName that start with prefix |
ListPartsResult |
listParts(ListPartsRequest request) |
ListPartsResult |
listParts(java.lang.String bucketName,
java.lang.String key,
java.lang.String uploadId) |
MetadataSearchList |
listSystemMetadataSearchKeys()
Lists the system metadata search keys.
|
ListVersionsResult |
listVersions(ListVersionsRequest request)
Lists all versions of all objects in a bucket using the parameters specified in
request |
ListVersionsResult |
listVersions(java.lang.String bucketName,
java.lang.String prefix)
Lists all versions of all objects in
bucketName that start with prefix |
PingResponse |
pingNode(Protocol protocol,
java.lang.String host,
int port)
Issues an unauthenticated ping request to the given host using the given protocol and port.
|
PingResponse |
pingNode(java.lang.String host)
Issues an unauthenticated ping request to the specified host.
|
PutObjectResult |
putObject(PutObjectRequest request)
Creates or updates an object using the parameters specified in
request |
void |
putObject(java.lang.String bucketName,
java.lang.String key,
java.lang.Object content,
java.lang.String contentType)
Creates or overwrites an object in
bucketName named key containing content
and having contentType |
void |
putObject(java.lang.String bucketName,
java.lang.String key,
Range range,
java.lang.Object content)
Updates object
key in bucket bucketName at the specified byte range with
new content |
void |
putObjectTagging(PutObjectTaggingRequest request) |
QueryObjectsResult |
queryMoreObjects(QueryObjectsResult lastResult)
Gets the next page of objects using the results of a previous query-objects call
|
QueryObjectsResult |
queryObjects(QueryObjectsRequest request)
Queries objects in a bucket using parameters specified in
request |
<T> T |
readObject(java.lang.String bucketName,
java.lang.String key,
java.lang.Class<T> objectType)
Reads object
key in bucket bucketName and converts it to objectType ,
provided the conversion is supported by the implementation. |
<T> T |
readObject(java.lang.String bucketName,
java.lang.String key,
java.lang.String versionId,
java.lang.Class<T> objectType)
Reads version
versionId of object key in bucket bucketName and converts
it to objectType , provided the conversion is supported by the implementation. |
java.io.InputStream |
readObjectStream(java.lang.String bucketName,
java.lang.String key,
Range range)
Reads
range bytes of object key in bucket bucketName as a stream. |
void |
setBucketAcl(SetBucketAclRequest request)
Sets the ACL of a bucket using parameters in
request |
void |
setBucketAcl(java.lang.String bucketName,
AccessControlList acl)
Sets the specified ACL on
bucketName |
void |
setBucketAcl(java.lang.String bucketName,
CannedAcl cannedAcl)
Sets the specified canned ACL on
bucketName |
void |
setBucketCors(java.lang.String bucketName,
CorsConfiguration corsConfiguration)
Sets the CORS configuration for
bucketName |
void |
setBucketLifecycle(java.lang.String bucketName,
LifecycleConfiguration lifecycleConfiguration)
Sets the lifecycle configuration for
bucketName |
void |
setBucketPolicy(java.lang.String bucketName,
BucketPolicy policy)
Sets the bucket policy for
bucketName |
void |
setBucketStaleReadAllowed(java.lang.String bucketName,
boolean staleReadAllowed)
Sets whether stale reads are allowed on
bucketName . |
void |
setBucketVersioning(java.lang.String bucketName,
VersioningConfiguration versioningConfiguration)
Enables or suspends versioning on
bucketName |
void |
setObjectAcl(SetObjectAclRequest request) |
void |
setObjectAcl(java.lang.String bucketName,
java.lang.String key,
AccessControlList acl) |
void |
setObjectAcl(java.lang.String bucketName,
java.lang.String key,
CannedAcl cannedAcl) |
void |
setObjectLegalHold(SetObjectLegalHoldRequest request)
Set Object Legal Hold configuration using parameters in
request . |
void |
setObjectLockConfiguration(java.lang.String bucketName,
ObjectLockConfiguration objectLockConfiguration)
Set Object Lock Configuration for bucket
bucketName using parameters in objectLockConfiguration . |
void |
setObjectMetadata(java.lang.String bucketName,
java.lang.String key,
S3ObjectMetadata objectMetadata)
Sets metadata on object
key in bucket bucketName |
void |
setObjectRetention(SetObjectRetentionRequest request)
Set Object Lock Retention using parameters in
request . |
void |
shutdown()
Deprecated.
(2.0.3) use destroy() instead
|
MultipartPartETag |
uploadPart(UploadPartRequest request) |
buildRequest, executeAndClose, executeRequest, fillResponseEntity, getObjectConfig
protected S3Config s3Config
protected com.sun.jersey.api.client.Client client
protected com.emc.rest.smart.LoadBalancer loadBalancer
protected S3Signer signer
public S3JerseyClient(S3Config s3Config)
public S3JerseyClient(S3Config config, com.sun.jersey.api.client.ClientHandler clientHandler)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void shutdown()
public void destroy()
This method must be called when there are not responses pending otherwise undefined behavior will occur.
The client must not be reused after this method is called otherwise undefined behavior will occur.
public com.emc.rest.smart.LoadBalancer getLoadBalancer()
public ListDataNode listDataNodes()
S3Client
listDataNodes
in interface S3Client
public PingResponse pingNode(java.lang.String host)
S3Client
public PingResponse pingNode(Protocol protocol, java.lang.String host, int port)
S3Client
public ListBucketsResult listBuckets()
S3Client
listBuckets
in interface S3Client
public ListBucketsResult listBuckets(ListBucketsRequest request)
S3Client
request
listBuckets
in interface S3Client
public boolean bucketExists(java.lang.String bucketName)
S3Client
bucketName
exists in the user's namespace (or the configured namespace of the
client). This call will return true if the bucket exists even if the user does not have access to the bucket. If
this call returns false, a subsequent call to createBucket with the same name should succeedbucketExists
in interface S3Client
public void createBucket(java.lang.String bucketName)
S3Client
createBucket
in interface S3Client
public void createBucket(CreateBucketRequest request)
S3Client
request
createBucket
in interface S3Client
CreateBucketRequest
public BucketInfo getBucketInfo(java.lang.String bucketName)
S3Client
getBucketInfo
in interface S3Client
public void deleteBucket(java.lang.String bucketName)
S3Client
bucketName
. The bucket must be empty of all objects and versions before it can be deleteddeleteBucket
in interface S3Client
public void deleteBucket(DeleteBucketRequest request)
S3Client
bucketName
. The bucket could contain objects and versions before it can be deleteddeleteBucket
in interface S3Client
public BucketDeletionStatus getBucketDeletionStatus(java.lang.String bucketName)
S3Client
bucketName
if presentgetBucketDeletionStatus
in interface S3Client
public void setBucketAcl(java.lang.String bucketName, AccessControlList acl)
S3Client
bucketName
setBucketAcl
in interface S3Client
AccessControlList
public void setBucketAcl(java.lang.String bucketName, CannedAcl cannedAcl)
S3Client
bucketName
setBucketAcl
in interface S3Client
CannedAcl
public void setBucketAcl(SetBucketAclRequest request)
S3Client
request
setBucketAcl
in interface S3Client
SetBucketAclRequest
public AccessControlList getBucketAcl(java.lang.String bucketName)
S3Client
bucketName
getBucketAcl
in interface S3Client
AccessControlList
public void setBucketCors(java.lang.String bucketName, CorsConfiguration corsConfiguration)
S3Client
bucketName
setBucketCors
in interface S3Client
CorsConfiguration
public CorsConfiguration getBucketCors(java.lang.String bucketName)
S3Client
bucketName
. If no CORS configuration exists for the specified
bucket, null
is returnedgetBucketCors
in interface S3Client
CorsConfiguration
public void deleteBucketCors(java.lang.String bucketName)
S3Client
bucketName
deleteBucketCors
in interface S3Client
public void setBucketLifecycle(java.lang.String bucketName, LifecycleConfiguration lifecycleConfiguration)
S3Client
bucketName
setBucketLifecycle
in interface S3Client
LifecycleConfiguration
public LifecycleConfiguration getBucketLifecycle(java.lang.String bucketName)
S3Client
bucketName
. If no lifecycle exists for the specified
bucket, null
is returnedgetBucketLifecycle
in interface S3Client
LifecycleConfiguration
public void deleteBucketLifecycle(java.lang.String bucketName)
S3Client
bucketName
deleteBucketLifecycle
in interface S3Client
public void setBucketPolicy(java.lang.String bucketName, BucketPolicy policy)
S3Client
bucketName
setBucketPolicy
in interface S3Client
BucketPolicy
public BucketPolicy getBucketPolicy(java.lang.String bucketName)
S3Client
bucketName
getBucketPolicy
in interface S3Client
BucketPolicy
public void deleteBucketPolicy(java.lang.String bucketName)
S3Client
bucketName
deleteBucketPolicy
in interface S3Client
BucketPolicy
public LocationConstraint getBucketLocation(java.lang.String bucketName)
S3Client
bucketName
. This call will return the name of the primary VDC of the bucketgetBucketLocation
in interface S3Client
public void setBucketVersioning(java.lang.String bucketName, VersioningConfiguration versioningConfiguration)
S3Client
bucketName
setBucketVersioning
in interface S3Client
public VersioningConfiguration getBucketVersioning(java.lang.String bucketName)
S3Client
bucketName
(none, enabled or suspended)getBucketVersioning
in interface S3Client
public void setBucketStaleReadAllowed(java.lang.String bucketName, boolean staleReadAllowed)
S3Client
bucketName
. If true, during a temporary site outage (TSO),
objects in the bucket may still be read from secondary sites, but these reads are not guaranteed to be strongly
consistent (they may be stale if the primary site is inaccessible). Note that stale reads are not
supported on filesystem
buckets.setBucketStaleReadAllowed
in interface S3Client
public MetadataSearchList listSystemMetadataSearchKeys()
S3Client
listSystemMetadataSearchKeys
in interface S3Client
public MetadataSearchList listBucketMetadataSearchKeys(java.lang.String bucketName)
S3Client
listBucketMetadataSearchKeys
in interface S3Client
public QueryObjectsResult queryObjects(QueryObjectsRequest request)
S3Client
request
queryObjects
in interface S3Client
public QueryObjectsResult queryMoreObjects(QueryObjectsResult lastResult)
S3Client
queryMoreObjects
in interface S3Client
public ListObjectsResult listObjects(java.lang.String bucketName)
S3Client
bucketName
with no restrictionslistObjects
in interface S3Client
public ListObjectsResult listObjects(java.lang.String bucketName, java.lang.String prefix)
S3Client
bucketName
that start with prefix
listObjects
in interface S3Client
public ListObjectsResult listObjects(ListObjectsRequest request)
S3Client
request
listObjects
in interface S3Client
public ListObjectsResult listMoreObjects(ListObjectsResult lastResult)
S3Client
listMoreObjects
in interface S3Client
public ListVersionsResult listVersions(java.lang.String bucketName, java.lang.String prefix)
S3Client
bucketName
that start with prefix
listVersions
in interface S3Client
public ListVersionsResult listVersions(ListVersionsRequest request)
S3Client
request
listVersions
in interface S3Client
public ListVersionsResult listMoreVersions(ListVersionsResult lastResult)
S3Client
listMoreVersions
in interface S3Client
public void putObject(java.lang.String bucketName, java.lang.String key, java.lang.Object content, java.lang.String contentType)
S3Client
bucketName
named key
containing content
and having contentType
public void putObject(java.lang.String bucketName, java.lang.String key, Range range, java.lang.Object content)
S3Client
key
in bucket bucketName
at the specified byte range
with
new content
public PutObjectResult putObject(PutObjectRequest request)
S3Client
request
public long appendObject(java.lang.String bucketName, java.lang.String key, java.lang.Object content)
S3Client
key
in bucket bucketName
with
content
and returns the starting offset of the append operationappendObject
in interface S3Client
public CopyObjectResult copyObject(java.lang.String sourceBucketName, java.lang.String sourceKey, java.lang.String bucketName, java.lang.String key)
S3Client
sourceKey
in bucket sourceBucketName
to key
in
bucketName
copyObject
in interface S3Client
public CopyObjectResult copyObject(CopyObjectRequest request)
S3Client
request
copyObject
in interface S3Client
public <T> T readObject(java.lang.String bucketName, java.lang.String key, java.lang.Class<T> objectType)
S3Client
key
in bucket bucketName
and converts it to objectType
,
provided the conversion is supported by the implementation.
Note: this method will return null
for 304 and 412 responses (failed preconditions).
readObject
in interface S3Client
public <T> T readObject(java.lang.String bucketName, java.lang.String key, java.lang.String versionId, java.lang.Class<T> objectType)
S3Client
versionId
of object key
in bucket bucketName
and converts
it to objectType
, provided the conversion is supported by the implementation.
Note: this method will return null
for 304 and 412 responses (failed preconditions).
readObject
in interface S3Client
public java.io.InputStream readObjectStream(java.lang.String bucketName, java.lang.String key, Range range)
S3Client
range
bytes of object key
in bucket bucketName
as a stream.
Note: this method will return null
for 304 and 412 responses (failed preconditions).
readObjectStream
in interface S3Client
public GetObjectResult<java.io.InputStream> getObject(java.lang.String bucketName, java.lang.String key)
S3Client
key
in bucket bucketName
. Object details as well as the data stream
(obtained from GetObjectResult.getObject()
are contained in the GetObjectResult
instance.
Note: this method will return null
for 304 and 412 responses (failed preconditions).
This method will open a stream for the object data. Be sure to call getObject()
and,
if requesting an InputStream
, properly close the stream to release the connection.
public <T> GetObjectResult<T> getObject(GetObjectRequest request, java.lang.Class<T> objectType)
S3Client
request
. Object details as well as the translated
data (converted to objectType
) are contained in the GetObjectResult
instance.
Note: this method will return null
for 304 and 412 responses (failed preconditions).
This method will open a stream for the object data. Be sure to call getObject()
and,
if requesting an InputStream
, properly close the stream to release the connection.
public java.net.URL getPresignedUrl(java.lang.String bucketName, java.lang.String key, java.util.Date expirationTime)
S3Client
key
in bucket bucketName
. The URL will be
valid until expirationTime
getPresignedUrl
in interface S3Client
public java.net.URL getPresignedUrl(PresignedUrlRequest request)
S3Client
request
getPresignedUrl
in interface S3Client
public void deleteObject(java.lang.String bucketName, java.lang.String key)
S3Client
key
from bucket bucketName
deleteObject
in interface S3Client
public void deleteObject(DeleteObjectRequest request)
S3Client
request
deleteObject
in interface S3Client
public void deleteVersion(java.lang.String bucketName, java.lang.String key, java.lang.String versionId)
S3Client
versionId
of object key
in bucket bucketName
.
Note: versioning must be enabled in the bucket.
deleteVersion
in interface S3Client
public DeleteObjectsResult deleteObjects(DeleteObjectsRequest request)
S3Client
request
deleteObjects
in interface S3Client
public void setObjectMetadata(java.lang.String bucketName, java.lang.String key, S3ObjectMetadata objectMetadata)
S3Client
key
in bucket bucketName
setObjectMetadata
in interface S3Client
public S3ObjectMetadata getObjectMetadata(java.lang.String bucketName, java.lang.String key)
S3Client
key
in bucket bucketName
getObjectMetadata
in interface S3Client
public S3ObjectMetadata getObjectMetadata(GetObjectMetadataRequest request)
S3Client
request
getObjectMetadata
in interface S3Client
public void setObjectAcl(java.lang.String bucketName, java.lang.String key, AccessControlList acl)
setObjectAcl
in interface S3Client
public void setObjectAcl(java.lang.String bucketName, java.lang.String key, CannedAcl cannedAcl)
setObjectAcl
in interface S3Client
public void setObjectAcl(SetObjectAclRequest request)
setObjectAcl
in interface S3Client
public AccessControlList getObjectAcl(java.lang.String bucketName, java.lang.String key)
getObjectAcl
in interface S3Client
public AccessControlList getObjectAcl(GetObjectAclRequest request)
getObjectAcl
in interface S3Client
public void extendRetentionPeriod(java.lang.String bucketName, java.lang.String key, java.lang.Long period)
S3Client
period
(seconds) on object key
in bucket bucketName
.
Note: New retention period value can only be increased. That is, it can be the same as the current or greater value.
If the new retention period value is -1, infinite retention applies on that object.extendRetentionPeriod
in interface S3Client
public ListMultipartUploadsResult listMultipartUploads(java.lang.String bucketName)
listMultipartUploads
in interface S3Client
public ListMultipartUploadsResult listMultipartUploads(ListMultipartUploadsRequest request)
listMultipartUploads
in interface S3Client
public java.lang.String initiateMultipartUpload(java.lang.String bucketName, java.lang.String key)
initiateMultipartUpload
in interface S3Client
public InitiateMultipartUploadResult initiateMultipartUpload(InitiateMultipartUploadRequest request)
initiateMultipartUpload
in interface S3Client
public ListPartsResult listParts(java.lang.String bucketName, java.lang.String key, java.lang.String uploadId)
public ListPartsResult listParts(ListPartsRequest request)
public MultipartPartETag uploadPart(UploadPartRequest request)
uploadPart
in interface S3Client
public CopyPartResult copyPart(CopyPartRequest request)
public CompleteMultipartUploadResult completeMultipartUpload(CompleteMultipartUploadRequest request)
completeMultipartUpload
in interface S3Client
public void abortMultipartUpload(AbortMultipartUploadRequest request)
abortMultipartUpload
in interface S3Client
public void setObjectLockConfiguration(java.lang.String bucketName, ObjectLockConfiguration objectLockConfiguration)
S3Client
bucketName
using parameters in objectLockConfiguration
.setObjectLockConfiguration
in interface S3Client
public ObjectLockConfiguration getObjectLockConfiguration(java.lang.String bucketName)
S3Client
bucketName
.
If Object Lock Configuration is not set, null
is returned.getObjectLockConfiguration
in interface S3Client
public void enableObjectLock(java.lang.String bucketName)
S3Client
bucketName
.enableObjectLock
in interface S3Client
public void setObjectLegalHold(SetObjectLegalHoldRequest request)
S3Client
request
.setObjectLegalHold
in interface S3Client
public ObjectLockLegalHold getObjectLegalHold(GetObjectLegalHoldRequest request)
S3Client
request
.getObjectLegalHold
in interface S3Client
public void setObjectRetention(SetObjectRetentionRequest request)
S3Client
request
.setObjectRetention
in interface S3Client
public ObjectLockRetention getObjectRetention(GetObjectRetentionRequest request)
S3Client
request
.getObjectRetention
in interface S3Client
public CopyRangeResult copyRange(CopyRangeRequest request)
S3Client
public ObjectTagging getObjectTagging(GetObjectTaggingRequest request)
getObjectTagging
in interface S3Client
public void putObjectTagging(PutObjectTaggingRequest request)
putObjectTagging
in interface S3Client
public void deleteObjectTagging(DeleteObjectTaggingRequest request)
deleteObjectTagging
in interface S3Client
protected <T> T executeRequest(com.sun.jersey.api.client.Client client, ObjectRequest request, java.lang.Class<T> responseType)
executeRequest
in class AbstractJerseyClient
public S3Config getS3Config()