Search in sources :

Example 1 with ExecuteChangeSetRequest

use of com.amazonaws.services.cloudformation.model.ExecuteChangeSetRequest 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);
    }
}
Also used : DescribeStacksRequest(com.amazonaws.services.cloudformation.model.DescribeStacksRequest) ExecuteChangeSetRequest(com.amazonaws.services.cloudformation.model.ExecuteChangeSetRequest) DeleteChangeSetRequest(com.amazonaws.services.cloudformation.model.DeleteChangeSetRequest)

Aggregations

DeleteChangeSetRequest (com.amazonaws.services.cloudformation.model.DeleteChangeSetRequest)1 DescribeStacksRequest (com.amazonaws.services.cloudformation.model.DescribeStacksRequest)1 ExecuteChangeSetRequest (com.amazonaws.services.cloudformation.model.ExecuteChangeSetRequest)1