new feature : abort an execution

This commit is contained in:
Vincent Behar 2011-07-06 17:29:48 +02:00
parent 59748a2481
commit d6b6ec3405
6 changed files with 239 additions and 0 deletions

View file

@ -22,10 +22,12 @@ import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.StringUtils;
import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
import org.rundeck.api.domain.RundeckAbort;
import org.rundeck.api.domain.RundeckExecution;
import org.rundeck.api.domain.RundeckJob;
import org.rundeck.api.domain.RundeckProject;
import org.rundeck.api.domain.RundeckExecution.ExecutionStatus;
import org.rundeck.api.parser.AbortParser;
import org.rundeck.api.parser.ExecutionParser;
import org.rundeck.api.parser.ExecutionsParser;
import org.rundeck.api.parser.JobParser;
@ -655,6 +657,22 @@ public class RundeckClient implements Serializable {
new ExecutionParser("result/executions/execution"));
}
/**
* Abort an execution (identified by the given ID). The execution should be running...
*
* @param executionId identifier of the execution - mandatory
* @return a {@link RundeckAbort} instance - won't be null
* @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID)
* @throws RundeckApiLoginException if the login failed
* @throws IllegalArgumentException if the executionId is null
*/
public RundeckAbort abortExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException,
IllegalArgumentException {
AssertUtil.notNull(executionId, "executionId is mandatory to abort an execution !");
return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString(), "/abort"),
new AbortParser("result/abort"));
}
public String getUrl() {
return url;
}