Package org.cdlib.mrt.s3v2.action
Class CopyObject
java.lang.Object
org.cdlib.mrt.s3v2.action.CopyObject
Before running this Java V2 code example, set up your development
environment, including your credentials.
For more information, see the following documentation topic:
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CompletableFuture<String>
copyBucketObjectAsync
(software.amazon.awssdk.services.s3.S3AsyncClient s3AsyncClient, String fromBucket, String objectKey, String toBucket) Asynchronously copies an object from one S3 bucket to another.static String
copyObject
(software.amazon.awssdk.services.s3.S3AsyncClient s3AsyncClient, String bucketName, String key, String destinationBucket, String destinationKey, software.amazon.awssdk.services.s3.model.StorageClass targetStorageClass)
-
Field Details
-
logger
protected static final org.apache.logging.log4j.Logger logger -
getSSM
-
-
Constructor Details
-
CopyObject
public CopyObject()
-
-
Method Details
-
copyBucketObjectAsync
public static CompletableFuture<String> copyBucketObjectAsync(software.amazon.awssdk.services.s3.S3AsyncClient s3AsyncClient, String fromBucket, String objectKey, String toBucket) Asynchronously copies an object from one S3 bucket to another.- Parameters:
fromBucket
- the name of the source S3 bucketobjectKey
- the key (name) of the object to be copiedtoBucket
- the name of the destination S3 bucket- Returns:
- a
CompletableFuture
that completes with the copy result as aString
- Throws:
RuntimeException
- if the URL could not be encoded or an S3 exception occurred during the copy
-
copyObject
-