public static interface UploadDirectoryRequest.Builder extends CopyableBuilder<UploadDirectoryRequest.Builder,UploadDirectoryRequest>
copyapplyMutationUploadDirectoryRequest.Builder source(Path source)
Note that the current user must have read access to all directories and files,
otherwise SecurityException will be thrown.
source - the source directoryUploadDirectoryRequest.Builder bucket(String bucket)
bucket - the bucket nameUploadDirectoryRequest.Builder s3Prefix(String s3Prefix)
See Organizing objects using prefixes
Note: if the provided prefix ends with the same string as delimiter, it will get "normalized" when generating the key name. For example, assuming the prefix provided is "foo/" and the delimiter is "/" and the source directory has the following structure:
|- test
|- obj1.txt
|- obj2.txt
the object keys will be "foo/obj1.txt" and "foo/obj2.txt" as apposed to "foo//obj1.txt" and "foo//obj2.txt"s3Prefix - the key prefixs3Delimiter(String)UploadDirectoryRequest.Builder s3Delimiter(String s3Delimiter)
"/" will be used.
See Organizing objects using
prefixes
Note: if the provided prefix ends with the same string as delimiter, it will get "normalized" when generating the key name. For example, assuming the prefix provided is "foo/" and the delimiter is "/" and the source directory has the following structure:
|- test
|- obj1.txt
|- obj2.txt
the object keys will be "foo/obj1.txt" and "foo/obj2.txt" as apposed to "foo//obj1.txt" and "foo//obj2.txt"s3Delimiter - the delimiters3Prefix(String)UploadDirectoryRequest.Builder followSymbolicLinks(Boolean followSymbolicLinks)
S3TransferManager.downloadDirectory(software.amazon.awssdk.transfer.s3.model.DownloadDirectoryRequest) operation
Default to false
followSymbolicLinks - whether to follow symbolic linksUploadDirectoryRequest.Builder maxDepth(Integer maxDepth)
Default to Integer.MAX_VALUE
maxDepth - the maximum number of directory levels to visitUploadDirectoryRequest.Builder uploadFileRequestTransformer(Consumer<UploadFileRequest.Builder> uploadFileRequestTransformer)
UploadFileRequests generated by this UploadDirectoryRequest.
The provided function is called once for each file that is uploaded, allowing you to modify the paths resolved by
TransferManager on a per-file basis, modify the created PutObjectRequest before it is passed to S3, or
configure a TransferRequestOverrideConfiguration.
The factory receives the UploadFileRequests created by Transfer Manager for each file in the directory
being uploaded, and returns a (potentially modified) UploadFileRequest.
Usage Example:
// Add a LoggingTransferListener to every transfer within the upload directory request
UploadDirectoryOverrideConfiguration directoryUploadConfiguration =
UploadDirectoryOverrideConfiguration.builder()
.uploadFileRequestTransformer(request -> request.addTransferListenerf(LoggingTransferListener.create())
.build();
UploadDirectoryRequest request =
UploadDirectoryRequest.builder()
.source(Paths.get("."))
.bucket("bucket")
.prefix("prefix")
.overrideConfiguration(directoryUploadConfiguration)
.build()
UploadDirectoryTransfer uploadDirectory = transferManager.uploadDirectory(request);
// Wait for the transfer to complete
CompletedUploadDirectory completedUploadDirectory = uploadDirectory.completionFuture().join();
// Print out the failed uploads
completedUploadDirectory.failedUploads().forEach(System.out::println);
uploadFileRequestTransformer - A transformer to use for modifying the file-level upload requests before executionUploadDirectoryRequest build()
build in interface Buildablebuild in interface SdkBuilder<UploadDirectoryRequest.Builder,UploadDirectoryRequest>Copyright © 2023. All rights reserved.