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

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

Introduction

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

Prototype


public void setTags(java.util.Collection<Tag> tags) 

Source Link

Document

Specifies the tags applied to resources in the 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());

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

    if ("Worker".equals(context.getEnvironmentTierName())) {
        if (contextDoesNotContainsEC2Role(context)) {
            parentMojo.getLog().warn(/*from   ww  w  . ja v  a 2s .  c  o m*/
                    "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);
}