com.amazonaws.services.s3.model
Class CopyObjectRequest

java.lang.Object
  extended by com.amazonaws.AmazonWebServiceRequest
      extended by com.amazonaws.services.s3.model.CopyObjectRequest

public class CopyObjectRequest
extends AmazonWebServiceRequest

Options for copying an S3 object from a source location to a new destination.

All CopyObjectRequests must specify a source bucket and key and a destination bucket and key. Beyond that, requests can also specify:


Constructor Summary
CopyObjectRequest(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey)
          Constructs a new CopyObjectRequest with only the basic, required options.
CopyObjectRequest(String sourceBucketName, String sourceKey, String sourceVersionId, String destinationBucketName, String destinationKey)
          Constructs a new CopyObjectRequest with the basic options and specifies an S3 version ID which identifies a specific version of the source object to copy.
 
Method Summary
 CannedAccessControlList getCannedAccessControlList()
          Returns the canned ACL to use for the new, copied object.
 String getDestinationBucketName()
          Returns the name of the destination bucket which will contain the new, copied object.
 String getDestinationKey()
          Returns the key in the destination bucket under which the new, copied object will be stored.
 List<String> getMatchingETagConstraints()
          Returns the optional list of ETag constraints that, when present, must include a match for the source object's current ETag in order for the copy object request to be executed.
 Date getModifiedSinceConstraint()
          Returns the optional modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.
 ObjectMetadata getNewObjectMetadata()
          Returns the optional object metadata to set for the new, copied object.
 List<String> getNonmatchingETagConstraints()
          Returns the optional list of ETag constraints that, when present, must not include a match for the source object's current ETag in order for the copy object request to be executed.
 String getSourceBucketName()
          Returns the name of the bucket containing the source object to be copied.
 String getSourceKey()
          Returns the key in the source bucket under which the source object to be copied is stored.
 String getSourceVersionId()
          Returns the optional version ID specifying which version of the source object to copy.
 String getStorageClass()
          Gets the optional Amazon S3 storage class to use when storing the newly copied object.
 Date getUnmodifiedSinceConstraint()
          Returns the optional unmodified since constraint that restricts this request to executing only if the source object has not been modified since the specified date.
 void setCannedAccessControlList(CannedAccessControlList cannedACL)
          Sets the canned ACL to use for the new, copied object.
 void setDestinationBucketName(String destinationBucketName)
          Sets the name of the destination bucket which will contain the new, copied object.
 void setDestinationKey(String destinationKey)
          Sets the key in the destination bucket under which the new, copied object will be stored.
 void setMatchingETagConstraints(List<String> eTagList)
          Sets the optional list of ETag constraints that, when present, must include a match for the source object's current ETag in order for the copy object request to be executed.
 void setModifiedSinceConstraint(Date date)
          Sets the optional modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.
 void setNewObjectMetadata(ObjectMetadata newObjectMetadata)
          Sets the object metadata to use for the new, copied object.
 void setNonmatchingETagConstraints(List<String> eTagList)
          Sets the optional list of ETag constraints that, when present, must not include a match for the source object's current ETag in order for the copy object request to be executed.
 void setSourceBucketName(String sourceBucketName)
          Sets the name of the bucket containing the source object to be copied.
 void setSourceKey(String sourceKey)
          Sets the key in the source bucket under which the source object to be copied is stored.
 void setSourceVersionId(String sourceVersionId)
          Sets the optional version ID specifying which version of the source object to copy.
 void setStorageClass(StorageClass storageClass)
          Sets the optional Amazon S3 storage class to use when storing the newly copied object.
 void setStorageClass(String storageClass)
          Sets the optional Amazon S3 storage class to use when storing the newly copied object.
 void setUnmodifiedSinceConstraint(Date date)
          Sets the optional unmodified since constraint that restricts this request to executing only if the source object has not been modified since the specified date.
 CopyObjectRequest withCannedAccessControlList(CannedAccessControlList cannedACL)
          Sets the canned ACL to use for the new, copied object, and returns this CopyObjectRequest so that additional method calls can be chained together.
 CopyObjectRequest withDestinationBucketName(String destinationBucketName)
          Sets the name of the destination bucket which will contain the new, copied object, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withDestinationKey(String destinationKey)
          Sets the key in the destination bucket under which the new, copied object will be stored, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withMatchingETagConstraint(String eTag)
          Adds an single ETag constraint to this request, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withModifiedSinceConstraint(Date date)
          Sets the optional modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.
 CopyObjectRequest withNewObjectMetadata(ObjectMetadata newObjectMetadata)
          Sets the object metadata to use for the new, copied object, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withNonmatchingETagConstraint(String eTag)
          Adds a single ETag constraint to this request, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withSourceBucketName(String sourceBucketName)
          Sets the name of the bucket containing the source object to be copied, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withSourceKey(String sourceKey)
          Sets the key in the source bucket under which the source object to be copied is stored, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withSourceVersionId(String sourceVersionId)
          Sets the optional version ID specifying which version of the source object to copy, and returns this object so that additional method calls can be chained together.
 CopyObjectRequest withStorageClass(StorageClass storageClass)
          Sets the optional Amazon S3 storage class to use when storing the newly copied object, and returns this CopyObjectRequest so that additional method calls can be chained together.
 CopyObjectRequest withStorageClass(String storageClass)
          Sets the optional Amazon S3 storage class to use when storing the newly copied object, and returns this CopyObjectRequest so that additional method calls can be chained together.
 CopyObjectRequest withUnmodifiedSinceConstraint(Date date)
          Sets the optional unmodified since constraint that restricts this request to executing only if the source object has not been modified since the specified date, and returns this object so that additional method calls can be chained together.
 
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyPrivateRequestParameters
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyObjectRequest

