Search in sources :

Example 11 with Bucket

use of com.talend.shaded.com.amazonaws.services.s3.model.Bucket in project camel by apache.

the class S3Producer method listBuckets.

private void listBuckets(AmazonS3 s3Client, Exchange exchange) {
    List<Bucket> bucketsList = s3Client.listBuckets();
    Message message = getMessageForResponse(exchange);
    message.setBody(bucketsList);
}
Also used : Message(org.apache.camel.Message) Bucket(com.amazonaws.services.s3.model.Bucket)

Example 12 with Bucket

use of com.talend.shaded.com.amazonaws.services.s3.model.Bucket in project camel by apache.

the class AmazonS3ClientMock method createBucket.

@Override
public Bucket createBucket(CreateBucketRequest createBucketRequest) throws AmazonClientException, AmazonServiceException {
    if ("nonExistingBucket".equals(createBucketRequest.getBucketName())) {
        nonExistingBucketCreated = true;
    }
    Bucket bucket = new Bucket();
    bucket.setName(createBucketRequest.getBucketName());
    bucket.setCreationDate(new Date());
    bucket.setOwner(new Owner("c2efc7302b9011ba9a78a92ac5fd1cd47b61790499ab5ddf5a37c31f0638a8fc ", "Christian Mueller"));
    return bucket;
}
Also used : Owner(com.amazonaws.services.s3.model.Owner) Bucket(com.amazonaws.services.s3.model.Bucket) Date(java.util.Date)

Example 13 with Bucket

use of com.talend.shaded.com.amazonaws.services.s3.model.Bucket in project aws-doc-sdk-examples by awsdocs.

the class CreateBucket method createBucket.

public static Bucket createBucket(String bucket_name) {
    final AmazonS3 s3 = AmazonS3ClientBuilder.defaultClient();
    Bucket b = null;
    if (s3.doesBucketExist(bucket_name)) {
        System.out.format("Bucket %s already exists.\n", bucket_name);
        b = getBucket(bucket_name);
    } else {
        try {
            b = s3.createBucket(bucket_name);
        } catch (AmazonS3Exception e) {
            System.err.println(e.getErrorMessage());
        }
    }
    return b;
}
Also used : AmazonS3(com.amazonaws.services.s3.AmazonS3) Bucket(com.amazonaws.services.s3.model.Bucket) AmazonS3Exception(com.amazonaws.services.s3.model.AmazonS3Exception)

Example 14 with Bucket

use of com.talend.shaded.com.amazonaws.services.s3.model.Bucket in project Synapse-Stack-Builder by Sage-Bionetworks.

the class StackConfigurationSetup method setupMainFileBucket.

/**
 * Sets up the main S3 bucket (if not already exist) for storing app data.
 */
public void setupMainFileBucket() {
    String bucketName = config.getMainFileS3BucketName();
    Bucket bucket = client.createBucket(bucketName);
    resources.setMainFileS3Bucket(bucket);
}
Also used : Bucket(com.amazonaws.services.s3.model.Bucket)

Example 15 with Bucket

use of com.talend.shaded.com.amazonaws.services.s3.model.Bucket in project Synapse-Stack-Builder by Sage-Bionetworks.

the class StackConfigurationSetup method setupAndUploadStackConfig.

/**
 * Builds and uploads the Stack configuration file used by the beanstalk instances.
 * @throws IOException
 */
public void setupAndUploadStackConfig() throws IOException {
    // Fist make sure the bucket exists
    String bucketName = config.getStackConfigS3BucketName();
    log.info("Creating S3 Bucket: " + bucketName);
    // This call is idempotent and will only actually create the bucket if it does not already exist.
    Bucket bucket = client.createBucket(bucketName);
    // This is the final property file that will be uploaded to S3.
    Properties props = createConfigProperties();
    // Write to a temp file that will get deleted.
    File temp = File.createTempFile("TempProps", ".properties");
    saveUploadDelete(bucketName, props, temp);
}
Also used : Bucket(com.amazonaws.services.s3.model.Bucket) Properties(java.util.Properties) File(java.io.File)

Aggregations

Bucket (com.amazonaws.services.s3.model.Bucket)22 AmazonS3 (com.amazonaws.services.s3.AmazonS3)7 AmazonS3Exception (com.amazonaws.services.s3.model.AmazonS3Exception)4 HashSet (java.util.HashSet)4 Test (org.junit.Test)4 AmazonS3Client (com.amazonaws.services.s3.AmazonS3Client)3 OperationContext (com.vmware.xenon.common.OperationContext)3 AmazonClientException (com.amazonaws.AmazonClientException)2 Regions (com.amazonaws.regions.Regions)2 BucketTaggingConfiguration (com.amazonaws.services.s3.model.BucketTaggingConfiguration)2 ObjectListing (com.amazonaws.services.s3.model.ObjectListing)2 S3Object (com.amazonaws.services.s3.model.S3Object)2 EnumerationAction (com.vmware.photon.controller.model.adapterapi.EnumerationAction)2 AWSConstants (com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants)2 AWSResourceType (com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSResourceType)2 AwsClientType (com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AwsClientType)2 BUCKET_OWNER_NAME (com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.BUCKET_OWNER_NAME)2 STORAGE_TYPE_S3 (com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.STORAGE_TYPE_S3)2 AWSConstants.getQueryResultLimit (com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.getQueryResultLimit)2 AWSUriPaths (com.vmware.photon.controller.model.adapters.awsadapter.AWSUriPaths)2