Example usage for com.amazonaws.services.elasticbeanstalk AWSElasticBeanstalk createApplicationVersion

List of usage examples for com.amazonaws.services.elasticbeanstalk AWSElasticBeanstalk createApplicationVersion

Introduction

In this page you can find the example usage for com.amazonaws.services.elasticbeanstalk AWSElasticBeanstalk createApplicationVersion.

Prototype

CreateApplicationVersionResult createApplicationVersion(
        CreateApplicationVersionRequest createApplicationVersionRequest);

Source Link

Document

Creates an application version for the specified application.

Usage

From source file:jp.classmethod.aws.gradle.elasticbeanstalk.AWSElasticBeanstalkCreateApplicationVersionTask.java

License:Apache License

@TaskAction
public void createVersion() {
    // to enable conventionMappings feature
    String appName = getAppName();
    String versionLabel = getVersionLabel();

    AwsBeanstalkPluginExtension ext = getProject().getExtensions().getByType(AwsBeanstalkPluginExtension.class);
    AWSElasticBeanstalk eb = ext.getClient();

    try {//from   ww w  . jav a  2  s  .  c  om
        eb.createApplicationVersion(new CreateApplicationVersionRequest().withApplicationName(appName)
                .withVersionLabel(versionLabel).withSourceBundle(new S3Location(getBucketName(), getKey())));
        getLogger().info("version " + versionLabel + " @ " + appName + " created");
    } catch (AmazonServiceException e) {
        if (!e.getMessage().contains("already exists.")) {
            throw e;
        }
        getLogger().warn("version " + versionLabel + " @ " + appName + " already exists.");
    }
}

From source file:org.xmlsh.aws.gradle.elasticbeanstalk.AWSElasticBeanstalkCreateApplicationVersionTask.java

License:BSD License

@TaskAction
public void createVersion() {
    // to enable conventionMappings feature
    String appName = getAppName();
    String versionLabel = getVersionLabel();

    AwsBeanstalkPluginExtension ext = getProject().getExtensions().getByType(AwsBeanstalkPluginExtension.class);
    AWSElasticBeanstalk eb = ext.getClient();

    try {/*w  ww.  java  2 s .c  o  m*/
        eb.createApplicationVersion(new CreateApplicationVersionRequest().withApplicationName(appName)
                .withVersionLabel(versionLabel).withSourceBundle(new S3Location(getBucketName(), getKey())));
        getLogger().info("version " + versionLabel + " @ " + appName + " created");
    } catch (AmazonServiceException e) {
        if (e.getMessage().endsWith("already exists.") == false) {
            throw e;
        }
        getLogger().warn("version " + versionLabel + " @ " + appName + " already exists.");
    }
}