Java Code Examples for com.amazonaws.services.s3.AmazonS3.createBucket()

The following are Jave code examples for showing how to use createBucket() of the com.amazonaws.services.s3.AmazonS3 class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: radosgw-admin4j   File: Example.java   View Source Code Vote up 5 votes
private static void store(User user) {
  // Create bucket by the new user
  AmazonS3 s3 = createS3(user.getS3Credentials().get(0));
  String bucketName = "bucket-" + UUID.randomUUID().toString().toLowerCase();
  s3.createBucket(bucketName);

  // Transfer the bucket owner from the user just created to the administrator
  BucketInfo bucketInfo = RGW_ADMIN.getBucketInfo(bucketName).get();
  RGW_ADMIN.linkBucket(bucketName, bucketInfo.getId(), adminUserId);

  // Remove a bucket
  RGW_ADMIN.removeBucket(bucketName);
}
 
Example 2
Project: radosgw-admin4j   File: BaseTest.java   View Source Code Vote up 5 votes
protected static void createSomeObjects(AmazonS3 s3) {
  String bucketName = "bucket-" + UUID.randomUUID().toString().toLowerCase();
  s3.createBucket(bucketName);
  for (int i = 0; i < 3; i++) {

    s3.putObject(bucketName, "OBJECT-" + UUID.randomUUID(), createString(4096));
  }
  // Usage data are generated in the async way, hope it will be available after wait.
  try {
    Thread.sleep(5000);
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
}