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

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

Introduction

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

Prototype


public UpdateStackRequest withTemplateBody(String templateBody) 

Source Link

Document

Structure containing the template body with a minimum length of 1 byte and a maximum length of 51,200 bytes.

Usage

From source file:br.com.ingenieux.mojo.cloudformation.PushStackMojo.java

License:Apache License

private UpdateStackResult updateStack() throws Exception {
    UpdateStackRequest req = new UpdateStackRequest().withStackName(stackName)
            .withCapabilities(Capability.CAPABILITY_IAM);

    if (null != this.destinationS3Uri) {
        req.withTemplateURL(generateExternalUrl(this.destinationS3Uri));
    } else {//from  www  . j a v a2 s. c  om
        req.withTemplateBody(templateBody);
    }

    req.withNotificationARNs(notificationArns);

    req.withParameters(parameters);
    req.withResourceTypes(resourceTypes);
    req.withTags(tags);

    try {
        return getService().updateStack(req);
    } catch (AmazonServiceException exc) {
        if ("No updates are to be performed.".equals(exc.getErrorMessage())) {
            return null;
        }

        throw exc;
    }
}

From source file:com.carrotgarden.maven.aws.cfn.CarrotCloudForm.java

License:BSD License

public Stack stackUpdate() throws Exception {

    final UpdateStackRequest request = new UpdateStackRequest();

    request.withStackName(name);//from  ww  w . j av a 2s.c  o m
    request.withParameters(paramList);
    request.withTemplateBody(template);

    amazonClient.updateStack(request);

    final Stack stack = waitForStackUpdate();

    return stack;

}

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

License:Apache License

/**
 * Updates an existing stack by name.//from   w  ww .j  a  v  a  2s  . 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);
}