use of org.jclouds.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class S3BucketDeletion method main.
public static void main(String[] args) throws Exception {
final String USAGE = "\n" + "Usage:\n" + " <bucket>\n\n" + "Where:\n" + " bucket - the bucket to delete (for example, bucket1). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String bucket = args[0];
Region region = Region.US_WEST_2;
S3Client s3 = S3Client.builder().region(region).build();
listAllObjects(s3, bucket);
s3.close();
}
use of org.jclouds.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class S3Cors method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <bucketName> <accountId> \n\n" + "Where:\n" + " bucketName - the Amazon S3 bucket to upload an object into.\n" + " accountId - the id of the account that owns the Amazon S3 bucket.\n";
;
String bucketName = args[0];
String accountId = args[1];
Region region = Region.US_EAST_1;
S3Client s3 = S3Client.builder().region(region).build();
setCorsInformation(s3, bucketName, accountId);
getBucketCorsInformation(s3, bucketName, accountId);
deleteBucketCorsInformation(s3, bucketName, accountId);
s3.close();
}
use of org.jclouds.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class SetAcl method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <bucketName> <id> \n\n" + "Where:\n" + " bucketName - the Amazon S3 bucket to grant permissions on. \n" + " id - the ID of the owner of this bucket (you can get this value from the AWS Management Console).\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String bucketName = args[0];
String id = args[1];
System.out.format("Setting access \n");
System.out.println(" in bucket: " + bucketName);
Region region = Region.US_WEST_2;
S3Client s3 = S3Client.builder().region(region).build();
setBucketAcl(s3, bucketName, id);
System.out.println("Done!");
s3.close();
}
use of org.jclouds.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class SetBucketPolicy method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <bucketName> <polFile>\n\n" + "Where:\n" + " bucketName - the Amazon S3 bucket to set the policy on.\n" + " polFile - a JSON file containing the policy (see the Amazon S3 Readme for an example). \n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String bucketName = args[0];
String polFile = args[1];
String policyText = getBucketPolicyFromFile(polFile);
Region region = Region.US_EAST_1;
S3Client s3 = S3Client.builder().region(region).build();
setPolicy(s3, bucketName, policyText);
s3.close();
}
use of org.jclouds.s3.S3Client in project aws-doc-sdk-examples by awsdocs.
the class PutBucketLogging method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <bucketName> <targetBucket> \n\n" + "Where:\n" + " bucketName - the Amazon S3 bucket to upload an object into.\n" + " targetBucket - the target bucket .\n";
if (args.length != 3) {
System.out.println(USAGE);
System.exit(1);
}
String bucketName = args[0];
String targetBucket = args[1];
Region region = Region.US_WEST_2;
S3Client s3 = S3Client.builder().region(region).build();
setlogRequest(s3, bucketName, targetBucket);
s3.close();
}
Aggregations