Example usage for com.amazonaws.services.cloudformation.model UpdateStackRequest withUsePreviousTemplate

List of usage examples for com.amazonaws.services.cloudformation.model UpdateStackRequest withUsePreviousTemplate

Introduction

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

Prototype


public UpdateStackRequest withUsePreviousTemplate(Boolean usePreviousTemplate) 

Source Link

Document

Reuse the existing template that is associated with the stack that you are updating.

Usage

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

License:Apache License

/**
 * Updates an existing stack by name./* w  ww. j  av  a2s  .c  o  m*/
 *
 * @param stackId Stack ID.
 * @param parameters Input parameters.
 * @param templatePath Path to the JSON template of the stack.
 */
public void updateStack(final String stackId, final Map<String, String> parameters, final String templatePath,
        final boolean iamCapabilities) {
    final UpdateStackRequest request = new UpdateStackRequest().withStackName(stackId)
            .withParameters(convertParameters(parameters));

    if (StringUtils.isNotBlank(templatePath)) {
        request.withTemplateBody(getTemplateText(templatePath));
    } else {
        request.withUsePreviousTemplate(true);
    }

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

    cloudFormationClient.updateStack(request);
}