Example usage for com.amazonaws.services.elasticbeanstalk.model DescribeApplicationsResult getApplications

List of usage examples for com.amazonaws.services.elasticbeanstalk.model DescribeApplicationsResult getApplications

Introduction

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

Prototype


public java.util.List<ApplicationDescription> getApplications() 

Source Link

Document

This parameter contains a list of ApplicationDescription.

Usage

From source file:br.com.ingenieux.mojo.beanstalk.config.DescribeConfigurationTemplatesMojo.java

License:Apache License

@Override
protected Object executeInternal() throws Exception {
    DescribeApplicationsRequest req = new DescribeApplicationsRequest().withApplicationNames(applicationName);
    boolean bConfigurationTemplateDefined = StringUtils.isNotBlank(configurationTemplate);

    DescribeApplicationsResult apps = getService().describeApplications(req);

    List<ApplicationDescription> applications = apps.getApplications();

    if (applications.isEmpty()) {
        String errorMessage = "Application ('" + applicationName + "') not found!";

        getLog().warn(errorMessage);/* w w  w  .j a  v a2 s. c  om*/

        throw new MojoFailureException(errorMessage);
    }

    ApplicationDescription desc = applications.get(0);

    List<String> configTemplates = desc.getConfigurationTemplates();

    if (bConfigurationTemplateDefined) {
        describeConfigurationTemplate(configurationTemplate);
    } else {
        for (String availConfigTemplate : configTemplates) {
            describeConfigurationTemplate(availConfigTemplate);
        }
    }

    return null;
}

From source file:br.com.ingenieux.mojo.beanstalk.config.ListConfigurationTemplatesMojo.java

License:Apache License

@Override
protected Object executeInternal() throws MojoExecutionException, MojoFailureException {
    DescribeApplicationsRequest req = new DescribeApplicationsRequest().withApplicationNames(applicationName);

    DescribeApplicationsResult apps = getService().describeApplications(req);

    List<ApplicationDescription> applications = apps.getApplications();

    if (applications.isEmpty()) {
        String errorMessage = "Application ('" + applicationName + "') not found!";

        getLog().warn(errorMessage);//  w  ww  . j av  a  2s  .  com

        throw new MojoFailureException(errorMessage);
    }

    ApplicationDescription desc = applications.get(0);

    List<String> configTemplates = desc.getConfigurationTemplates();

    getLog().info(format("There are %d config templates", configTemplates.size()));

    return configTemplates;
}

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

License:Apache License

@TaskAction
public void createApplication() {
    // to enable conventionMappings feature
    String appName = getAppName();
    String appDesc = getAppDesc();

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

    DescribeApplicationsResult existingApps = eb
            .describeApplications(new DescribeApplicationsRequest().withApplicationNames(appName));
    if (existingApps.getApplications().isEmpty()) {
        eb.createApplication(//from  w w w.j a  v  a 2s  .  c o m
                new CreateApplicationRequest().withApplicationName(appName).withDescription(appDesc));
        getLogger().info("application " + appName + " (" + appDesc + ") created");
    } else {
        eb.updateApplication(
                new UpdateApplicationRequest().withApplicationName(appName).withDescription(appDesc));
        getLogger().info("application " + appName + " (" + appDesc + ") updated");
    }
}