Example usage for com.amazonaws.services.elasticbeanstalk.model CreateApplicationVersionResult getApplicationVersion

List of usage examples for com.amazonaws.services.elasticbeanstalk.model CreateApplicationVersionResult getApplicationVersion

Introduction

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

Prototype


public ApplicationVersionDescription getApplicationVersion() 

Source Link

Document

The ApplicationVersionDescription of the application version.

Usage

From source file:br.com.ingenieux.mojo.beanstalk.version.CreateApplicationVersionMojo.java

License:Apache License

protected Object executeInternal() throws MojoExecutionException {
    if (skipExisting) {
        if (versionLabelExists()) {
            getLog().info("VersionLabel " + versionLabel
                    + " already exists. Skipping creation of new application-version");

            return null;
        }// w  w  w .  j a va2  s . com
    }

    CreateApplicationVersionRequest request = new CreateApplicationVersionRequest();

    request.setApplicationName(applicationName);
    request.setDescription(versionDescription);
    request.setAutoCreateApplication(autoCreateApplication);

    if (StringUtils.isNotBlank(s3Bucket) && StringUtils.isNotBlank(s3Key)) {
        request.setSourceBundle(new S3Location(s3Bucket, s3Key));
    }

    request.setDescription(versionDescription);

    request.setVersionLabel(versionLabel);

    CreateApplicationVersionResult result = getService().createApplicationVersion(request);

    return result.getApplicationVersion();
}

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   www .  j a v a 2 s  .c o  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()));
}