Example usage for com.amazonaws.services.elasticbeanstalk.model CreateEnvironmentRequest setSolutionStackName

List of usage examples for com.amazonaws.services.elasticbeanstalk.model CreateEnvironmentRequest setSolutionStackName

Introduction

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

Prototype


public void setSolutionStackName(String solutionStackName) 

Source Link

Document

This is an alternative to specifying a template name.

Usage

From source file:br.com.ingenieux.mojo.beanstalk.cmd.env.create.CreateEnvironmentCommand.java

License:Apache License

@Override
protected CreateEnvironmentResult executeInternal(CreateEnvironmentContext context) throws Exception {
    CreateEnvironmentRequest request = new CreateEnvironmentRequest();

    request.setApplicationName(context.getApplicationName());
    request.setCNAMEPrefix(parentMojo.ensureSuffixStripped(context.getCnamePrefix()));
    request.setDescription(context.getApplicationDescription());
    request.setEnvironmentName(context.getEnvironmentName());
    request.setTags(context.getTags());/* w ww .  j a  v  a 2s  .  com*/

    request.setOptionSettings(Arrays.asList(context.getOptionSettings()));
    request.setOptionsToRemove(Arrays.asList(context.getOptionsToRemove()));

    if ("Worker".equals(context.getEnvironmentTierName())) {
        if (contextDoesNotContainsEC2Role(context)) {
            parentMojo.getLog().warn(
                    "It is meaningless to launch a worker without an IAM Role. If you set in templateName, thats fine, but here's a warning for you");
        }
        ;
        context.setEnvironmentTierType(StringUtils.defaultString(context.getEnvironmentTierType(), "SQS/HTTP"));
        request.setCNAMEPrefix(null);
        request.setTier(new EnvironmentTier().withName(context.getEnvironmentTierName())
                .withType(context.getEnvironmentTierType()).withVersion(context.getEnvironmentTierVersion()));
    }

    if (StringUtils.isNotBlank(context.getTemplateName())) {
        request.setTemplateName(
                parentMojo.lookupTemplateName(context.getApplicationName(), context.getTemplateName()));
    } else if (StringUtils.isNotBlank(context.getSolutionStack())) {
        request.setSolutionStackName(context.getSolutionStack());
    }

    request.setVersionLabel(context.getVersionLabel());

    if (parentMojo.isVerbose()) {
        parentMojo.getLog()
                .info("Requesting createEnvironment w/ request: " + CredentialsUtil.redact("" + request));
    }

    return service.createEnvironment(request);
}

From source file:org.cloudml.connectors.BeanstalkConnector.java

License:Open Source License

public void createEnvironment(String applicationName, String domainName, String envName, String stackName) {
    CreateEnvironmentRequest cr = new CreateEnvironmentRequest();
    cr.setApplicationName(applicationName);
    cr.setEnvironmentName(envName);//  www. j  ava  2s .  c  om
    String stack = findSolutionStack(stackName);
    if (!stack.equals("")) {
        cr.setSolutionStackName(stack);
        CheckDNSAvailabilityResult r = checkDNS(domainName);
        if (r.isAvailable()) {
            cr.setCNAMEPrefix(domainName);
            CreateEnvironmentResult res = beanstalkClient.createEnvironment(cr);
            journal.log(Level.INFO, ">> Status of the environment creation: " + res.toString());
        } else {
            journal.log(Level.INFO, ">> Status of the environment creation: Domain Name already existing");
        }
    } else {
        journal.log(Level.INFO, ">> Status of the environment creation: This type of stack does not exist!");
    }
}

From source file:org.cloudml.connectors.BeanstalkConnector.java

License:Open Source License

public String createEnvironmentWithWar(String applicationName, String domainName, String envName,
        String stackName, int minRam, String warFile, String versionLabel) {
    String endPoint = "";
    prepareWar(new File(warFile), versionLabel, applicationName);
    CreateEnvironmentRequest cr = new CreateEnvironmentRequest();

    cr.setApplicationName(applicationName);
    cr.setEnvironmentName(envName);//from  w w w. j  av a2s .  c  o  m
    cr.setVersionLabel(versionLabel);
    String stack = findSolutionStack(stackName);
    if (!stack.equals("")) {
        cr.setSolutionStackName(stack);
        CheckDNSAvailabilityResult r = checkDNS(domainName);
        if (r.isAvailable()) {
            cr.setCNAMEPrefix(domainName);
            CreateEnvironmentResult res = beanstalkClient.createEnvironment(cr);
            endPoint = res.getEndpointURL();
            journal.log(Level.INFO, ">> Status of the environment creation: " + res.toString());
        } else {
            journal.log(Level.INFO, ">> Status of the environment creation: Domain Name already existing");
        }
    } else {
        journal.log(Level.INFO, ">> Status of the environment creation: This type of stack does not exist!");
    }
    return endPoint;
}