Example usage for com.amazonaws.services.cloudformation.model CreateStackRequest getCapabilities

List of usage examples for com.amazonaws.services.cloudformation.model CreateStackRequest getCapabilities

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudformation.model CreateStackRequest getCapabilities.

Prototype


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

Source Link

Document

In some cases, you must explicitly acknowledge that your stack template contains certain capabilities in order for AWS CloudFormation to create the stack.

Usage

From source file:com.nike.cerberus.service.CloudFormationService.java

License:Apache License

/**
 * Creates a new stack.// w w  w  .ja v a2 s . c  o m
 *
 * @param name Stack name.
 * @param parameters Input parameters.
 * @param templatePath Classpath to the JSON template of the stack.
 * @return Stack ID
 */
public String createStack(final String name, final Map<String, String> parameters, final String templatePath,
        final boolean iamCapabilities) {
    logger.info(String.format("Executing the Cloud Formation: %s, Stack Name: %s", templatePath, name));

    final CreateStackRequest request = new CreateStackRequest().withStackName(name)
            .withParameters(convertParameters(parameters)).withTemplateBody(getTemplateText(templatePath));

    if (iamCapabilities) {
        request.getCapabilities().add("CAPABILITY_IAM");
    }

    final CreateStackResult result = cloudFormationClient.createStack(request);
    return result.getStackId();
}