Example usage for com.amazonaws.services.simpleworkflow.model RequestCancelWorkflowExecutionRequest setRunId

List of usage examples for com.amazonaws.services.simpleworkflow.model RequestCancelWorkflowExecutionRequest setRunId

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleworkflow.model RequestCancelWorkflowExecutionRequest setRunId.

Prototype


public void setRunId(String runId) 

Source Link

Document

The runId of the workflow execution to cancel.

Usage

From source file:com.eucalyptus.cloudformation.StackAdminUtils.java

License:Open Source License

public static void cancelWorkflows(String stackId) throws CloudFormationException, AuthException {
    StackEntity stackEntity = StackEntityManager.getNonDeletedStackById(stackId);
    if (stackEntity == null) {
        throw new ValidationErrorException("Can not find undeleted stack " + stackId);
    }//from   w ww .jav  a2  s.com
    String stackAccountId = stackEntity.getAccountId();
    AmazonSimpleWorkflow simpleWorkflowClient = Config
            .buildClient(CloudFormationAWSCredentialsProvider.CloudFormationUserSupplier.INSTANCE);
    try {
        // first cancel all outstanding workflows
        for (StackWorkflowEntity stackWorkflowEntity : StackWorkflowEntityManager
                .getStackWorkflowEntities(stackId)) {
            try {
                RequestCancelWorkflowExecutionRequest requestCancelWorkflowExecutionRequest = new RequestCancelWorkflowExecutionRequest();
                requestCancelWorkflowExecutionRequest.setWorkflowId(stackWorkflowEntity.getWorkflowId());
                requestCancelWorkflowExecutionRequest.setRunId(stackWorkflowEntity.getRunId());
                requestCancelWorkflowExecutionRequest.setDomain(stackWorkflowEntity.getDomain());
                simpleWorkflowClient.requestCancelWorkflowExecution(requestCancelWorkflowExecutionRequest);
            } catch (UnknownResourceException ex) {
                ; // don't bother
            }
        }
    } finally {
        simpleWorkflowClient.shutdown();
    }
}