Example usage for com.amazonaws.services.elasticbeanstalk.model S3Location S3Location

List of usage examples for com.amazonaws.services.elasticbeanstalk.model S3Location S3Location

Introduction

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

Prototype

public S3Location() 

Source Link

Document

Default constructor for S3Location object.

Usage

From source file:jetbrains.buildServer.runner.elasticbeanstalk.AWSClient.java

License:Apache License

/**
 * Uploads application revision archive to S3 bucket named s3BucketName with the provided key and bundle type.
 * <p>/*from   w  w w  .j  a  va  2 s.c  o  m*/
 * For performing this operation target AWSClient must have corresponding S3 permissions.
 *
 * @param skipDuplicateVersions if the application version already exists, do we error out?
 * @param s3BucketName          valid S3 bucket name
 * @param s3ObjectKey           valid S3 object key
 */
void createApplicationVersion(@NotNull String applicationName, @NotNull String versionLabel,
        @NotNull Boolean skipDuplicateVersions, @NotNull String s3BucketName, @NotNull String s3ObjectKey) {
    try {
        myListener.createVersionStarted(applicationName, versionLabel, s3BucketName, s3ObjectKey);
        S3Location location = new S3Location().withS3Bucket(s3BucketName).withS3Key(s3ObjectKey);
        CreateApplicationVersionRequest request = new CreateApplicationVersionRequest(applicationName,
                versionLabel).withSourceBundle(location);

        if (skipDuplicateVersions && doesApplicationVersionExist(applicationName, versionLabel)) {
            myListener.createVersionSkipped(applicationName, versionLabel);
        } else {
            myElasticBeanstalkClient.createApplicationVersion(request);
            myListener.createVersionFinished(applicationName, versionLabel, s3BucketName, s3ObjectKey);
        }

    } catch (Throwable t) {
        processFailure(t);
    }
}