Class CopyObject

java.lang.Object
org.cdlib.mrt.s3v2.action.CopyObject

public class CopyObject extends Object
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 Details

    • logger

      protected static final org.apache.logging.log4j.Logger logger
    • getSSM

      public static GetSSM 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 bucket
      objectKey - the key (name) of the object to be copied
      toBucket - the name of the destination S3 bucket
      Returns:
      a CompletableFuture that completes with the copy result as a String
      Throws:
      RuntimeException - if the URL could not be encoded or an S3 exception occurred during the copy
    • copyObject

      public 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)