Package software.amazon.awssdk.crt.s3
Class S3MetaRequestOptions
- java.lang.Object
-
- software.amazon.awssdk.crt.s3.S3MetaRequestOptions
-
public class S3MetaRequestOptions extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
S3MetaRequestOptions.MetaRequestType
A Meta Request represents a group of generated requests that are being done on behalf of the original request.static class
S3MetaRequestOptions.ResponseFileOption
-
Constructor Summary
Constructors Constructor Description S3MetaRequestOptions()
-
Method Summary
-
-
-
Method Detail
-
withMetaRequestType
public S3MetaRequestOptions withMetaRequestType(S3MetaRequestOptions.MetaRequestType metaRequestType)
-
getMetaRequestType
public S3MetaRequestOptions.MetaRequestType getMetaRequestType()
-
withOperationName
public S3MetaRequestOptions withOperationName(String operationName)
The S3 operation name (eg: "CreateBucket"), this MUST be set forS3MetaRequestOptions.MetaRequestType.DEFAULT
, it is ignored for other meta request types since the operation is implicit. See S3 API documentation for the canonical list of names. This name is used to fill out details in metrics and error reports. It also drives some operation-specific behavior. If you pass the wrong name, you risk getting the wrong behavior. For example, every operation except "GetObject" has its response checked for error, even if the HTTP status-code was 200 OK (see knowledge center). If you used theDEFAULT
type to do GetObject, but mis-named it "Download", and the object looked like XML with an error code, then the meta-request would fail. You risk logging the full response body, and leaking sensitive data.- Parameters:
operationName
- the operation name for thisS3MetaRequestOptions.MetaRequestType.DEFAULT
meta request- Returns:
- this
-
getOperationName
public String getOperationName()
-
withChecksumConfig
public S3MetaRequestOptions withChecksumConfig(ChecksumConfig checksumConfig)
The config related to checksum used for the meta request. SeeChecksumConfig
for details.- Parameters:
checksumConfig
- The checksum config used for the meta request- Returns:
- this
-
getChecksumConfig
public ChecksumConfig getChecksumConfig()
-
withChecksumAlgorithm
public S3MetaRequestOptions withChecksumAlgorithm(ChecksumAlgorithm checksumAlgorithm)
Deprecated.Please usewithChecksumConfig(ChecksumConfig)
instead. Specify the checksum algorithm to use use for put requests, if unset defaults to NONE and no checksum will be calculated. The location of the checksum will be default to trailer.- Parameters:
checksumAlgorithm
- the checksum algorithm to use use for put requests- Returns:
- this
-
getChecksumAlgorithm
public ChecksumAlgorithm getChecksumAlgorithm()
Deprecated.- Returns:
- the checksum algorithm to use use for put requests
-
withValidateChecksum
public S3MetaRequestOptions withValidateChecksum(boolean validateChecksum)
Deprecated.Please usewithChecksumConfig(ChecksumConfig)
instead. validateChecksum defaults to false, if set to true, it will cause the client to compare a streamed calculation of the objects checksum to a remotely stored checksum assigned to the object if one exists. The checksumValidated field passed in parameter of the finished callback will inform the user if validation ocurred. A mismatch will result in a AWS_ERROR_S3_RESPONSE_CHECKSUM_MISMATCH error- Parameters:
validateChecksum
- Validate the checksum of response if server provides.- Returns:
- this
-
getValidateChecksum
public boolean getValidateChecksum()
Deprecated.- Returns:
- Validate the checksum of response if server provides.
-
withHttpRequest
public S3MetaRequestOptions withHttpRequest(HttpRequest httpRequest)
Set the initial HTTP request. Note: When uploading a file, you can get better performance by settingwithRequestFilePath(java.nio.file.Path)
instead of setting a body stream on the HttpRequest. (If both are set, the file path is used and body stream is ignored)- Parameters:
httpRequest
- initial HTTP request message.- Returns:
- this
-
getHttpRequest
public HttpRequest getHttpRequest()
-
withRequestFilePath
public S3MetaRequestOptions withRequestFilePath(Path requestFilePath)
If set, this file is sent as the request's body, and thewithHttpRequest(software.amazon.awssdk.crt.http.HttpRequest)
body stream is ignored. This can give better upload performance than sending data using the body stream.- Parameters:
requestFilePath
- path to file to send as the request's body.- Returns:
- this
-
getRequestFilePath
public Path getRequestFilePath()
-
withResponseHandler
public S3MetaRequestOptions withResponseHandler(S3MetaRequestResponseHandler responseHandler)
-
getResponseHandler
public S3MetaRequestResponseHandler getResponseHandler()
-
withCredentialsProvider
public S3MetaRequestOptions withCredentialsProvider(CredentialsProvider credentialsProvider)
Deprecated.Please usewithSigningConfig(AwsSigningConfig)
instead. The credentials provider will be used to create the signing Config to override the client level config. The client config will be used.- Parameters:
credentialsProvider
- provide credentials for signing.- Returns:
- this
-
getCredentialsProvider
public CredentialsProvider getCredentialsProvider()
-
withSigningConfig
public S3MetaRequestOptions withSigningConfig(AwsSigningConfig signingConfig)
The configuration related to signing used by S3 client. It will override the client level configuration if provided. `AwsSigningConfig.getDefaultS3SigningConfig(region, credentialsProvider);` can be used as helper to create the default configuration to be used for S3. If not set, the client configuration will be used. If set: - All fields are optional. The credentials will be resolve from client if not set. - S3 Client will derive the right config for signing process based on this. Notes: - For SIGV4_S3EXPRESS, S3 client will use the credentials in the config to derive the S3Express credentials that are used in the signing process. - Client may make modifications to signing config before passing it on to signer.- Parameters:
signingConfig
- configuration related to signing via an AWS signing process.- Returns:
- this
-
getSigningConfig
public AwsSigningConfig getSigningConfig()
-
withEndpoint
public S3MetaRequestOptions withEndpoint(URI endpoint)
-
getEndpoint
public URI getEndpoint()
-
withResumeToken
public S3MetaRequestOptions withResumeToken(ResumeToken resumeToken)
-
getResumeToken
public ResumeToken getResumeToken()
-
withObjectSizeHint
public S3MetaRequestOptions withObjectSizeHint(Long objectSizeHint)
-
getObjectSizeHint
public Long getObjectSizeHint()
-
withResponseFilePath
public S3MetaRequestOptions withResponseFilePath(Path responseFilePath)
If set, this file will be used to write the response body to a file. And theHttpStreamResponseHandler.onResponseBody(software.amazon.awssdk.crt.http.HttpStream, byte[])
will not be invoked.withResponseFileOption(software.amazon.awssdk.crt.s3.S3MetaRequestOptions.ResponseFileOption)
configures the write behavior.- Parameters:
responseFilePath
- path to file to write response body to.- Returns:
- this
-
getResponseFilePath
public Path getResponseFilePath()
-
withResponseFileOption
public S3MetaRequestOptions withResponseFileOption(S3MetaRequestOptions.ResponseFileOption responseFileOption)
Sets the option for how to handle the response file when downloading an object from S3. This option is only applicable whenwithResponseFilePath(java.nio.file.Path)
is set. By default, the option is set toS3MetaRequestOptions.ResponseFileOption.CREATE_OR_REPLACE
.- Parameters:
responseFileOption
- The option for handling the response file.- Returns:
- this
-
getResponseFileOption
public S3MetaRequestOptions.ResponseFileOption getResponseFileOption()
-
withResponseFilePosition
public S3MetaRequestOptions withResponseFilePosition(long responseFilePosition)
Sets the position to start writing to the response file. This option is only applicable whenwithResponseFileOption(software.amazon.awssdk.crt.s3.S3MetaRequestOptions.ResponseFileOption)
is set toS3MetaRequestOptions.ResponseFileOption.WRITE_TO_POSITION
.- Parameters:
responseFilePosition
- The position to start writing to the response file.- Returns:
- this
-
getResponseFilePosition
public long getResponseFilePosition()
-
withResponseFileDeleteOnFailure
public S3MetaRequestOptions withResponseFileDeleteOnFailure(boolean responseFileDeleteOnFailure)
Sets whether to delete the response file on failure when downloading an object from S3. This option is only applicable when a response file path is set.- Parameters:
responseFileDeleteOnFailure
- True to delete the response file on failure, False to leave it as-is.- Returns:
- this
-
getResponseFileDeleteOnFailure
public boolean getResponseFileDeleteOnFailure()
-
-