Search in sources :

Example 6 with HeadBucketRequest

use of software.amazon.awssdk.services.s3.model.HeadBucketRequest in project wildfly-camel by wildfly-extras.

the class S3Utils method createBucket.

@SuppressWarnings("unchecked")
public static void createBucket(AmazonS3Client client, String bucketName) throws Exception {
    client.createBucket(bucketName);
    HeadBucketRequest request = new HeadBucketRequest(bucketName);
    Waiter<HeadBucketRequest> waiter = client.waiters().bucketExists();
    Future<Void> future = waiter.runAsync(new WaiterParameters<HeadBucketRequest>(request), new NoOpWaiterHandler());
    future.get(1, TimeUnit.MINUTES);
}
Also used : HeadBucketRequest(com.amazonaws.services.s3.model.HeadBucketRequest) NoOpWaiterHandler(com.amazonaws.waiters.NoOpWaiterHandler)

Example 7 with HeadBucketRequest

use of software.amazon.awssdk.services.s3.model.HeadBucketRequest in project flink by apache.

the class AWSServicesTestUtils method createBucket.

public static void createBucket(S3AsyncClient s3Client, String bucketName) throws ExecutionException, InterruptedException {
    CreateBucketRequest bucketRequest = CreateBucketRequest.builder().bucket(bucketName).build();
    s3Client.createBucket(bucketRequest);
    HeadBucketRequest bucketRequestWait = HeadBucketRequest.builder().bucket(bucketName).build();
    try (final S3AsyncWaiter waiter = s3Client.waiter()) {
        waiter.waitUntilBucketExists(bucketRequestWait).get();
    }
}
Also used : S3AsyncWaiter(software.amazon.awssdk.services.s3.waiters.S3AsyncWaiter) HeadBucketRequest(software.amazon.awssdk.services.s3.model.HeadBucketRequest) CreateBucketRequest(software.amazon.awssdk.services.s3.model.CreateBucketRequest)

Aggregations

S3Waiter (software.amazon.awssdk.services.s3.waiters.S3Waiter)5 CreateBucketRequest (software.amazon.awssdk.services.s3.model.CreateBucketRequest)4 HeadBucketRequest (software.amazon.awssdk.services.s3.model.HeadBucketRequest)4 HeadBucketResponse (software.amazon.awssdk.services.s3.model.HeadBucketResponse)3 S3Exception (software.amazon.awssdk.services.s3.model.S3Exception)3 HeadBucketRequest (com.amazonaws.services.s3.model.HeadBucketRequest)1 NoOpWaiterHandler (com.amazonaws.waiters.NoOpWaiterHandler)1 S3AsyncWaiter (software.amazon.awssdk.services.s3.waiters.S3AsyncWaiter)1