/* * Copyright 2014-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.s3.model; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.event.ProgressListener; import java.io.File; import java.io.InputStream; import java.io.Serializable; import java.util.Date; /** * Abstract base class for a put object or put object like request. */ public abstract class AbstractPutObjectRequest extends AmazonWebServiceRequest implements Cloneable, SSECustomerKeyProvider, SSEAwsKeyManagementParamsProvider, S3DataSource, Serializable { /** * The name of an existing bucket, to which this request will upload a new * object. You must have {@link Permission#Write} permission granted to you * in order to upload new objects to a bucket. * *
* When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
* S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
* Amazon S3 User Guide.
*
* For more information on Amazon S3 storage classes and available values, * see the {@link StorageClass} enumeration. */ private String storageClass; /** The optional redirect location about an object */ private String redirectLocation; /** * The optional customer-provided server-side encryption key to use to * encrypt the uploaded object. */ private SSECustomerKey sseCustomerKey; /** * The optional Amazon Web Services Key Management system parameters to be used to encrypt * the the object on the server side. */ private SSEAwsKeyManagementParams sseAwsKeyManagementParams; private ObjectTagging tagging; private String objectLockMode; private Date objectLockRetainUntilDate; private String objectLockLegalHoldStatus; private Boolean bucketKeyEnabled; /** * Constructs a new * {@link AbstractPutObjectRequest} object 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. *
* When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
* S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
* Amazon S3 User Guide.
*
* When using this action with an access point, you must direct requests to the access point hostname. * The access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
* hostname. The S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
* in the Amazon S3 User Guide.
* @param key
* The key under which to store the new object.
* @param file
* The path of the file to upload to Amazon S3.
*/
public AbstractPutObjectRequest(String bucketName, String key, File file) {
this.bucketName = bucketName;
this.key = key;
this.file = file;
}
/**
* Constructs a new {@link AbstractPutObjectRequest} object with redirect location.
* After constructing the request, users may optionally specify object
* metadata or a canned ACL as well.
*
* When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
* S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
* Amazon S3 User Guide.
*
* When using this action with an access point, you must direct requests to the access point hostname. * The access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
* hostname. The S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
* in the Amazon S3 User Guide.
* @param key
* The key under which to store the new object.
* @param redirectLocation
* The redirect location of this new object.
*/
public AbstractPutObjectRequest(String bucketName, String key,
String redirectLocation) {
this.bucketName = bucketName;
this.key = key;
this.redirectLocation = redirectLocation;
}
/**
* Constructs a new
* {@link AbstractPutObjectRequest} object 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. *
** When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
* S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
* Amazon S3 User Guide.
*
* When using this action with an access point, you must direct requests to the access point hostname. * The access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
* hostname. The S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
* in the Amazon S3 User Guide.
* @param key
* The key under which to store the new object.
* @param input
* The stream of data to upload to Amazon S3.
* @param metadata
* The object metadata. At minimum this specifies the
* content length for the stream of data being uploaded.
*/
protected AbstractPutObjectRequest(String bucketName, String key,
InputStream input, ObjectMetadata metadata) {
this.bucketName = bucketName;
this.key = key;
this.inputStream = input;
this.metadata = metadata;
}
/**
*
* The bucket name to which the PUT action was initiated. *
** When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
* S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
* Amazon S3 User Guide.
*
* When using this action with an access point, you must direct requests to the access point hostname. * The access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
* hostname. The S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
* in the Amazon S3 User Guide.
*
* @see AbstractPutObjectRequest#setBucketName(String)
* @see AbstractPutObjectRequest#withBucketName(String)
*/
public String getBucketName() {
return bucketName;
}
/**
*
* The bucket name to which the PUT action was initiated. *
** When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
* S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
* Amazon S3 User Guide.
*
* When using this action with an access point, you must direct requests to the access point hostname. * The access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
* hostname. The S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
* in the Amazon S3 User Guide.
*
* @see AbstractPutObjectRequest#getBucketName()
* @see AbstractPutObjectRequest#withBucketName(String)
*/
public void setBucketName(String bucketName) {
this.bucketName = bucketName;
}
/**
*
* The bucket name to which the PUT action was initiated. *
** When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
* S3 on Outposts hostname takes the form
* AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
* Amazon S3 User Guide.
*
* When using this action with an access point, you must direct requests to the access point hostname. * The access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *
*
* When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
* hostname. The S3 on Outposts hostname takes the form
*
* For more information on available Amazon S3 storage classes, see the
* {@link StorageClass} enumeration.
*
* For more information on Amazon S3 storage classes and available values,
* see the {@link StorageClass} enumeration.
*
* For more information on Amazon S3 storage classes and available values,
* see the {@link StorageClass} enumeration.
*
* For more information on Amazon S3 storage classes and available values,
* see the {@link StorageClass} enumeration.
*
* For more information on Amazon S3 storage classes and available values,
* see the {@link StorageClass} enumeration.
*
* Either specify a file or an input stream containing the data to
* be uploaded to Amazon S3; both cannot be specified.
*
* @param file
* The file containing the data to be uploaded to Amazon S3.
*
* @return This {@link AbstractPutObjectRequest}, enabling additional method
* calls to be chained together.
*
* @see AbstractPutObjectRequest#getFile()
* @see AbstractPutObjectRequest#setFile(File)
* @see AbstractPutObjectRequest#getInputStream()
* @see AbstractPutObjectRequest#setInputStream(InputStream)
*/
public
* 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.
*
* 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.
*
* 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.
*
* Either specify a file or an input stream containing the data to be
* uploaded to Amazon S3; both cannot be specified.
* Specifying this header with a PUT operation doesn't affect bucket-level settings for S3 Bucket Key.
*/
public void setBucketKeyEnabled(Boolean bucketKeyEnabled) {
this.bucketKeyEnabled = bucketKeyEnabled;
}
/**
* Specifies whether the client should use an S3 Bucket Key for object encryption with server-side encryption using Amazon Web Services KMS
* (SSE-KMS). Setting this header to Specifying this header with a PUT operation doesn't affect bucket-level settings for S3 Bucket Key.
* @return returns the update PutObjectRequest
*/
public AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
* When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
* access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
* in the Amazon S3 User Guide.
*
* @return This {@link AbstractPutObjectRequest}, enabling additional method calls to be
* chained together.
*
* @see AbstractPutObjectRequest#getBucketName()
* @see AbstractPutObjectRequest#setBucketName(String)
*/
public true
causes the client to use an S3 Bucket Key for object encryption with
* SSE-KMS.
*
* true
causes the client to use an S3 Bucket Key for object encryption with
* SSE-KMS.
*
*