use of com.amazonaws.services.cloudformation.model.DeleteChangeSetRequest in project pipeline-aws-plugin by jenkinsci.
the class CloudFormationStack method executeChangeSet.
public void executeChangeSet(String changeSetName, long pollIntervallMillis) throws ExecutionException {
if (!this.changeSetHasChanges(changeSetName)) {
// If the change set has no changes 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 {
this.listener.getLogger().format("Executing change set %s for stack %s %n", changeSetName, this.stack);
final Waiter<DescribeStacksRequest> waiter;
if (this.exists()) {
waiter = this.client.waiters().stackUpdateComplete();
} else {
waiter = this.client.waiters().stackCreateComplete();
}
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);
}
}
Aggregations