Example usage for com.amazonaws.services.elasticbeanstalk.model CreateStorageLocationResult getS3Bucket

List of usage examples for com.amazonaws.services.elasticbeanstalk.model CreateStorageLocationResult getS3Bucket

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticbeanstalk.model CreateStorageLocationResult getS3Bucket.

Prototype


public String getS3Bucket() 

Source Link

Document

The name of the Amazon S3 bucket created.

Usage

From source file:br.com.ingenieux.jenkins.plugins.awsebdeployment.cmd.BuildAndUploadArchive.java

License:Apache License

@Override
public boolean perform() throws Exception {
    localArchive = getLocalFileObject(getRootFileObject());

    if (isBlank(getBucketName())) {
        log("bucketName not set. Calling createStorageLocation");

        final CreateStorageLocationResult storageLocation = getAwseb().createStorageLocation();

        log("Using s3 Bucket '%s'", storageLocation.getS3Bucket());

        setBucketName(storageLocation.getS3Bucket());
    }//from  ww  w. j  a va  2s .c o m

    setObjectKey(Utils.formatPath("%s/%s-%s.zip", getKeyPrefix(), getApplicationName(), getVersionLabel()));

    setS3ObjectPath("s3://" + Utils.formatPath("%s/%s", getBucketName(), getObjectKey()));

    log("Uploading file %s as %s", localArchive.getName(), getS3ObjectPath());

    getS3().putObject(getBucketName(), getObjectKey(), localArchive);

    return false;
}