public CopyObjectRequest(String sourceBucketName,
                         String sourceKey,
                         String destinationBucketName,
                         String destinationKey)
Constructs a new CopyObjectRequest with only the basic, required options.

Parameters:
sourceBucketName - The name of the S3 bucket containing the object to copy.
sourceKey - The key in the source bucket under which the object to copy is stored.
destinationBucketName - The name of the S3 bucket in which the new object will be copied.
destinationKey - The key in the destination bucket under which the new object will be copied.

CopyObjectRequest

public CopyObjectRequest(String sourceBucketName,
                         String sourceKey,
                         String sourceVersionId,
                         String destinationBucketName,
                         String destinationKey)
Constructs a new CopyObjectRequest with the basic options and specifies an S3 version ID which identifies a specific version of the source object to copy.

Parameters:
sourceBucketName - The name of the S3 bucket containing the object to copy.
sourceKey - The key in the source bucket under which the object to copy is stored.
sourceVersionId - The S3 version ID which uniquely identifies a specific version of the source object to copy.
destinationBucketName - The name of the S3 bucket in which the new object will be copied.
destinationKey - The key in the destination bucket under which the new object will be copied.
Method Detail

getSourceBucketName

public String getSourceBucketName()
Returns the name of the bucket containing the source object to be copied.

Returns:
The name of the bucket containing the source object to be copied.

setSourceBucketName

public void setSourceBucketName(String sourceBucketName)
Sets the name of the bucket containing the source object to be copied.

Parameters:
sourceBucketName - The name of the bucket containing the source object to be copied.

withSourceBucketName

public CopyObjectRequest withSourceBucketName(String sourceBucketName)
Sets the name of the bucket containing the source object to be copied, and returns this object so that additional method calls can be chained together.

Parameters:
sourceBucketName - The name of the bucket containing the source object to be copied.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getSourceKey

public String getSourceKey()
Returns the key in the source bucket under which the source object to be copied is stored.

Returns:
The key in the source bucket under which the source object to be copied is stored.

setSourceKey

public void setSourceKey(String sourceKey)
Sets the key in the source bucket under which the source object to be copied is stored.

Parameters:
sourceKey - The key in the source bucket under which the source object to be copied is stored.

withSourceKey

public CopyObjectRequest withSourceKey(String sourceKey)
Sets the key in the source bucket under which the source object to be copied is stored, and returns this object so that additional method calls can be chained together.

