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

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

Introduction

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

Prototype

public CreateApplicationVersionRequest(String applicationName, String versionLabel) 

Source Link

Document

Constructs a new CreateApplicationVersionRequest object.

Usage

From source file:com.tracermedia.maven.plugins.CreateVersionMojo.java

License:Open Source License

protected void createApplicationVersion(String applicationName, String versionLabel, String s3Bucket,
        String s3Key) {/*from   ww w  .j av a 2  s  .  co m*/
    final CreateApplicationVersionRequest versionRequest = new CreateApplicationVersionRequest(applicationName,
            versionLabel);

    if (s3Bucket != null && s3Key != null) {
        final S3Location location = new S3Location(s3Bucket, s3Key);
        versionRequest.setSourceBundle(location);
    } else {
        System.err.println("Warning: Deploying sample application because S3 location "
                + "is not specified. (Hint: s3Bucket, s3Key).");
    }

    final CreateApplicationVersionResult versionResult = getBeanstalkClient()
            .createApplicationVersion(versionRequest);

    System.out.println(String.format("Deployed application [%s/%s] to Amazon Beanstalk.",
            versionResult.getApplicationVersion().getApplicationName(),
            versionResult.getApplicationVersion().getVersionLabel()));
}

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>//  ww w  .j av  a2  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);
    }
}