@Override @Deprecated public Bucket createBucket(String bucketName, Region region) throws SdkClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
@Override @Deprecated public Bucket createBucket(String bucketName, String region) throws SdkClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
@Override public Bucket createBucket(String bucketName) throws SdkClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName)); }
@Override public Bucket createBucket(String bucketName, Region region) throws AmazonClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
@Override public Bucket createBucket(String bucketName, String region) throws AmazonClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
@Override public Bucket createBucket(String bucketName) throws AmazonClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName)); }
@Override @Deprecated public Bucket createBucket(String bucketName, String region) throws SdkClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
@Override public Bucket createBucket(String bucketName) throws AmazonClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName)); }
@Override public Bucket createBucket(String bucketName) throws SdkClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName)); }
@Override @Deprecated public Bucket createBucket(String bucketName, Region region) throws SdkClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
@Override public Bucket createBucket(String bucketName, Region region) throws AmazonClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
@Override public Bucket createBucket(String bucketName, String region) throws AmazonClientException, AmazonServiceException { return createBucket(new CreateBucketRequest(bucketName, region)); }
protected void validateBucket(AmazonS3Client client, String bucketName) { log.debug("Looking for bucket: " + bucketName); if (client.doesBucketExist(bucketName)) { log.debug("Found bucket '" + bucketName + "' Validating permissions"); validatePermissions(client, bucketName); } else { log.info("Creating bucket " + bucketName); // If we create the bucket, we "own" it and by default have the "fullcontrol" permission client.createBucket(bucketName); } }
public S3MockClientFactory(int port, String username, String pass) { try { this.s3.start(port, username, pass); } catch (IOException | InterruptedException | InvalidExitValueException | TimeoutException e) { throw new RuntimeException(e); } BasicAWSCredentials awsCredentials = new BasicAWSCredentials(username, pass); this.client = new AmazonS3Client(awsCredentials, new ClientConfiguration()); this.client.setEndpoint("http://127.0.0.1:" + port); this.client.createBucket(S3_BUCKET); }
private void createBucket(String bucketName) { AccessControlList configuration = null; try { configuration = s3Client.getBucketAcl(bucketName); } catch (Exception e) { LOG.info("Bucket " + bucketName + " does not exist."); } if (configuration == null) { Bucket bucket = s3Client.createBucket(bucketName); LOG.info("Created bucket " + bucket.getName() + " at " + bucket.getCreationDate()); } }
@Override public Bucket createBucket(String bucket) { checkNotBlank(bucket, "bucket"); checkArgument(!client.doesBucketExist(bucket), "bucket [%s] already exists"); return Bucket.copyOf(client.createBucket(bucket, region)); }
S3Mock api = S3Mock.create(8001, "/tmp/s3"); api.start(); AmazonS3Client client = new AmazonS3Client(new AnonymousAWSCredentials()); // use local API mock, not the AWS one client.setEndpoint("http://127.0.0.1:8001"); client.createBucket("testbucket"); client.putObject("testbucket", "file/name", "contents");
@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); }
@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); }
@BeforeClass public static void setUp() throws IOException { testFile1 = AWSTestUtils.createRandomFile(TEST_FILE_1, TESTFILE_SUFFIX); testFile2 = AWSTestUtils.createRandomFile(TEST_FILE_2, TESTFILE_SUFFIX); testFile3 = AWSTestUtils.createRandomFile(TEST_FILE_3, TESTFILE_SUFFIX); fileName1 = testFile1.getName(); fileName2 = testFile2.getName(); fileName3 = testFile3.getName(); client = new AmazonS3Client(); client.createBucket(BUCKET_NAME); }