Parameters:
sourceKey - The key in the source bucket under which the source object to be copied is stored.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getSourceVersionId

public String getSourceVersionId()
Returns the optional version ID specifying which version of the source object to copy. If not specified, the most recent version of the source object will be copied.

Objects created before versioning was enabled or when versioning is suspended will be given the default/null version ID (see Constants.NULL_VERSION_ID). Note that the Constants.NULL_VERSION_ID is a valid version ID and is not the same as not having a version ID.

See AmazonS3.setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest) for more information about enabling versioning for a bucket.

Returns:
The optional version ID specifying which version of the source object to copy.
See Also:
Constants.NULL_VERSION_ID

setSourceVersionId

public void setSourceVersionId(String sourceVersionId)
Sets the optional version ID specifying which version of the source object to copy. If not specified, the most recent version of the source object will be copied.

Objects created before versioning was enabled or when versioning is suspended will be given the default/null version ID (see Constants.NULL_VERSION_ID). Note that the Constants.NULL_VERSION_ID is a valid version ID and is not the same as not having a version ID.

See AmazonS3.setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest) for more information about enabling versioning for a bucket.

Parameters:
sourceVersionId - The the optional version ID specifying which version of the source object to copy.

withSourceVersionId

public CopyObjectRequest withSourceVersionId(String sourceVersionId)
Sets the optional version ID specifying which version of the source object to copy, and returns this object so that additional method calls can be chained together. If not specified, the most recent version of the source object will be copied.

Objects created before versioning was enabled or when versioning is suspended will be given the default/null version ID (see Constants.NULL_VERSION_ID). Note that the Constants.NULL_VERSION_ID is a valid version ID and is not the same as not having a version ID.

See AmazonS3.setBucketVersioningConfiguration(SetBucketVersioningConfigurationRequest) for more information about enabling versioning for a bucket.

Parameters:
sourceVersionId - The the optional version ID specifying which version of the source object to copy.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getDestinationBucketName

public String getDestinationBucketName()
Returns the name of the destination bucket which will contain the new, copied object.

Returns:
The name of the destination bucket which will contain the new, copied object.

setDestinationBucketName

public void setDestinationBucketName(String destinationBucketName)
Sets the name of the destination bucket which will contain the new, copied object.

Parameters:
destinationBucketName - The name of the destination bucket which will contain the new, copied object.

withDestinationBucketName

public CopyObjectRequest withDestinationBucketName(String destinationBucketName)
Sets the name of the destination bucket which will contain the new, copied object, and returns this object so that additional method calls can be chained together.

Parameters:
destinationBucketName - The name of the destination bucket which will contain the new, copied object.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getDestinationKey

public String getDestinationKey()
Returns the key in the destination bucket under which the new, copied object will be stored.

Returns:
The key in the destination bucket under which the new, copied object will be stored.

setDestinationKey

public void setDestinationKey(String destinationKey)
Sets the key in the destination bucket under which the new, copied object will be stored.

Parameters:
destinationKey - The key in the destination bucket under which the new, copied object will be stored.

withDestinationKey

public CopyObjectRequest withDestinationKey(String destinationKey)
Sets the key in the destination bucket under which the new, copied object will be stored, and returns this object so that additional method calls can be chained together.

Parameters:
destinationKey - The key in the destination bucket under which the new, copied object will be stored.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getStorageClass

public String getStorageClass()
Gets the optional Amazon S3 storage class to use when storing the newly copied object. If not specified, the default, standard storage class will be used.

For more information on available Amazon S3 storage classes, see the StorageClass enumeration.

Returns:
The Amazon S3 storage class to use when storing the newly copied object.

setStorageClass

public void setStorageClass(String storageClass)
Sets the optional Amazon S3 storage class to use when storing the newly copied object. If not specified, the default, standard storage class will be used.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.


withStorageClass

public CopyObjectRequest withStorageClass(String storageClass)
Sets the optional Amazon S3 storage class to use when storing the newly copied object, and returns this CopyObjectRequest so that additional method calls can be chained together. If not specified, the default, standard storage class will be used.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

