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

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

Introduction

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

Prototype


public void setOptionSettings(java.util.Collection<ConfigurationOptionSetting> optionSettings) 

Source Link

Document

If specified, AWS Elastic Beanstalk sets the specified configuration options to the requested value in the configuration set for the new environment.

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

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