}
@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.setOptionSettings(Arrays.asList(context.getOptionSettings()));
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("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));