setStorageClass

public void setStorageClass(StorageClass storageClass)
Sets the optional Amazon S3 storage class to use when storing the newly copied object. If not specified, the default, standard storage class will be used.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.


withStorageClass

public CopyObjectRequest withStorageClass(StorageClass storageClass)
Sets the optional Amazon S3 storage class to use when storing the newly copied object, and returns this CopyObjectRequest so that additional method calls can be chained together. If not specified, the default, standard storage class will be used.

For more information on Amazon S3 storage classes and available values, see the StorageClass enumeration.

Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getCannedAccessControlList

public CannedAccessControlList getCannedAccessControlList()
Returns the canned ACL to use for the new, copied object. If no canned ACL is specified, S3 will default to using the CannedAccessControlList.Private canned ACL for all copied objects.

Returns:
The canned ACL to set for the new, copied object, or null if no canned ACL has been specified.

setCannedAccessControlList

public void setCannedAccessControlList(CannedAccessControlList cannedACL)
Sets the canned ACL to use for the new, copied object. If no canned ACL is specified, S3 will default to using the CannedAccessControlList.Private canned ACL for all copied objects.

Parameters:
cannedACL - The canned ACL to set for the new, copied object.

withCannedAccessControlList

public CopyObjectRequest withCannedAccessControlList(CannedAccessControlList cannedACL)
Sets the canned ACL to use for the new, copied object, and returns this CopyObjectRequest so that additional method calls can be chained together.

Parameters:
cannedACL - The canned ACL to set for the new, copied object.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getNewObjectMetadata

public ObjectMetadata getNewObjectMetadata()
Returns the optional object metadata to set for the new, copied object.

Returns:
The object metadata to set for the new, copied object, otherwise null if no object metadata has been specified.

setNewObjectMetadata

public void setNewObjectMetadata(ObjectMetadata newObjectMetadata)
Sets the object metadata to use for the new, copied object. By default, the object metadata from the source object will be copied to the destination object, but if callers set object metadata with this method, no metadata from the source object will be copied, and instead the new destination object will have the metadata the user has specified here.

Parameters:
newObjectMetadata - The object metadata to use for the new, copied object.

withNewObjectMetadata

public CopyObjectRequest withNewObjectMetadata(ObjectMetadata newObjectMetadata)
Sets the object metadata to use for the new, copied object, and returns this object so that additional method calls can be chained together. By default, the object metadata from the source object will be copied to the destination object, but if callers set object metadata with this method, it will be used instead.

Parameters:
newObjectMetadata - The object metadata to use for the new, copied object.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getMatchingETagConstraints

public List<String> getMatchingETagConstraints()
Returns the optional list of ETag constraints that, when present, must include a match for the source object's current ETag in order for the copy object request to be executed. Only one ETag in the list needs to match for the request to be executed by Amazon S3.

Matching ETag constraints may be used with the unmodified since constraint, but not with any other type of constraint.

Returns:
The optional list of ETag constraints that, when present, must include a match for the source object's current ETag in order for this copy object request to be executed.

setMatchingETagConstraints

public void setMatchingETagConstraints(List<String> eTagList)
Sets the optional list of ETag constraints that, when present, must include a match for the source object's current ETag in order for the copy object request to be executed. If none of the specified ETags match the source object's current ETag, the copy object operation will be aborted. Only one ETag in the list needs to match for the request to be executed by Amazon S3.

Matching ETag constraints may be used with the unmodified since constraint, but not with any other type of constraint.

Parameters:
eTagList - The optional list of ETag constraints that must include a match for the source object's current ETag in order for this copy object request to be executed.

withMatchingETagConstraint

public CopyObjectRequest withMatchingETagConstraint(String eTag)
Adds an single ETag constraint to this request, and returns this object so that additional method calls can be chained together. Multiple ETag constraints can be added to a request, but one must match the source object's current ETag in order for the copy object request to be executed. If none of the ETag constraints added to this request match the source object's current ETag, the copy object operation will be aborted.

Matching ETag constraints may be used with the unmodified since constraint, but not with any other type of constraint.

