本文整理汇总了Java中com.amazonaws.services.s3.AmazonS3.createBucket方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonS3.createBucket方法的具体用法?Java AmazonS3.createBucket怎么用?Java AmazonS3.createBucket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.s3.AmazonS3
的用法示例。
在下文中一共展示了AmazonS3.createBucket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: store
import com.amazonaws.services.s3.AmazonS3; //导入方法依赖的package包/类
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);
}
示例2: createSomeObjects
import com.amazonaws.services.s3.AmazonS3; //导入方法依赖的package包/类
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();
}
}