public class CopyObjectOptions extends BaseHttpRequestOptions
import static org.jclouds.s3.commands.options.CopyObjectOptions.Builder.*
S3Client connection = // get connection
Multimap metadata = LinkedHashMultimap.create();
metadata.put("x-amz-meta-adrian", "foo");
// this will copy the object, provided it wasn't modified since yesterday.
// it will not use metadata from the source, and instead use what we pass in.
Future object = connection.copyObject("sourceBucket", "objectName",
"destinationBucket", "destinationName",
overrideMetadataWith(meta).
ifSourceModifiedSince(new Date().minusDays(1))
);
Modifier and Type | Class and Description |
---|---|
static class |
CopyObjectOptions.Builder |
Modifier and Type | Field and Description |
---|---|
static CopyObjectOptions |
NONE |
formParameters, headers, pathSuffix, payload, queryParameters
Constructor and Description |
---|
CopyObjectOptions() |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.Multimap<String,String> |
buildRequestHeaders()
Builds headers representing options.
|
CannedAccessPolicy |
getAcl() |
String |
getIfMatch()
For use in the request header: x-amz-copy-source-if-match
Copies the object if its payload tag (ETag) matches the specified tag; otherwise return a 412
(precondition failed).
|
String |
getIfModifiedSince()
For use in the header x-amz-copy-source-if-unmodified-since
Copies the object if it hasn't been modified since the specified time; otherwise returns a 412
(precondition failed).
|
String |
getIfNoneMatch()
For use in the request header: x-amz-copy-source-if-none-match
Copies the object if its payload tag (ETag) is different than the specified Etag; otherwise
returns a 412 (failed condition).
|
String |
getIfUnmodifiedSince()
For use in the header x-amz-copy-source-if-modified-since
Copies the object if it has been modified since the specified time; otherwise returns a 412
(failed condition).
|
Map<String,String> |
getMetadata()
When not null, contains the header [x-amz-copy-source-if-unmodified-since] -> [REPLACE] and
metadata headers passed in from the users.
|
CopyObjectOptions |
ifSourceETagDoesntMatch(String eTag)
The object should not have a eTag hash corresponding with the parameter
eTag . |
CopyObjectOptions |
ifSourceETagMatches(String eTag)
The object's eTag hash should match the parameter
eTag . |
CopyObjectOptions |
ifSourceModifiedSince(Date ifModifiedSince)
Only return the object if it has changed since this time.
|
CopyObjectOptions |
ifSourceUnmodifiedSince(Date ifUnmodifiedSince)
Only return the object if it hasn't changed since this time.
|
CopyObjectOptions |
overrideAcl(CannedAccessPolicy acl)
Override the default ACL (private) with the specified one.
|
CopyObjectOptions |
overrideMetadataWith(Map<String,String> metadata)
Use the provided metadata instead of what is on the source object.
|
void |
setHeaderTag(String headerTag) |
void |
setMetadataPrefix(String metadataPrefix) |
buildFormParameters, buildPathSuffix, buildQueryParameters, buildStringPayload, equals, getFirstFormOrNull, getFirstHeaderOrNull, getFirstQueryOrNull, hashCode, replaceHeader, toString
public static final CopyObjectOptions NONE
@Inject public void setMetadataPrefix(@Named(value="jclouds.blobstore.metaprefix") String metadataPrefix)
@Inject public void setHeaderTag(@Named(value="jclouds.aws.header.tag") String headerTag)
public CopyObjectOptions overrideAcl(CannedAccessPolicy acl)
CannedAccessPolicy
public CannedAccessPolicy getAcl()
overrideAcl(CannedAccessPolicy)
public String getIfModifiedSince()
ifSourceModifiedSince(Date)
public String getIfUnmodifiedSince()
ifSourceUnmodifiedSince(Date)
public String getIfMatch()
ifSourceETagMatches(String)
public String getIfNoneMatch()
ifSourceETagDoesntMatch(String)
public Map<String,String> getMetadata()
#overrideMetadataWith(Multimap)
public CopyObjectOptions ifSourceModifiedSince(Date ifModifiedSince)
ifSourceETagMatches(String)
or
ifSourceUnmodifiedSince(Date)
public CopyObjectOptions ifSourceUnmodifiedSince(Date ifUnmodifiedSince)
ifSourceETagDoesntMatch(String)
or
ifSourceModifiedSince(Date)
public CopyObjectOptions ifSourceETagMatches(String eTag)
eTag
.
Not compatible with ifSourceETagDoesntMatch(String)
or
ifSourceModifiedSince(Date)
eTag
- hash representing the payloadpublic CopyObjectOptions ifSourceETagDoesntMatch(String eTag)
eTag
.
Not compatible with ifSourceETagMatches(String)
or
ifSourceUnmodifiedSince(Date)
eTag
- hash representing the payloadpublic com.google.common.collect.Multimap<String,String> buildRequestHeaders()
BaseHttpRequestOptions
buildRequestHeaders
in interface HttpRequestOptions
buildRequestHeaders
in class BaseHttpRequestOptions
public CopyObjectOptions overrideMetadataWith(Map<String,String> metadata)
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.