List of usage examples for com.amazonaws.services.cloudformation.model DeleteChangeSetRequest DeleteChangeSetRequest
DeleteChangeSetRequest
From source file:de.taimos.pipeline.aws.cloudformation.CloudFormationStack.java
License:Apache License
public void executeChangeSet(String changeSetName, long pollIntervallMillis) throws ExecutionException { if (!this.changeSetHasChanges(changeSetName) || !this.exists()) { // If the change set has no changes or the stack was not prepared we should simply delete it. this.listener.getLogger().format("Deleting empty change set %s for stack %s %n", changeSetName, this.stack); DeleteChangeSetRequest req = new DeleteChangeSetRequest().withChangeSetName(changeSetName) .withStackName(this.stack); this.client.deleteChangeSet(req); } else {/* w w w. j a va 2s. co m*/ this.listener.getLogger().format("Executing change set %s for stack %s %n", changeSetName, this.stack); final Waiter<DescribeStacksRequest> waiter; if (this.isInReview()) { waiter = this.client.waiters().stackCreateComplete(); } else { waiter = this.client.waiters().stackUpdateComplete(); } ExecuteChangeSetRequest req = new ExecuteChangeSetRequest().withChangeSetName(changeSetName) .withStackName(this.stack); this.client.executeChangeSet(req); new EventPrinter(this.client, this.listener).waitAndPrintStackEvents(this.stack, waiter, pollIntervallMillis); this.listener.getLogger().format("Executed change set %s for stack %s %n", changeSetName, this.stack); } }