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

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

Introduction

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

Prototype


public UpdateStackRequest withStackName(String stackName) 

Source Link

Document

The name or unique stack ID of the stack to update.

Usage

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);
    request.withParameters(paramList);/*from   w  w w  . j av a 2s .  co  m*/
    request.withTemplateBody(template);

    amazonClient.updateStack(request);

    final Stack stack = waitForStackUpdate();

    return stack;

}

From source file:de.taimos.pipeline.aws.cloudformation.CloudFormationStack.java

License:Apache License

public void update(String templateBody, String templateUrl, Collection<Parameter> params, Collection<Tag> tags,
        long pollIntervallMillis, String roleArn) throws ExecutionException {
    try {//from  w w  w. j a  v a2s. c  o m
        UpdateStackRequest req = new UpdateStackRequest();
        req.withStackName(this.stack).withCapabilities(Capability.CAPABILITY_IAM,
                Capability.CAPABILITY_NAMED_IAM);

        if (templateBody != null && !templateBody.isEmpty()) {
            req.setTemplateBody(templateBody);
        } else if (templateUrl != null && !templateUrl.isEmpty()) {
            req.setTemplateURL(templateUrl);
        } else {
            req.setUsePreviousTemplate(true);
        }

        req.withParameters(params).withTags(tags).withRoleARN(roleArn);

        this.client.updateStack(req);

        new EventPrinter(this.client, this.listener).waitAndPrintStackEvents(this.stack,
                this.client.waiters().stackUpdateComplete(), pollIntervallMillis);

        this.listener.getLogger().format("Updated CloudFormation stack %s %n", this.stack);

    } catch (AmazonCloudFormationException e) {
        if (e.getMessage().contains("No updates are to be performed")) {
            this.listener.getLogger().format("No updates were needed for CloudFormation stack %s %n",
                    this.stack);
            return;
        }
        this.listener.getLogger().format("Failed to update CloudFormation stack %s %n", this.stack);
        throw e;
    }
}