Parameters:
eTag - The matching ETag constraint to add to this request.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getNonmatchingETagConstraints

public List<String> getNonmatchingETagConstraints()
Returns the optional list of ETag constraints that, when present, must not include a match for the source object's current ETag in order for the copy object request to be executed. If any entry in the non-matching ETag constraint list matches the source object's current ETag, this copy request will not be executed by Amazon S3.

Non-matching ETag constraints may be used with the modified since constraint, but not with any other type of constraint.

Returns:
The optional list of ETag constraints that, when present, must not include a match for the source object's current ETag in order for this copy object request to be executed.

setNonmatchingETagConstraints

public void setNonmatchingETagConstraints(List<String> eTagList)
Sets the optional list of ETag constraints that, when present, must not include a match for the source object's current ETag in order for the copy object request to be executed. If any entry in the non-matching ETag constraint list matches the source object's current ETag, this copy request will not be executed by Amazon S3.

Non-matching ETag constraints may be used with the modified since constraint, but not with any other type of constraint.

Parameters:
eTagList - The list of ETag constraints that, when present, must not include a match for the source object's current ETag in order for this copy object request to be executed.

withNonmatchingETagConstraint

public CopyObjectRequest withNonmatchingETagConstraint(String eTag)
Adds a single ETag constraint to this request, and returns this object so that additional method calls can be chained together. Multiple ETag constraints can be added to a request, but all ETag constraints must not match the source object's current ETag in order for the copy object request to be executed. If any entry in the non-matching ETag constraint list matches the source object's current ETag, this copy request will not be executed by Amazon S3.

Non-matching ETag constraints may be used with the modified since constraint, but not with any other type of constraint.

Parameters:
eTag - The non-matching ETag constraint to add to this request.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getUnmodifiedSinceConstraint

public Date getUnmodifiedSinceConstraint()
Returns the optional unmodified since constraint that restricts this request to executing only if the source object has not been modified since the specified date.

The unmodified since constraint may be used with matching ETag constraints, but not with any other type of constraint.

Returns:
The optional unmodified since constraint that restricts this request to executing only if the source object has not been modified since the specified date.

setUnmodifiedSinceConstraint

public void setUnmodifiedSinceConstraint(Date date)
Sets the optional unmodified since constraint that restricts this request to executing only if the source object has not been modified since the specified date.

The unmodified since constraint may be used with matching ETag constraints, but not with any other type of constraint.

Note that Amazon S3 will ignore any dates occurring in the future.

Parameters:
date - The unmodified since constraint that restricts this request to executing only if the source object has not been modified since this date.

withUnmodifiedSinceConstraint

public CopyObjectRequest withUnmodifiedSinceConstraint(Date date)
Sets the optional unmodified since constraint that restricts this request to executing only if the source object has not been modified since the specified date, and returns this object so that additional method calls can be chained together.

The unmodified since constraint may be used with matching ETag constraints, but not with any other type of constraint.

Note that Amazon S3 will ignore any dates occurring in the future.

Parameters:
date - The unmodified since constraint that restricts this request to executing only if the source object has not been modified since this date.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.

getModifiedSinceConstraint

public Date getModifiedSinceConstraint()
Returns the optional modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.

The modified since constraint may be used with non-matching ETag constraints, but not with any other type of constraint.

Returns:
The optional modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.

setModifiedSinceConstraint

public void setModifiedSinceConstraint(Date date)
Sets the optional modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.

The modified since constraint may be used with non-matching ETag constraints, but not with any other type of constraint.

Note that Amazon S3 will ignore any dates occurring in the future.

Parameters:
date - The modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.

withModifiedSinceConstraint

public CopyObjectRequest withModifiedSinceConstraint(Date date)
Sets the optional modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.

The modified since constraint may be used with non-matching ETag constraints, but not with any other type of constraint.

Note that Amazon S3 will ignore any dates occurring in the future.

Parameters:
date - The modified since constraint that restricts this request to executing only if the source object has been modified since the specified date.
Returns:
This CopyObjectRequest, so that additional method calls can be chained together.


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.