public class GeneratePresignedUrlRequest extends AmazonWebServiceRequest implements SSECustomerKeyProvider, java.io.Serializable
Contains options to generate a pre-signed URL for an Amazon S3 resource.
Pre-signed URLs allow clients to form a URL for an Amazon S3 resource and sign it with the current AWS security credentials. A pre-signed URL may be passed around for other users to access the resource without providing them access to an account's AWS security credentials.
Constructor and Description |
---|
GeneratePresignedUrlRequest(java.lang.String bucketName,
java.lang.String key)
Creates a new request for generating a pre-signed URL that can be used as
part of an HTTP GET request to access the Amazon S3 object stored under
the specified key in the specified bucket.
|
GeneratePresignedUrlRequest(java.lang.String bucketName,
java.lang.String key,
HttpMethod method)
Creates a new request for generating a pre-signed URL that can be used as
part of an HTTP request to access the specified Amazon S3 resource.
|
Modifier and Type | Method and Description |
---|---|
void |
addCustomQueryParameter(java.lang.String name,
java.lang.String value)
Add a custom query parameter for the request.
|
void |
addRequestParameter(java.lang.String key,
java.lang.String value)
Adds an additional request parameter to be included in the pre-signed
URL.
|
java.lang.String |
getBucketName()
Returns the name of the bucket involved in this request.
|
java.lang.String |
getContentMd5()
Gets the expected content-md5 header of the request.
|
java.lang.String |
getContentType()
Gets the expected content-type of the request.
|
java.util.Map<java.lang.String,java.lang.String> |
getCustomQueryParameters() |
java.util.Date |
getExpiration()
The expiration date at which point the new pre-signed URL will no longer
be accepted by Amazon S3.
|
java.lang.String |
getKey()
Returns the key of the object involved in this request.
|
java.lang.String |
getKmsCmkId()
Returns the KMS customer key id used for server side encryption; or null
if there is none.
|
HttpMethod |
getMethod()
The HTTP method (GET, PUT, DELETE, HEAD) to be used in this request.
|
java.util.Map<java.lang.String,java.lang.String> |
getRequestParameters()
Returns the complete map of additional request parameters to be included
in the pre-signed URL.
|
ResponseHeaderOverrides |
getResponseHeaders()
Returns the headers to be overridden in the service response.
|
java.lang.String |
getSSEAlgorithm()
Returns the SSE algorithm used for SSE (with server side key); or null if
SSE (with server side key) is not in use.
|
SSECustomerKey |
getSSECustomerKey()
Returns the optional customer-provided server-side encryption key to use
to encrypt the uploaded object.
|
java.lang.String |
getVersionId()
Returns the version ID of the object, only present if versioning has
been enabled for the bucket.
|
boolean |
isZeroByteContent()
Returns true if zero byte content is to be used for generating pre-signed
URL; false otherwise.
|
void |
rejectIllegalArguments()
Rejects any illegal input (as attributes of this request) by the user.
|
void |
setBucketName(java.lang.String bucketName)
Sets the name of the bucket involved in this request.
|
void |
setContentMd5(java.lang.String contentMd5)
Sets the expected content-md5 header of the request.
|
void |
setContentType(java.lang.String contentType)
Sets the expected content-type of the request.
|
void |
setExpiration(java.util.Date expiration)
Sets the expiration date at which point the new pre-signed URL will no
longer be accepted by Amazon S3.
|
void |
setKey(java.lang.String key)
Sets the key of the object involved in this request.
|
void |
setKmsCmkId(java.lang.String kmsCmkId)
Sets the KMS customer key id used for server side encryption.
|
void |
setMethod(HttpMethod method)
Sets the HTTP method (GET, PUT, DELETE, HEAD) to be used in this request.
|
void |
setResponseHeaders(ResponseHeaderOverrides responseHeaders)
Sets the headers to be overridden in the service response.
|
void |
setSSEAlgorithm(SSEAlgorithm sseAlgorithm)
Sets the SSE algorithm for server side encryption.
|
void |
setSSEAlgorithm(java.lang.String sseAlgorithm)
Sets the SSE algorithm for server side encryption.
|
void |
setSSECustomerKey(SSECustomerKey sseCustomerKey)
Sets the customer-provided server-side encryption key to use as part of
the generated pre-signed URL.
|
void |
setSSECustomerKeyAlgorithm(SSEAlgorithm sseAlgorithm)
Sets the use of SSE-C (Server Side Encryption with Customer Key) using
the given encryption algorithm.
|
void |
setVersionId(java.lang.String versionId)
Sets the version ID of the object, only present if versioning has
been enabled for the bucket.
|
void |
setZeroByteContent(boolean zeroByteContent)
Sets if zero byte content is to be used for generating pre-signed URL.
|
GeneratePresignedUrlRequest |
withBucketName(java.lang.String bucketName)
Sets the name of the bucket involved in this request, and returns this
request object to enable additional method calls to be chained together.
|
GeneratePresignedUrlRequest |
withContentMd5(java.lang.String contentMd5)
Sets the expected content-md5 header of the request and returns this
object, for method chaining.
|
GeneratePresignedUrlRequest |
withContentType(java.lang.String contentType)
Sets the expected content-type of the request and returns
this object, for method chaining.
|
GeneratePresignedUrlRequest |
withExpiration(java.util.Date expiration)
Sets the expiration date at which point the new pre-signed URL will no
longer be accepted by Amazon S3, and returns this request object to
enable additional method calls to be chained together.
|
GeneratePresignedUrlRequest |
withKey(java.lang.String key)
Sets the key of the object involved in this request, and returns this
request object to enable additional method calls to be chained together.
|
GeneratePresignedUrlRequest |
withKmsCmkId(java.lang.String kmsCmkId)
Fluent API for
setKmsCmkId(String) |
GeneratePresignedUrlRequest |
withMethod(HttpMethod method)
Sets the HTTP method (GET, PUT, DELETE, HEAD) to be used in this request,
and returns this request object to enable additional method calls to be
chained together.
|
GeneratePresignedUrlRequest |
withResponseHeaders(ResponseHeaderOverrides responseHeaders)
Sets the headers to be overridden in the service response and returns
this object, for method chaining.
|
GeneratePresignedUrlRequest |
withSSEAlgorithm(SSEAlgorithm sseAlgorithm)
Fluent API for
setSSEAlgorithm(SSEAlgorithm) |
GeneratePresignedUrlRequest |
withSSEAlgorithm(java.lang.String sseAlgorithm)
Fluent API for
setSSEAlgorithm(String) |
GeneratePresignedUrlRequest |
withSSECustomerKey(SSECustomerKey sseKey)
Sets the customer-provided server-side encryption key to use as part of
the generated pre-signed URL, and returns the updated request object so
that additional method calls can be chained together.
|
GeneratePresignedUrlRequest |
withSSECustomerKeyAlgorithm(SSEAlgorithm algorithm)
Fluent method for
setSSECustomerKeyAlgorithm(SSEAlgorithm) . |
GeneratePresignedUrlRequest |
withVersionId(java.lang.String versionId)
Sets the version ID of the object, only present if versioning has
been enabled for the bucket.
|
GeneratePresignedUrlRequest |
withZeroByteContent(boolean zeroByteContent)
Fluent method for
setZeroByteContent(boolean) . |
clone, getCloneRoot, getCloneSource, getGeneralProgressListener, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setGeneralProgressListener, setRequestCredentials, setRequestMetricCollector, withGeneralProgressListener, withRequestMetricCollector
public GeneratePresignedUrlRequest(java.lang.String bucketName, java.lang.String key)
bucketName
- The name of the bucket containing the desired Amazon S3
object.key
- The key under which the desired Amazon S3 object is stored.public GeneratePresignedUrlRequest(java.lang.String bucketName, java.lang.String key, HttpMethod method)
Creates a new request for generating a pre-signed URL that can be used as part of an HTTP request to access the specified Amazon S3 resource.
When specifying an HTTP method, you must send the pre-signed URL with the same HTTP method in order to successfully use the pre-signed URL.
bucketName
- The name of the Amazon S3 bucket involved in the operation.key
- The key of the Amazon S3 object involved in the operation.method
- The HTTP method (GET, PUT, DELETE, HEAD) to be used in the
request when the pre-signed URL is used.public java.lang.String getKmsCmkId()
public void setKmsCmkId(java.lang.String kmsCmkId)
Note S3 does not require HTTP header “x-amz-server-side-encryption-aws-kms-key-id” to be always present (a default key ID will be used if this header is not present).
It is also possible to set the header to “alias/aws/s3” to refer to the default KMS CMK ID.
public GeneratePresignedUrlRequest withKmsCmkId(java.lang.String kmsCmkId)
setKmsCmkId(String)
public java.lang.String getSSEAlgorithm()
public void setSSEAlgorithm(java.lang.String sseAlgorithm)
currently
- supported values: "AES256" or "aws:kms".public GeneratePresignedUrlRequest withSSEAlgorithm(java.lang.String sseAlgorithm)
setSSEAlgorithm(String)
public void setSSEAlgorithm(SSEAlgorithm sseAlgorithm)
currently
- supported values: "AES256" or "aws:kms".public GeneratePresignedUrlRequest withSSEAlgorithm(SSEAlgorithm sseAlgorithm)
setSSEAlgorithm(SSEAlgorithm)
public HttpMethod getMethod()
public void setMethod(HttpMethod method)
method
- The HTTP method (GET, PUT, DELETE, HEAD) to be used in this
request.public GeneratePresignedUrlRequest withMethod(HttpMethod method)
The same HTTP method must be used in the request when the pre-signed URL is used.
method
- The HTTP method (GET, PUT, DELETE, HEAD) to be used in this
request.public java.lang.String getBucketName()
public void setBucketName(java.lang.String bucketName)
bucketName
- the name of the bucket involved in this request.public GeneratePresignedUrlRequest withBucketName(java.lang.String bucketName)
bucketName
- the name of the bucket involved in this request.public java.lang.String getKey()
public void setKey(java.lang.String key)
key
- the key of the object involved in this request.public GeneratePresignedUrlRequest withKey(java.lang.String key)
key
- the key of the object involved in this request.public java.lang.String getVersionId()
public void setVersionId(java.lang.String versionId)
versionId
- The version ID of the object, only present if versioning
has been enabled for the bucket.public GeneratePresignedUrlRequest withVersionId(java.lang.String versionId)
GeneratePresignedUrlRequest
object for method chanining.versionId
- The version ID of the object, only present if versioning
has been enabled for the bucket.public java.util.Date getExpiration()
public void setExpiration(java.util.Date expiration)
expiration
- The expiration date at which point the new pre-signed URL will
no longer be accepted by Amazon S3.public GeneratePresignedUrlRequest withExpiration(java.util.Date expiration)
If not specified, a default value will be supplied.
expiration
- The expiration date at which point the new pre-signed URL will
no longer be accepted by Amazon S3.public void addRequestParameter(java.lang.String key, java.lang.String value)
key
- The name of the request parameter, as it appears in the URL's
query string (e.g. versionId).value
- The (optional) value of the request parameter being added.public java.util.Map<java.lang.String,java.lang.String> getRequestParameters()
public java.util.Map<java.lang.String,java.lang.String> getCustomQueryParameters()
public void addCustomQueryParameter(java.lang.String name, java.lang.String value)
Any custom query parameters that are defined are used in the HTTP request to the AWS service.
name
- The name of the query parametervalue
- The value of the query parameter. Only the parameter name will be added in the URI
if the value is set to null. For example, addCustomQueryParameter("param", null)
will be serialized to "?param", while addCustomQueryParameter("param", "") will be
serialized to "?param=".public ResponseHeaderOverrides getResponseHeaders()
public void setResponseHeaders(ResponseHeaderOverrides responseHeaders)
responseHeaders
- The headers to be overridden in the service response.public GeneratePresignedUrlRequest withResponseHeaders(ResponseHeaderOverrides responseHeaders)
responseHeaders
- The headers to be overridden in the service response.GeneratePresignedUrlRequest
for method chaining.public java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
contentType
- The expected content-typepublic GeneratePresignedUrlRequest withContentType(java.lang.String contentType)
contentType
- The expected content-typeGeneratePresignedUrlRequest
for method chaining.public java.lang.String getContentMd5()
public void setContentMd5(java.lang.String contentMd5)
contentMd5
- The expected content-md5 header value.public GeneratePresignedUrlRequest withContentMd5(java.lang.String contentMd5)
contentMd5
- The expected content-md5 header value.GeneratePresignedUrlRequest
for method chaining.public SSECustomerKey getSSECustomerKey()
SSECustomerKeyProvider
getSSECustomerKey
in interface SSECustomerKeyProvider
public void setSSECustomerKey(SSECustomerKey sseCustomerKey)
sseCustomerKey
- The customer-provided server-side encryption key to use as
part of the generated pre-signed URL.public GeneratePresignedUrlRequest withSSECustomerKey(SSECustomerKey sseKey)
sseKey
- The customer-provided server-side encryption key to use as
part of the generated pre-signed URL.public void setSSECustomerKeyAlgorithm(SSEAlgorithm sseAlgorithm)
sseAlgorithm
- The server-side encryption algorithm to use with this
customer-provided server-side encryption key; or null if SSE-C
is disabled. "AES256" is currently the only
supported SSE-C encryption algorithm.public GeneratePresignedUrlRequest withSSECustomerKeyAlgorithm(SSEAlgorithm algorithm)
setSSECustomerKeyAlgorithm(SSEAlgorithm)
.public boolean isZeroByteContent()
public void setZeroByteContent(boolean zeroByteContent)
public GeneratePresignedUrlRequest withZeroByteContent(boolean zeroByteContent)
setZeroByteContent(boolean)
.public void rejectIllegalArguments()
java.lang.IllegalArgumentException
- if there is illegal input from the user.Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.