Class AbstractPutObjectRequest
- All Implemented Interfaces:
ReadLimitInfo,S3DataSource,SSEAwsKeyManagementParamsProvider,SSECustomerKeyProvider,Serializable,Cloneable
- Direct Known Subclasses:
PutObjectRequest,UploadObjectRequest
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.amazonaws.services.s3.model.S3DataSource
S3DataSource.Utils -
Field Summary
Fields inherited from class com.amazonaws.AmazonWebServiceRequest
NOOP -
Constructor Summary
ConstructorsModifierConstructorDescriptionAbstractPutObjectRequest(String bucketName, String key, File file) Constructs a newAbstractPutObjectRequestobject to upload a file to the specified bucket and key.protectedAbstractPutObjectRequest(String bucketName, String key, InputStream input, ObjectMetadata metadata) Constructs a newAbstractPutObjectRequestobject to upload a stream of data to the specified bucket and key.AbstractPutObjectRequest(String bucketName, String key, String redirectLocation) Constructs a newAbstractPutObjectRequestobject with redirect location. -
Method Summary
Modifier and TypeMethodDescriptionabstract AbstractPutObjectRequestclone()Creates a shallow clone of this request.protected final <T extends AbstractPutObjectRequest>
TcopyPutObjectBaseTo(T target) Returns the optional access control list for the new object.Gets the name of the existing bucket where this request will upload a new object to.Gets the optional pre-configured access control policy to use for the new object.getFile()Gets the path and name of the file containing the data to be uploaded to Amazon S3.Gets the input stream containing the data to be uploaded to Amazon S3.getKey()Gets the key under which to store the new object.Gets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).Deprecated.Gets the optional redirect location for the new object.Returns the AWS Key Management System parameters used to encrypt the object on server side.Returns the optional customer-provided server-side encryption key to use to encrypt the uploaded object.Gets the optional Amazon S3 storage class to use when storing the new object.voidsetAccessControlList(AccessControlList accessControlList) Sets the optional access control list for the new object.voidsetBucketName(String bucketName) Sets the name of an existing bucket where this request will upload a new object to.voidsetCannedAcl(CannedAccessControlList cannedAcl) Sets the optional pre-configured access control policy to use for the new object.voidSets the path and name of the file containing the data to be uploaded to Amazon S3.voidsetInputStream(InputStream inputStream) Sets the input stream containing the data to be uploaded to Amazon S3.voidSets the key under which to store the new object.voidsetMetadata(ObjectMetadata metadata) Sets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).voidsetProgressListener(ProgressListener progressListener) Deprecated.voidsetRedirectLocation(String redirectLocation) Sets the optional redirect location for the new object.voidSets the AWS Key Management System parameters used to encrypt the object on server side.voidsetSSECustomerKey(SSECustomerKey sseKey) Sets the optional customer-provided server-side encryption key to use to encrypt the uploaded object.voidsetStorageClass(StorageClass storageClass) Sets the optional Amazon S3 storage class to use when storing the new object.voidsetStorageClass(String storageClass) Sets the optional Amazon S3 storage class to use when storing the new object.<T extends AbstractPutObjectRequest>
TwithAccessControlList(AccessControlList accessControlList) Sets the optional access control list for the new object.<T extends AbstractPutObjectRequest>
TwithBucketName(String bucketName) Sets the name of the bucket where this request will upload a new object to.<T extends AbstractPutObjectRequest>
TwithCannedAcl(CannedAccessControlList cannedAcl) Sets the optional pre-configured access control policy to use for the new object.<T extends AbstractPutObjectRequest>
TSets the file containing the data to be uploaded to Amazon S3.<T extends AbstractPutObjectRequest>
TwithInputStream(InputStream inputStream) Sets the input stream containing the data to be uploaded to Amazon S3.<T extends AbstractPutObjectRequest>
TSets the key under which to store the new object.<T extends AbstractPutObjectRequest>
TwithMetadata(ObjectMetadata metadata) Sets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).<T extends AbstractPutObjectRequest>
TwithProgressListener(ProgressListener progressListener) Deprecated.<T extends AbstractPutObjectRequest>
TwithRedirectLocation(String redirectLocation) Sets the optional redirect location for the new object.Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together.<T extends AbstractPutObjectRequest>
TwithSSEAwsKeyManagementParams(SSEAwsKeyManagementParams sseAwsKeyManagementParams) Sets the AWS Key Management System parameters used to encrypt the object on server side.<T extends AbstractPutObjectRequest>
TwithSSECustomerKey(SSECustomerKey sseKey) Sets the optional customer-provided server-side encryption key to use to encrypt the uploaded object, and returns the updated request object so that additional method calls can be chained together.<T extends AbstractPutObjectRequest>
TwithStorageClass(StorageClass storageClass) Sets the optional Amazon S3 storage class to use when storing the new object.<T extends AbstractPutObjectRequest>
TwithStorageClass(String storageClass) Sets the optional Amazon S3 storage class to use when storing the new object.Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyBaseTo, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestCredentialsProvider, getRequestMetricCollector, getSdkClientExecutionTimeout, getSdkRequestTimeout, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestCredentialsProvider, setRequestMetricCollector, setSdkClientExecutionTimeout, setSdkRequestTimeout, withGeneralProgressListener, withRequestMetricCollector, withSdkClientExecutionTimeout, withSdkRequestTimeout
-
Constructor Details
-
AbstractPutObjectRequest
Constructs a newAbstractPutObjectRequestobject to upload a file to the specified bucket and key. After constructing the request, users may optionally specify object metadata or a canned ACL as well.- Parameters:
bucketName- The name of an existing bucket to which the new object will be uploaded.key- The key under which to store the new object.file- The path of the file to upload to Amazon S3.
-
AbstractPutObjectRequest
Constructs a newAbstractPutObjectRequestobject with redirect location. After constructing the request, users may optionally specify object metadata or a canned ACL as well.- Parameters:
bucketName- The name of an existing bucket to which the new object will be uploaded.key- The key under which to store the new object.redirectLocation- The redirect location of this new object.
-
AbstractPutObjectRequest
protected AbstractPutObjectRequest(String bucketName, String key, InputStream input, ObjectMetadata metadata) Constructs a newAbstractPutObjectRequestobject to upload a stream of data to the specified bucket and key. After constructing the request, users may optionally specify object metadata or a canned ACL as well.Content length for the data stream must be specified in the object metadata parameter; Amazon S3 requires it be passed in before the data is uploaded. Failure to specify a content length will cause the entire contents of the input stream to be buffered locally in memory so that the content length can be calculated, which can result in negative performance problems.
- Parameters:
bucketName- The name of an existing bucket to which the new object will be uploaded.key- The key under which to store the new object.input- The stream of data to upload to Amazon S3.metadata- The object metadata. At minimum this specifies the content length for the stream of data being uploaded.
-
-
Method Details
-
getBucketName
Gets the name of the existing bucket where this request will upload a new object to. In order to upload the object, users must havePermission.Writepermission granted.- Returns:
- The name of an existing bucket where this request will upload a new object to.
- See Also:
-
setBucketName
Sets the name of an existing bucket where this request will upload a new object to. In order to upload the object, users must havePermission.Writepermission granted.- Parameters:
bucketName- The name of an existing bucket where this request will upload a new object to. In order to upload the object, users must havePermission.Writepermission granted.- See Also:
-
withBucketName
Sets the name of the bucket where this request will upload a new object to. Returns this object, enabling additional method calls to be chained together.In order to upload the object, users must have
Permission.Writepermission granted.- Parameters:
bucketName- The name of an existing bucket where this request will upload a new object to. In order to upload the object, users must havePermission.Writepermission granted.- Returns:
- This
AbstractPutObjectRequest, enabling additional method calls to be chained together. - See Also:
-
getKey
Gets the key under which to store the new object.- Returns:
- The key under which to store the new object.
- See Also:
-
setKey
Sets the key under which to store the new object.- Parameters:
key- The key under which to store the new object.- See Also:
-
withKey
Sets the key under which to store the new object. Returns this object, enabling additional method calls to be chained together.- Parameters:
key- The key under which to store the new object.- Returns:
- This
AbstractPutObjectRequest, enabling additional method calls to be chained together. - See Also:
-
getStorageClass
Gets the optional Amazon S3 storage class to use when storing the new object. If not specified, the default standard storage class is used when storing the object.For more information on available Amazon S3 storage classes, see the
StorageClassenumeration.- Returns:
- The Amazon S3 storage class to use when storing the newly copied object.
- See Also:
-
setStorageClass
Sets the optional Amazon S3 storage class to use when storing the new object. If not specified, the default standard storage class will be used when storing the new object.For more information on Amazon S3 storage classes and available values, see the
StorageClassenumeration.- Parameters:
storageClass- The storage class to use when storing the new object.- See Also:
-
withStorageClass
Sets the optional Amazon S3 storage class to use when storing the new object. Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together. If not specified, the default standard storage class will be used when storing the object.For more information on Amazon S3 storage classes and available values, see the
StorageClassenumeration.- Parameters:
storageClass- The storage class to use when storing the new object.- Returns:
- This
AbstractPutObjectRequest, enabling additional method calls to be chained together. - See Also:
-
setStorageClass
Sets the optional Amazon S3 storage class to use when storing the new object. If not specified, the default standard storage class will be used when storing the object.For more information on Amazon S3 storage classes and available values, see the
StorageClassenumeration.- Parameters:
storageClass- The storage class to use when storing the new object.- See Also:
-
withStorageClass
Sets the optional Amazon S3 storage class to use when storing the new object. Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together. If not specified, the default standard storage class will be used when storing the object.For more information on Amazon S3 storage classes and available values, see the
StorageClassenumeration.- Parameters:
storageClass- The storage class to use when storing the new object.- Returns:
- This
AbstractPutObjectRequest, enabling additional method calls to be chained together. - See Also:
-
getFile
Gets the path and name of the file containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.- Specified by:
getFilein interfaceS3DataSource- Returns:
- The path and name of the file containing the data to be uploaded to Amazon S3.
- See Also:
-
setFile
Sets the path and name of the file containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.- Specified by:
setFilein interfaceS3DataSource- Parameters:
file- The path and name of the file containing the data to be uploaded to Amazon S3.- See Also:
-
withFile
Sets the file containing the data to be uploaded to Amazon S3. Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together.Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.
- Parameters:
file- The file containing the data to be uploaded to Amazon S3.- Returns:
- This
AbstractPutObjectRequest, enabling additional method calls to be chained together. - See Also:
-
getMetadata
Gets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.
- Returns:
- The optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).
- See Also:
-
setMetadata
Sets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.
- Parameters:
metadata- The optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).- See Also:
-
withMetadata
Sets the optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.). Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together.If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.
- Parameters:
metadata- The optional metadata instructing Amazon S3 how to handle the uploaded data (e.g. custom user metadata, hooks for specifying content type, etc.).- Returns:
- This
AbstractPutObjectRequest, enabling additional method calls to be chained together. - See Also:
-
getCannedAcl
Gets the optional pre-configured access control policy to use for the new object.- Returns:
- The optional pre-configured access control policy to use for the new object.
- See Also:
-
setCannedAcl
Sets the optional pre-configured access control policy to use for the new object.- Parameters:
cannedAcl- The optional pre-configured access control policy to use for the new object.- See Also:
-
withCannedAcl
Sets the optional pre-configured access control policy to use for the new object. Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together.- Parameters:
cannedAcl- The optional pre-configured access control policy to use for the new object.- Returns:
- This
AbstractPutObjectRequest, enabling additional method calls to be chained together. - See Also:
-
getAccessControlList
Returns the optional access control list for the new object. If specified, cannedAcl will be ignored. -
setAccessControlList
Sets the optional access control list for the new object. If specified, cannedAcl will be ignored.- Parameters:
accessControlList- The access control list for the new object.
-
withAccessControlList
public <T extends AbstractPutObjectRequest> T withAccessControlList(AccessControlList accessControlList) Sets the optional access control list for the new object. If specified, cannedAcl will be ignored. Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together.- Parameters:
accessControlList- The access control list for the new object.
-
getInputStream
Gets the input stream containing the data to be uploaded to Amazon S3. The user of this request must either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.- Specified by:
getInputStreamin interfaceS3DataSource- Returns:
- The input stream containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3, not both.
- See Also:
-
setInputStream
Sets the input stream containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.- Specified by:
setInputStreamin interfaceS3DataSource- Parameters:
inputStream- The input stream containing the data to be uploaded to Amazon S3. Either specify a file or an input stream containing the data to be uploaded to Amazon S3, not both.- See Also:
-
withInputStream
Sets the input stream containing the data to be uploaded to Amazon S3. Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together.Either specify a file or an input stream containing the data to be uploaded to Amazon S3; both cannot be specified.
- Parameters:
inputStream- The InputStream containing the data to be uploaded to Amazon S3.- Returns:
- This PutObjectRequest, so that additional method calls can be chained together.
- See Also:
-
setRedirectLocation
Sets the optional redirect location for the new object.- Parameters:
redirectLocation- The redirect location for the new object.
-
getRedirectLocation
Gets the optional redirect location for the new object. -
withRedirectLocation
Sets the optional redirect location for the new object.Returns thisAbstractPutObjectRequest, enabling additional method calls to be chained together.- Parameters:
redirectLocation- The redirect location for the new object.
-
getSSECustomerKey
Description copied from interface:SSECustomerKeyProviderReturns the optional customer-provided server-side encryption key to use to encrypt the uploaded object.- Specified by:
getSSECustomerKeyin interfaceSSECustomerKeyProvider- Returns:
- The optional customer-provided server-side encryption key to use to encrypt the uploaded object.
-
setSSECustomerKey
Sets the optional customer-provided server-side encryption key to use to encrypt the uploaded object.- Parameters:
sseKey- The optional customer-provided server-side encryption key to use to encrypt the uploaded object.
-
withSSECustomerKey
Sets the optional customer-provided server-side encryption key to use to encrypt the uploaded object, and returns the updated request object so that additional method calls can be chained together.- Parameters:
sseKey- The optional customer-provided server-side encryption key to use to encrypt the uploaded object.- Returns:
- This updated request object so that additional method calls can be chained together.
-
setProgressListener
Deprecated.Sets the optional progress listener for receiving updates for object upload status.- Parameters:
progressListener- The legacy progress listener that is used exclusively for Amazon S3 client.
-
getProgressListener
Deprecated.useAmazonWebServiceRequest.getGeneralProgressListener()instead.Returns the optional progress listener for receiving updates about object upload status.- Returns:
- the optional progress listener for receiving updates about object upload status.
-
withProgressListener
@Deprecated public <T extends AbstractPutObjectRequest> T withProgressListener(ProgressListener progressListener) Deprecated.Sets the optional progress listener for receiving updates about object upload status, and returns this updated object so that additional method calls can be chained together.- Parameters:
progressListener- The legacy progress listener that is used exclusively for Amazon S3 client.- Returns:
- This updated PutObjectRequest object.
-
getSSEAwsKeyManagementParams
Returns the AWS Key Management System parameters used to encrypt the object on server side.- Specified by:
getSSEAwsKeyManagementParamsin interfaceSSEAwsKeyManagementParamsProvider- Returns:
- The optional SSEAwsKeyManagementParams to use to encrypt the uploaded object.
-
setSSEAwsKeyManagementParams
Sets the AWS Key Management System parameters used to encrypt the object on server side. -
withSSEAwsKeyManagementParams
public <T extends AbstractPutObjectRequest> T withSSEAwsKeyManagementParams(SSEAwsKeyManagementParams sseAwsKeyManagementParams) Sets the AWS Key Management System parameters used to encrypt the object on server side.- Returns:
- returns the update PutObjectRequest
-
clone
Description copied from class:AmazonWebServiceRequestCreates a shallow clone of this request. Explicitly does not clone the deep structure of the request object.- Overrides:
clonein classAmazonWebServiceRequest- See Also:
-
copyPutObjectBaseTo
-
AmazonWebServiceRequest.getGeneralProgressListener()instead.