本文整理汇总了Java中com.amazonaws.services.s3.AmazonS3Client.createBucket方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonS3Client.createBucket方法的具体用法?Java AmazonS3Client.createBucket怎么用?Java AmazonS3Client.createBucket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.s3.AmazonS3Client
的用法示例。
在下文中一共展示了AmazonS3Client.createBucket方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@Before
public void setup() throws UnsupportedEncodingException, IOException {
/*
* Patch the handler to use this test's factory which produces a mock client.
*/
S3MockClientFactory f;
try {
f = new S3MockClientFactory(tmpFolder);
} catch (Exception e) {
throw new RuntimeException("unable to start s3proxy", e);
}
AmazonS3Client client = f.newInstance();
client.createBucket(S3_BUCKET);
this.clientFactory = f;
/*
* Upload config file
*/
String payload = IOUtils.toString(new InputStreamReader(
this.getClass().getResourceAsStream("/config/handler_config.json"), "UTF-8"));
client.putObject(S3_BUCKET, "bender/config.json", payload);
/*
* Export config file as env var
*/
envVars.set("BENDER_CONFIG", "s3://" + S3_BUCKET + "/bender/config.json");
}
示例2: createBucket
import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@BeforeClass
public static void createBucket() {
// credentials need to be set in local environment
// see http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html
final AmazonS3Client amazonS3Client = new AmazonS3Client();
amazonS3Client.createBucket(bucketName);
}