Interface UploadDirectoryRequest.Builder
- All Superinterfaces:
Buildable
,CopyableBuilder<UploadDirectoryRequest.Builder,
,UploadDirectoryRequest> SdkBuilder<UploadDirectoryRequest.Builder,
UploadDirectoryRequest>
- Enclosing class:
UploadDirectoryRequest
-
Method Summary
Modifier and TypeMethodDescriptionThe name of the bucket to upload objects to.build()
An immutable object that is created from the properties that have been set on the builder.followSymbolicLinks
(Boolean followSymbolicLinks) Specifies whether to follow symbolic links when traversing the file tree inS3TransferManager.downloadDirectory(software.amazon.awssdk.transfer.s3.model.DownloadDirectoryRequest)
operationSpecifies the maximum number of levels of directories to visit.s3Delimiter
(String s3Delimiter) Specifies the delimiter.Specifies the key prefix to use for the objects.Specifies the source directory to upload.uploadFileRequestTransformer
(Consumer<UploadFileRequest.Builder> uploadFileRequestTransformer) Specifies a function used to transform theUploadFileRequest
s generated by thisUploadDirectoryRequest
.Methods inherited from interface software.amazon.awssdk.utils.builder.CopyableBuilder
copy
Methods inherited from interface software.amazon.awssdk.utils.builder.SdkBuilder
applyMutation
-
Method Details
-
source
Specifies the source directory to upload. The source directory must exist. Fle wildcards are not supported and treated literally. Hidden files/directories are visited.Note that the current user must have read access to all directories and files, otherwise
SecurityException
will be thrown.- Parameters:
source
- the source directory- Returns:
- This builder for method chaining.
-
bucket
The name of the bucket to upload objects to.- Parameters:
bucket
- the bucket name- Returns:
- This builder for method chaining.
-
s3Prefix
Specifies the key prefix to use for the objects. If not provided, files will be uploaded to the root of the bucketSee 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"- Parameters:
s3Prefix
- the key prefix- Returns:
- This builder for method chaining.
- See Also:
-
s3Delimiter
Specifies the delimiter. A delimiter causes a list operation to roll up all the keys that share a common prefix into a single summary list result. If not provided,"/"
will be used. See Organizing objects using prefixesNote: 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"- Parameters:
s3Delimiter
- the delimiter- Returns:
- This builder for method chaining.
- See Also:
-
followSymbolicLinks
Specifies whether to follow symbolic links when traversing the file tree inS3TransferManager.downloadDirectory(software.amazon.awssdk.transfer.s3.model.DownloadDirectoryRequest)
operationDefault to false
- Parameters:
followSymbolicLinks
- whether to follow symbolic links- Returns:
- This builder for method chaining.
-
maxDepth
Specifies the maximum number of levels of directories to visit. Must be positive. 1 means only the files directly within the provided source directory are visited.Default to
Integer.MAX_VALUE
- Parameters:
maxDepth
- the maximum number of directory levels to visit- Returns:
- This builder for method chaining.
-
uploadFileRequestTransformer
UploadDirectoryRequest.Builder uploadFileRequestTransformer(Consumer<UploadFileRequest.Builder> uploadFileRequestTransformer) Specifies a function used to transform theUploadFileRequest
s generated by thisUploadDirectoryRequest
. 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 createdPutObjectRequest
before it is passed to S3, or configure aTransferRequestOverrideConfiguration
.The factory receives the
UploadFileRequest
s 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.addTransferListener(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);
- Parameters:
uploadFileRequestTransformer
- A transformer to use for modifying the file-level upload requests before execution- Returns:
- This builder for method chaining
-
build
UploadDirectoryRequest build()Description copied from interface:SdkBuilder
An immutable object that is created from the properties that have been set on the builder.- Specified by:
build
in interfaceBuildable
- Specified by:
build
in interfaceSdkBuilder<UploadDirectoryRequest.Builder,
UploadDirectoryRequest> - Returns:
- an instance of T
-