Example usage for com.amazonaws.services.elasticbeanstalk.model ApplicationDescription getConfigurationTemplates

List of usage examples for com.amazonaws.services.elasticbeanstalk.model ApplicationDescription getConfigurationTemplates

Introduction

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

Prototype


public java.util.List<String> getConfigurationTemplates() 

Source Link

Document

The names of the configuration templates associated with this application.

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);/*from   w  w w .  ja  v a 2  s.  c  o m*/

        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);/*from www  .  ja v a 2s.  c o  m*/

        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;
}