use of uk.co.automatictester.lightning.lambda.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class GetObjectData method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <bucketName> <keyName> <path>\n\n" + "Where:\n" + " bucketName - the Amazon S3 bucket name. \n\n" + " keyName - the key name. \n\n" + " path - the path where the file is written to. \n\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String bucketName = args[0];
String keyName = args[1];
String path = args[2];
Region region = Region.US_EAST_1;
S3Client s3 = S3Client.builder().region(region).build();
getObjectBytes(s3, bucketName, keyName, path);
s3.close();
}
use of uk.co.automatictester.lightning.lambda.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class ManagingObjectTags method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <bucketName> <objectKey> <objectPath> \n\n" + "Where:\n" + " bucketName - the Amazon S3 bucket.\n" + " objectKey - the object that a tag is applied (for example, book.pdf).\n" + " objectPath - the path where the file is located (for example, C:/AWS/book2.pdf). \n\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String bucketName = args[0];
String objectKey = args[1];
String objectPath = args[2];
System.out.println("Putting object " + objectKey + " into bucket " + bucketName);
System.out.println(" in bucket: " + bucketName);
Region region = Region.US_EAST_1;
S3Client s3 = S3Client.builder().region(region).build();
putS3ObjectTags(s3, bucketName, objectKey, objectPath);
updateObjectTags(s3, bucketName, objectKey);
s3.close();
}
use of uk.co.automatictester.lightning.lambda.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class PutObjectRetention method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <key> <bucketName> \n\n" + "Where:\n" + " key - the name of the object (for example, book.pdf). \n\n" + " bucketName - the Amazon S3 bucket name that contains the object (for example, bucket1). \n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String key = args[0];
String bucketName = args[1];
Region region = Region.US_WEST_2;
S3Client s3 = S3Client.builder().region(region).build();
setRentionPeriod(s3, key, bucketName);
s3.close();
}
use of uk.co.automatictester.lightning.lambda.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class CopyObject method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <objectKey> <fromBucket> <toBucket>\n\n" + "Where:\n" + " objectKey - the name of the object (for example, book.pdf).\n\n" + " fromBucket - the S3 bucket name that contains the object (for example, bucket1).\n" + " toBucket - the S3 bucket to copy the object to (for example, bucket2).\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String objectKey = args[0];
String fromBucket = args[1];
String toBucket = args[2];
System.out.format("Copying object %s from bucket %s to %s\n", objectKey, fromBucket, toBucket);
Region region = Region.US_EAST_1;
S3Client s3 = S3Client.builder().region(region).build();
copyBucketObject(s3, fromBucket, objectKey, toBucket);
s3.close();
}
use of uk.co.automatictester.lightning.lambda.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class CreateBucket method main.
public static void main(String[] args) throws URISyntaxException {
final String USAGE = "\n" + "Usage:\n" + " <bucketName> \n\n" + "Where:\n" + " bucketName - the name of the bucket to create. The bucket name must be unique, or an error occurs.\n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String bucketName = args[0];
System.out.format("Creating a bucket named %s\n", bucketName);
Region region = Region.US_EAST_1;
S3Client s3 = S3Client.builder().region(region).build();
createBucket(s3, bucketName);
s3.close();
}
Aggregations