Compare commits

...

32 commits

Author SHA1 Message Date
Greg Schueler
4d49ef39bd [maven-release-plugin] prepare for next development iteration 2014-11-25 11:04:29 -08:00
Greg Schueler
a299c12c39 [maven-release-plugin] prepare release rundeck-api-java-client-12.0 2014-11-25 11:04:25 -08:00
Greg Schueler
d612f3c88b text fix naming RunDeck to Rundeck 2014-11-25 10:59:27 -08:00
Greg Schueler
19527ea325 Fix creation of rundeck client in examples 2014-11-25 10:59:16 -08:00
Greg Schueler
68717ae864 Update download page 2014-11-25 10:56:45 -08:00
Greg Schueler
5bf4be0bc8 Update changelog for v 12.0 2014-11-25 10:38:49 -08:00
Greg Schueler
92d15c0748 Update to version 12.0-SNAPSHOT 2014-11-24 14:05:00 -08:00
Greg Schueler
eeaf4a3944 Merge pull request #18 from Sylvain-Bugat/pom-update
Http client upgrade to fix CVE-2014-3577
2014-11-24 14:02:44 -08:00
Sylvain Bugat
008a8c3ce4 Spell correction 2014-11-24 22:28:06 +01:00
Sylvain Bugat
c1a1f3c365 Deprecation fix apache.httpcomponents
fix deprecation due to apache.httpcomponents upgrade and fixing some
code warnings
2014-11-24 22:02:56 +01:00
Sylvain Bugat
b3839f089b Httpcomponents upgrade
4.1.2 -> 4.3.6: tested OK on unit tests and on RundeckMonitor
OWASP A9 fix know vulnérabilies:
CVE-2014-3577: org.apache.http.conn.ssl.AbstractVerifier in Apache
HttpComponents HttpClient before 4.3.5
2014-11-24 21:59:30 +01:00
Sylvain Bugat
ea5f82714d Add maven prerequisites for dependencies check
Maven plugin version upgrade 1.2 -> 2.1
Add dependencies-check-rules.xml to ignore unreleased versions
2014-11-23 15:42:14 +01:00
Greg Schueler
e548d640c0 Merge pull request #17 from rundeck/issue/apiv11-fix
Fix API v11 response issues
2014-11-10 13:38:13 -08:00
Greg Schueler
e98a3a0ad9 Add tests for api v11 responses 2014-11-10 12:09:06 -08:00
Greg Schueler
1f2ffeebac getExecution handles buggy xml wrapper 2014-11-10 12:08:39 -08:00
Greg Schueler
39fd86ae6d Trigger job handles buggy api v11 response 2014-11-10 11:16:01 -08:00
Greg Schueler
bceb1ec4c6 Refactor apiv11 result unwrap to utility class 2014-11-10 11:15:23 -08:00
Greg Schueler
8cc48ecd89 Test api v11 response for trigger job 2014-11-10 11:14:27 -08:00
Greg Schueler
c8e1315612 Patch rundeck API v11 bug for execution query results 2014-11-07 15:44:46 -08:00
Greg Schueler
18ec800264 Test expected API v11 response 2014-11-07 15:44:46 -08:00
Greg Schueler
f133c04a02 Merge branch 'issue/exec-query-timezone' for #16 2014-11-07 15:44:20 -08:00
Greg Schueler
7bad157911 Fix expected generated dates for executions test 2014-11-07 15:42:37 -08:00
Greg Schueler
3219161dd3 Use GMT time zone for date formatter 2014-11-07 15:42:22 -08:00
Greg Schueler
75231805ec Test query parameter generation for date strings 2014-11-07 15:37:19 -08:00
Greg Schueler
3d60907013 Merge pull request #15 from rundeck/apiv12
Add API v12 support
2014-11-07 09:02:27 -08:00
Greg Schueler
d7928bc37e [maven-release-plugin] prepare for next development iteration 2014-11-06 10:35:17 -08:00
Greg Schueler
40f5c5b891 Update API v12 todo 2014-11-06 10:06:07 -08:00
Greg Schueler
a598c76d8e Add delete all job executions endpoint 2014-11-06 10:05:35 -08:00
Greg Schueler
e092ccdb13 Add delete single execution 2014-11-06 09:48:55 -08:00
Greg Schueler
b1c0a45da6 Fix javadoc, require nonzero size of executionIds 2014-11-06 09:43:08 -08:00
Greg Schueler
a7c0c22699 Add bulk Delete executions endpoint 2014-11-06 09:32:30 -08:00
Greg Schueler
bbe599b915 Add todo 2014-11-06 08:49:25 -08:00
37 changed files with 1924 additions and 149 deletions

View file

@ -0,0 +1,13 @@
<ruleset comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<!--Ignore alpha, beta, release-candidate and draft versions-->
<ignoreVersions>
<ignoreVersion type="regex">.*[\.-](?i)alpha[0-9]*$</ignoreVersion>
<ignoreVersion type="regex">.*[\.-](?i)b(eta)?-?[0-9]*$</ignoreVersion>
<ignoreVersion type="regex">.*[\.-](?i)rc?[0-9]*$</ignoreVersion>
<ignoreVersion type="regex">.*[\.-](?i)draft.*$</ignoreVersion>
</ignoreVersions>
</ruleset>

38
pom.xml
View file

@ -17,6 +17,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>2.2.1</maven>
</prerequisites>
<!-- For deploying to Sonatype OSS Nexus -->
<parent>
<groupId>org.sonatype.oss</groupId>
@ -27,7 +31,7 @@
<!-- Project informations -->
<groupId>org.rundeck</groupId>
<artifactId>rundeck-api-java-client</artifactId>
<version>11.1</version>
<version>12.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>RunDeck API - Java Client</name>
<description>Java client for the RunDeck REST API</description>
@ -88,6 +92,16 @@
<project.build.targetJdk>1.6</project.build.targetJdk>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Dependencies version -->
<apache.httpcomponents.version>4.3.6</apache.httpcomponents.version>
<commons-lang.version>2.6</commons-lang.version>
<commons-io.version>2.1</commons-io.version>
<dom4j.version>1.6.1</dom4j.version>
<jaxen.version>1.1.1</jaxen.version>
<junit.version>4.10</junit.version>
<betamax.version>1.0</betamax.version>
<groovy.version>1.8.4</groovy.version>
<!-- Plugins version -->
<plugin.antrun.version>1.7</plugin.antrun.version>
<plugin.assembly.version>2.2.2</plugin.assembly.version>
@ -114,7 +128,7 @@
<plugin.source.version>2.1.2</plugin.source.version>
<plugin.surefire.version>2.10</plugin.surefire.version>
<plugin.taglist.version>2.4</plugin.taglist.version>
<plugin.versions.version>1.2</plugin.versions.version>
<plugin.versions.version>2.1</plugin.versions.version>
</properties>
<build>
@ -392,7 +406,7 @@
</reportSet>
</reportSets>
<configuration>
<comparisonMethod>mercury</comparisonMethod>
<rulesUri>file:./dependencies-check-rules.xml</rulesUri>
</configuration>
</plugin>
<plugin>
@ -423,52 +437,52 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
<version>${apache.httpcomponents.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.1.2</version>
<version>${apache.httpcomponents.version}</version>
</dependency>
<!-- Commons -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<version>${commons-lang.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
<version>${commons-io.version}</version>
</dependency>
<!-- XML Parsing -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
<version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
<version>${jaxen.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.robfletcher</groupId>
<artifactId>betamax</artifactId>
<version>1.0</version>
<version>${betamax.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.4</version>
<version>${groovy.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

View file

@ -19,9 +19,21 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd">
<properties>
<title>Changelog</title>
<author>Vincent Behar</author>
<author>Greg Schueler</author>
</properties>
<body>
<release date='2014-11-25' description='Rundeck API version 12' version='12.0'>
<action type='fix' dev='Sylvain-Bugat'>
Pull Request #18: OWASP A9 fix know vulnerabilities: CVE-2014-3577: in Apache
HttpComponents HttpClient before 4.3.5.
</action>
<action type='add' dev='gschueler'>
Add API v12 support
</action>
<action type='fix' dev='gschueler'>
Issue #17: Handle incorrect API v11 responses
</action>
</release>
<release date='2014-11-06' description='Bugfix' version='11.1'>
<action type='fix' dev='gschueler'>
Issue #14: deleteJob fails

View file

@ -37,7 +37,6 @@ import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.HTTP;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
import org.dom4j.Document;
import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
import org.rundeck.api.parser.ParserHelper;
@ -59,7 +58,7 @@ import java.util.Map.Entry;
/**
* Class responsible for making the HTTP API calls
*
*
* @author Vincent Behar
*/
class ApiCall {
@ -72,10 +71,10 @@ class ApiCall {
/** {@link RundeckClient} instance holding the RunDeck url and the credentials */
private final RundeckClient client;
/**
* Build a new instance, linked to the given RunDeck client
*
*
* @param client holding the RunDeck url and the credentials
* @throws IllegalArgumentException if client is null
*/
@ -87,7 +86,7 @@ class ApiCall {
/**
* Try to "ping" the RunDeck instance to see if it is alive
*
*
* @throws RundeckApiException if the ping fails
*/
public void ping() throws RundeckApiException {
@ -127,7 +126,7 @@ class ApiCall {
/**
* Test the login-based authentication on the RunDeck instance
*
*
* @throws RundeckApiLoginException if the login fails
* @see #testAuth()
*/
@ -144,7 +143,7 @@ class ApiCall {
/**
* Test the token-based authentication on the RunDeck instance
*
*
* @throws RundeckApiTokenException if the token is invalid
* @see #testAuth()
*/
@ -161,7 +160,7 @@ class ApiCall {
/**
* Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the
* API call. At the end, the given parser will be used to convert the response to a more useful result object.
*
*
* @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
* @param parser used to parse the response
* @return the result of the call, as formatted by the parser
@ -181,7 +180,7 @@ class ApiCall {
/**
* Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the
* API call.
*
*
* @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
* @return a new {@link InputStream} instance, not linked with network resources
* @throws RundeckApiException in case of error when calling the API
@ -206,7 +205,7 @@ class ApiCall {
/**
* Execute an HTTP GET request to the RunDeck instance, on the given path. We will login first, and then execute the
* API call without appending the API_ENDPOINT to the URL.
*
*
* @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
* @return a new {@link InputStream} instance, not linked with network resources
* @throws RundeckApiException in case of error when calling the API
@ -248,11 +247,11 @@ class ApiCall {
return get(apiPath, parser);
}
}
/**
* Execute an HTTP POST request to the RunDeck instance, on the given path. We will login first, and then execute
* the API call. At the end, the given parser will be used to convert the response to a more useful result object.
*
*
* @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
* @param parser used to parse the response
* @return the result of the call, as formatted by the parser
@ -322,7 +321,7 @@ class ApiCall {
/**
* Execute an HTTP DELETE request to the RunDeck instance, on the given path. We will login first, and then execute
* the API call. At the end, the given parser will be used to convert the response to a more useful result object.
*
*
* @param apiPath on which we will make the HTTP request - see {@link ApiPathBuilder}
* @param parser used to parse the response
* @return the result of the call, as formatted by the parser
@ -354,7 +353,7 @@ class ApiCall {
/**
* Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call. At the end,
* the given parser will be used to convert the response to a more useful result object.
*
*
* @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on...
* @param parser used to parse the response
* @return the result of the call, as formatted by the parser
@ -400,7 +399,7 @@ class ApiCall {
}
/**
* Execute an HTTP request to the RunDeck instance. We will login first, and then execute the API call.
*
*
* @param request to execute. see {@link HttpGet}, {@link HttpDelete}, and so on...
* @return a new {@link InputStream} instance, not linked with network resources
* @throws RundeckApiException in case of error when calling the API
@ -594,7 +593,7 @@ class ApiCall {
/**
* Do the actual work of login, using the given {@link HttpClient} instance. You'll need to re-use this instance
* when making API calls (such as running a job). Only use this in case of login-based authentication.
*
*
* @param httpClient pre-instantiated
* @throws RundeckApiLoginException if the login failed
*/
@ -639,11 +638,11 @@ class ApiCall {
while (true) {
try {
HttpPost postLogin = new HttpPost(location);
List params = new ArrayList();
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
params.add(new BasicNameValuePair("j_username", client.getLogin()));
params.add(new BasicNameValuePair("j_password", client.getPassword()));
params.add(new BasicNameValuePair("action", "login"));
postLogin.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
postLogin.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
HttpResponse response = httpClient.execute(postLogin);
if (response.getStatusLine().getStatusCode() / 100 == 3) {
@ -663,7 +662,7 @@ class ApiCall {
}
try {
String content = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
String content = EntityUtils.toString(response.getEntity(), Consts.UTF_8);
if (StringUtils.contains(content, "j_security_check")) {
throw new RundeckApiLoginException("Login failed for user " + client.getLogin());
}
@ -689,7 +688,7 @@ class ApiCall {
/**
* Instantiate a new {@link HttpClient} instance, configured to accept all SSL certificates
*
*
* @return an {@link HttpClient} instance - won't be null
*/
private HttpClient instantiateHttpClient() {

View file

@ -36,6 +36,9 @@ import java.util.*;
abstract class QueryParameterBuilder implements ApiPathBuilder.BuildsParameters {
public static final String W3C_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
static final SimpleDateFormat format = new SimpleDateFormat(W3C_DATE_FORMAT);
static {
format.setTimeZone(TimeZone.getTimeZone("GMT"));
}
/**
* Add a value to the builder for a given key

View file

@ -23,6 +23,7 @@ import org.rundeck.api.RundeckApiException.RundeckApiLoginException;
import org.rundeck.api.RundeckApiException.RundeckApiTokenException;
import org.rundeck.api.domain.*;
import org.rundeck.api.domain.RundeckExecution.ExecutionStatus;
import org.rundeck.api.generator.DeleteExecutionsGenerator;
import org.rundeck.api.generator.ProjectConfigGenerator;
import org.rundeck.api.generator.ProjectConfigPropertyGenerator;
import org.rundeck.api.generator.ProjectGenerator;
@ -95,6 +96,7 @@ public class RundeckClient implements Serializable {
V9(9),
V10(10),
V11(11),
V12(12),
;
private int versionNumber;
@ -108,7 +110,7 @@ public class RundeckClient implements Serializable {
}
}
/** Version of the API supported */
public static final transient int API_VERSION = Version.V11.getVersionNumber();
public static final transient int API_VERSION = Version.V12.getVersionNumber();
private static final String API = "/api/";
@ -1083,7 +1085,16 @@ public class RundeckClient implements Serializable {
if(null!=jobRun.getAsUser()) {
apiPath.param("asUser", jobRun.getAsUser());
}
return new ApiCall(this).get(apiPath, new ExecutionParser(rootXpath()+"/executions/execution"));
return new ApiCall(this).get(apiPath,
APIV11Helper.unwrapIfNeeded(
new ExecutionParser(
rootXpath() +
"/executions/execution"
), rootXpath() +
"/executions/execution"
)
);
}
@ -1585,9 +1596,15 @@ public class RundeckClient implements Serializable {
.param(new ExecutionQueryParameters(query))
.param("max", max)
.param("offset", offset),
new PagedResultParser<RundeckExecution>(
new ListParser<RundeckExecution>(new ExecutionParser(), "execution"),
rootXpath()+"/executions"
APIV11Helper.unwrapIfNeeded(
new PagedResultParser<RundeckExecution>(
new ListParser<RundeckExecution>(
new ExecutionParser(),
"execution"
),
rootXpath() + "/executions"
),
rootXpath() + "/executions"
)
);
}
@ -1605,8 +1622,15 @@ public class RundeckClient implements Serializable {
public RundeckExecution getExecution(Long executionId) throws RundeckApiException, RundeckApiLoginException,
RundeckApiTokenException, IllegalArgumentException {
AssertUtil.notNull(executionId, "executionId is mandatory to get the details of an execution !");
return new ApiCall(this).get(new ApiPathBuilder("/execution/", executionId.toString()),
new ExecutionParser(rootXpath()+"/executions/execution"));
return new ApiCall(this).get(
new ApiPathBuilder("/execution/", executionId.toString()),
APIV11Helper.unwrapIfNeeded(
new ExecutionParser(
rootXpath() + "/executions/execution"
),
rootXpath() + "/executions/execution"
)
);
}
/**
@ -1641,7 +1665,76 @@ public class RundeckClient implements Serializable {
if(null!=asUser) {
apiPath.param("asUser", asUser);
}
return new ApiCall(this).get(apiPath, new AbortParser(rootXpath()+"/abort"));
return new ApiCall(this).get(apiPath, new AbortParser(rootXpath() + "/abort"));
}
/**
* Delete all executions for a job specified by a job ID
*
* @param jobId Identifier for the job
*
* @return a {@link DeleteExecutionsResponse} 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 fails (in case of login-based authentication)
* @throws RundeckApiTokenException if the token is invalid (in case of token-based
* authentication)
* @throws IllegalArgumentException if the executionIds is null
*/
public DeleteExecutionsResponse deleteAllJobExecutions(final String jobId)
throws RundeckApiException, RundeckApiLoginException,
RundeckApiTokenException, IllegalArgumentException
{
AssertUtil.notNull(jobId, "jobId is mandatory to delete executions!");
return new ApiCall(this).delete(
new ApiPathBuilder("/job/",jobId,"/executions"),
new DeleteExecutionsResponseParser(rootXpath() + "/deleteExecutions")
);
}
/**
* Delete a set of executions, identified by the given IDs
*
* @param executionIds set of identifiers for the executions - mandatory
* @return a {@link DeleteExecutionsResponse} 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 fails (in case of login-based authentication)
* @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
* @throws IllegalArgumentException if the executionIds is null
*/
public DeleteExecutionsResponse deleteExecutions(final Set<Long> executionIds)
throws RundeckApiException, RundeckApiLoginException,
RundeckApiTokenException, IllegalArgumentException
{
AssertUtil.notNull(executionIds, "executionIds is mandatory to delete executions!");
if (executionIds.size() < 1) {
throw new IllegalArgumentException("executionIds cannot be empty");
}
final ApiPathBuilder apiPath = new ApiPathBuilder("/executions/delete").xml(
new DeleteExecutionsGenerator(executionIds)
);
return new ApiCall(this).post(
apiPath,
new DeleteExecutionsResponseParser( rootXpath() + "/deleteExecutions")
);
}
/**
* Delete a single execution, identified by the given ID
*
* @param executionId identifier for the execution - mandatory
* @throws RundeckApiException in case of error when calling the API (non-existent execution with this ID)
* @throws RundeckApiLoginException if the login fails (in case of login-based authentication)
* @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication)
* @throws IllegalArgumentException if the executionId is null
*/
public void deleteExecution(final Long executionId)
throws RundeckApiException, RundeckApiLoginException,
RundeckApiTokenException, IllegalArgumentException
{
AssertUtil.notNull(executionId, "executionId is mandatory to delete an execution!");
new ApiCall(this).delete(new ApiPathBuilder("/execution/", executionId.toString()));
}
/*

View file

@ -0,0 +1,84 @@
package org.rundeck.api.domain;
import java.io.Serializable;
import java.util.List;
/**
* DeleteExecutionsResponse is ...
*
* @author Greg Schueler <greg@simplifyops.com>
* @since 2014-11-06
*/
public class DeleteExecutionsResponse implements Serializable {
private static final long serialVersionUID = 1L;
private int failedCount;
private int successCount;
private boolean allsuccessful;
private int requestCount;
private List<DeleteFailure> failures;
public int getFailedCount() {
return failedCount;
}
public void setFailedCount(final int failedCount) {
this.failedCount = failedCount;
}
public int getSuccessCount() {
return successCount;
}
public void setSuccessCount(final int successCount) {
this.successCount = successCount;
}
public boolean isAllsuccessful() {
return allsuccessful;
}
public void setAllsuccessful(final boolean allsuccessful) {
this.allsuccessful = allsuccessful;
}
public int getRequestCount() {
return requestCount;
}
public void setRequestCount(final int requestCount) {
this.requestCount = requestCount;
}
public List<DeleteFailure> getFailures() {
return failures;
}
public void setFailures(final List<DeleteFailure> failures) {
this.failures = failures;
}
public static class DeleteFailure implements Serializable{
private static final long serialVersionUID = 1L;
private Long executionId;
private String message;
public Long getExecutionId() {
return executionId;
}
public void setExecutionId(final Long executionId) {
this.executionId = executionId;
}
public String getMessage() {
return message;
}
public void setMessage(final String message) {
this.message = message;
}
}
}

View file

@ -0,0 +1,38 @@
package org.rundeck.api.generator;
import org.dom4j.DocumentFactory;
import org.dom4j.Element;
import org.rundeck.api.domain.ProjectConfig;
import java.util.List;
import java.util.Set;
/**
* DeleteExecutionsGenerator is ...
*
* @author Greg Schueler <greg@simplifyops.com>
* @since 2014-11-06
*/
public class DeleteExecutionsGenerator extends BaseDocGenerator {
private Set<Long> executionIds;
public DeleteExecutionsGenerator(final Set<Long> executionIds) {
this.executionIds = executionIds;
}
@Override public Element generateXmlElement() {
Element rootElem = DocumentFactory.getInstance().createElement("executions");
for (Long executionId : executionIds) {
rootElem.addElement("execution").addAttribute("id", Long.toString(executionId));
}
return rootElem;
}
public Set<Long> getExecutionIds() {
return executionIds;
}
public void setExecutionIds(final Set<Long> executionIds) {
this.executionIds = executionIds;
}
}

View file

@ -0,0 +1,78 @@
package org.rundeck.api.parser;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.Node;
/**
* Utility to handle API v11 responses with &lt;result&gt; wrapper element.
*
* @author Greg Schueler <greg@simplifyops.com>
* @since 2014-11-10
*/
public class APIV11Helper {
/**
* Detect and remove extra &lt;result&gt; wrapper around xml response.
* @param parser
* @param xpath
* @param <T>
* @return
*/
public static <T> XmlNodeParser<T> unwrapIfNeeded(
final XmlNodeParser<T> parser,
final String xpath
) {
return new NodeParser_unwrap<T>(parser, xpath);
}
static class NodeParser_unwrap<T> implements XmlNodeParser<T> {
XmlNodeParser<T> parser;
String xpath;
public NodeParser_unwrap(final XmlNodeParser<T> parser, final String xpath) {
this.parser = parser;
this.xpath = xpath;
}
@Override public T parseXmlNode(final Node node) {
Node sourceNode = unwrapResultElement(node, xpath);
return parser.parseXmlNode(sourceNode);
}
}
/**
* Test the node for matching the xpath string, if it doesnt match, attempt to prefix it with
* "result" and match that. If that matches, return the first child of the 'result' element.
*
* @param node
* @param xpath
*
* @return
*/
public static Node unwrapResultElement(final Node node, final String xpath) {
Node sourceNode = node;
final Node tested = sourceNode.selectSingleNode(xpath);
if (null == tested && !xpath.startsWith("result")) {
//prepend /result
if (null != sourceNode.selectSingleNode("result" + xpath)) {
Node resultNode = sourceNode.selectSingleNode("result");
if (resultNode instanceof Element) {
Element result = (Element) resultNode;
if (result.elements().size() == 1) {
Node node1 = (Node) result.elements().get(0);
if (node1 instanceof Element) {
sourceNode = node1;
sourceNode.getParent().remove(sourceNode);
DocumentHelper.createDocument((Element) sourceNode);
}
}
}
}
}
return sourceNode;
}
}

View file

@ -0,0 +1,52 @@
package org.rundeck.api.parser;
import org.dom4j.Node;
import org.rundeck.api.domain.DeleteExecutionsResponse;
import java.util.ArrayList;
import java.util.List;
/**
* DeleteExecutionsResponseParser is ...
*
* @author Greg Schueler <greg@simplifyops.com>
* @since 2014-11-06
*/
public class DeleteExecutionsResponseParser implements XmlNodeParser<DeleteExecutionsResponse> {
private String xpath;
public DeleteExecutionsResponseParser(final String xpath) {
this.xpath = xpath;
}
@Override public DeleteExecutionsResponse parseXmlNode(final Node node) {
final Node baseNode = xpath != null ? node.selectSingleNode(xpath) : node;
final DeleteExecutionsResponse response = new DeleteExecutionsResponse();
response.setAllsuccessful(Boolean.parseBoolean(baseNode.valueOf("@allsuccessful")));
response.setRequestCount(Integer.parseInt(baseNode.valueOf("@requestCount")));
response.setSuccessCount(Integer.parseInt(baseNode.valueOf("successful/@count")));
final Node failedNode = baseNode.selectSingleNode("failed");
//parse failures
final List<DeleteExecutionsResponse.DeleteFailure> failures = new ArrayList
<DeleteExecutionsResponse.DeleteFailure>();
int failedCount = 0;
if (null != failedNode) {
failedCount = Integer.parseInt(baseNode.valueOf("failed/@count"));
final List list = baseNode.selectNodes("failed/execution");
for (final Object o : list) {
final Node execNode = (Node) o;
final DeleteExecutionsResponse.DeleteFailure deleteFailure =
new DeleteExecutionsResponse.DeleteFailure();
deleteFailure.setExecutionId(Long.parseLong(execNode.valueOf("@id")));
deleteFailure.setMessage(execNode.valueOf("@message"));
failures.add(deleteFailure);
}
}
response.setFailedCount(failedCount);
response.setFailures(failures);
return response;
}
}

View file

@ -26,6 +26,7 @@ package org.rundeck.api.parser;
import org.dom4j.Element;
import org.dom4j.Node;
import org.rundeck.api.RundeckApiException;
import org.rundeck.api.util.PagedResults;
import java.util.*;
@ -38,7 +39,7 @@ import java.util.*;
*/
public class PagedResultParser<T> implements XmlNodeParser<PagedResults<T>> {
ListParser<T> itemParser;
String xpath;
private String xpath;
/**
* Create a PagedResultParser
@ -54,7 +55,9 @@ public class PagedResultParser<T> implements XmlNodeParser<PagedResults<T>> {
@Override
public PagedResults<T> parseXmlNode(Node node) {
Node pagedNodeContainer = node.selectSingleNode(xpath);
if(null==pagedNodeContainer) {
throw new RundeckApiException("XML content did not match XPATH expression: " + xpath);
}
Element el = (Element) pagedNodeContainer;
final int max = integerAttribute(el, "max", -1);
final int offset = integerAttribute(el, "offset", -1);
@ -113,4 +116,8 @@ public class PagedResultParser<T> implements XmlNodeParser<PagedResults<T>> {
}
return parseMax;
}
public String getXpath() {
return xpath;
}
}

View file

@ -7,13 +7,10 @@ The library is hosted on the [Maven Central Repository|http://search.maven.org/]
You can see all versions and download the files with this query : [g:"org.rundeck" AND a:"rundeck-api-java-client"|http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.rundeck%22%20AND%20a%3A%22rundeck-api-java-client%22].
Alternatively, you can download [releases|https://oss.sonatype.org/content/repositories/releases/org/rundeck/rundeck-api-java-client/] or [snapshots|https://oss.sonatype.org/content/repositories/snapshots/org/rundeck/rundeck-api-java-client/] from [Sonatype Nexus OSS instance|https://oss.sonatype.org/] (which is then synchronized to Maven Central).
Alternatively, you can download [releases|https://oss.sonatype.org/content/repositories/releases/org/rundeck/rundeck-api-java-client/] from [Sonatype Nexus OSS instance|https://oss.sonatype.org/] (which is then synchronized to Maven Central).
h2. Manual download
If you want to use this library from a [scripting language|./scripting.html], it is often easier to download a single *jar* file with all dependencies included (named "*rundeck-api-java-client-VERSION-jar-with-dependencies.jar *")
You can download such files on GitHub : [https://github.com/vbehar/rundeck-api-java-client/downloads] (for each release)
You can also download the latest version (not yet released) on Jenkins : [https://rundeck-api-java-client.ci.cloudbees.com/job/master/lastSuccessfulBuild/artifact/target/]
You can download such files on GitHub : [https://github.com/rundeck/rundeck-api-java-client/releases] (for each release)

View file

@ -1,5 +1,5 @@
h1. Using the RunDeck API from Groovy scripts
h1. Using the Rundeck API from Groovy scripts
Here are some examples of what you can do with this lib and a few lines of [Groovy|http://groovy.codehaus.org/].
@ -11,16 +11,16 @@ Save the following script in a file named "{{rundeck.groovy}}", and execute it w
{code}
// we use Grape (Ivy) to download the lib (and its dependencies) from Maven Central Repository
@Grab(group='org.rundeck', module='rundeck-api-java-client', version='2.0')
@Grab(group='org.rundeck', module='rundeck-api-java-client', version='12.0')
import org.rundeck.api.RundeckClient
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
println "RunDeck uptime : ${rundeck.systemInfo.uptime}"
println "All RunDeck projects : ${rundeck.projects}"
println "All RunDeck nodes : ${rundeck.nodes}"
println "All RunDeck jobs : ${rundeck.jobs}"
println "All RunDeck running executions : ${rundeck.runningExecutions}"
println "Rundeck uptime : ${rundeck.systemInfo.uptime}"
println "All Rundeck projects : ${rundeck.projects}"
println "All Rundeck nodes : ${rundeck.nodes}"
println "All Rundeck jobs : ${rundeck.jobs}"
println "All Rundeck running executions : ${rundeck.runningExecutions}"
{code}
You can also [download|./download.html] the lib and all its dependencies in 1 big jar file, and add it to your classpath before running your script : save the following script in a file named "{{rundeck.groovy}}", and execute it with "{{groovy -cp /path/to/rundeck-api-java-client-VERSION-jar-with-dependencies.jar rundeck.groovy}}".
@ -28,34 +28,34 @@ You can also [download|./download.html] the lib and all its dependencies in 1 bi
{code}
import org.rundeck.api.RundeckClient
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
println "RunDeck uptime : ${rundeck.systemInfo.uptime}"
println "All RunDeck projects : ${rundeck.projects}"
println "All RunDeck nodes : ${rundeck.nodes}"
println "All RunDeck jobs : ${rundeck.jobs}"
println "All RunDeck running executions : ${rundeck.runningExecutions}"
println "Rundeck uptime : ${rundeck.systemInfo.uptime}"
println "All Rundeck projects : ${rundeck.projects}"
println "All Rundeck nodes : ${rundeck.nodes}"
println "All Rundeck jobs : ${rundeck.jobs}"
println "All Rundeck running executions : ${rundeck.runningExecutions}"
{code}
h2. Authentication
Starting with RunDeck API 2, there are 2 ways to authenticate :
Starting with Rundeck API 2, there are 2 ways to authenticate :
* the *login-based authentication* : with your login and password
* the *token-based authentication* : with a unique token that you can generate from the RunDeck webUI
* the *token-based authentication* : with a unique token that you can generate from the Rundeck webUI
{code}
// using login-based authentication (admin/admin is the default login/password for a new RunDeck instance) :
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin");
// using login-based authentication (admin/admin is the default login/password for a new Rundeck instance) :
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// using token-based authentication :
rundeck = new RundeckClient("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD");
rundeck = RundeckClient.builder().url("http://localhost:4440").token("PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD").build()
{code}
h2. Running a job
{code}
import org.rundeck.api.RundeckClient
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// find a job from its name, group and project
job = rundeck.findJob("my-project", "main-group/sub-group", "job-name")
@ -80,9 +80,9 @@ h2. Running an ad-hoc command
{code}
import org.rundeck.api.RundeckClient
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// trigger the execution of the "uptime" command on the RunDeck server
// trigger the execution of the "uptime" command on the Rundeck server
execution = rundeck.triggerAdhocCommand("my-project", "uptime")
// run the "uptime" command on all unix nodes
@ -93,9 +93,9 @@ h2. Running an ad-hoc script
{code}
import org.rundeck.api.RundeckClient
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// trigger the execution of a custom bash script on the RunDeck server
// trigger the execution of a custom bash script on the Rundeck server
execution = rundeck.triggerAdhocScript("my-project", "/tmp/my-script.sh")
// run a bash script (with options) on all unix nodes
@ -106,7 +106,7 @@ h2. Exporting jobs
{code}
import org.rundeck.api.RundeckClient
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
rundeck.exportJobsToFile("/tmp/jobs.xml", "xml", "my-project")
rundeck.exportJobToFile("/tmp/job.yaml", "yaml", "job-id")
@ -116,7 +116,7 @@ h2. Importing jobs
{code}
import org.rundeck.api.RundeckClient
rundeck = new RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
result = rundeck.importJobs("/tmp/jobs.xml", "xml")
println "${result.succeededJobs.size} jobs successfully imported, ${result.skippedJobs.size} jobs skipped, and ${result.failedJobs.size} jobs failed"
@ -124,5 +124,5 @@ println "${result.succeededJobs.size} jobs successfully imported, ${result.skipp
h2. And more...
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your Rundeck instance...

View file

@ -1,5 +1,5 @@
h1. Using the RunDeck API from JRuby scripts
h1. Using the Rundeck API from JRuby scripts
Here are some examples of what you can do with this lib and a few lines of [Ruby|http://www.jruby.org/] (for the rubyist that don't fear running on the JVM !)
@ -14,13 +14,13 @@ require 'java'
require '/path/to/rundeck-api-java-client-VERSION-jar-with-dependencies.jar'
import org.rundeck.api.RundeckClient
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
puts "RunDeck uptime : #{rundeck.systemInfo.uptime}"
puts "All RunDeck projects : #{rundeck.projects}"
puts "All RunDeck nodes : #{rundeck.nodes}"
puts "All RunDeck jobs : #{rundeck.jobs}"
puts "All RunDeck running executions : #{rundeck.runningExecutions}"
puts "Rundeck uptime : #{rundeck.systemInfo.uptime}"
puts "All Rundeck projects : #{rundeck.projects}"
puts "All Rundeck nodes : #{rundeck.nodes}"
puts "All Rundeck jobs : #{rundeck.jobs}"
puts "All Rundeck running executions : #{rundeck.runningExecutions}"
{code}
You can also add the library to the classpath : save the following script in a file named "{{rundeck.rb}}", and execute it with "{{jruby -rjava -J-cp /path/to/rundeck-api-java-client-VERSION-jar-with-dependencies.jar rundeck.rb}}".
@ -28,27 +28,27 @@ You can also add the library to the classpath : save the following script in a f
{code}
import org.rundeck.api.RundeckClient
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
puts "RunDeck uptime : #{rundeck.systemInfo.uptime}"
puts "All RunDeck projects : #{rundeck.projects}"
puts "All RunDeck nodes : #{rundeck.nodes}"
puts "All RunDeck jobs : #{rundeck.jobs}"
puts "All RunDeck running executions : #{rundeck.runningExecutions}"
puts "Rundeck uptime : #{rundeck.systemInfo.uptime}"
puts "All Rundeck projects : #{rundeck.projects}"
puts "All Rundeck nodes : #{rundeck.nodes}"
puts "All Rundeck jobs : #{rundeck.jobs}"
puts "All Rundeck running executions : #{rundeck.runningExecutions}"
{code}
h2. Authentication
Starting with RunDeck API 2, there are 2 ways to authenticate :
Starting with Rundeck API 2, there are 2 ways to authenticate :
* the *login-based authentication* : with your login and password
* the *token-based authentication* : with a unique token that you can generate from the RunDeck webUI
* the *token-based authentication* : with a unique token that you can generate from the Rundeck webUI
{code}
// using login-based authentication (admin/admin is the default login/password for a new RunDeck instance) :
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin");
// using login-based authentication (admin/admin is the default login/password for a new Rundeck instance) :
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// using token-based authentication :
rundeck = RundeckClient.new("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD");
rundeck = RundeckClient.builder().url("http://localhost:4440").token("PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD").build()
{code}
h2. Running a job
@ -58,7 +58,7 @@ import org.rundeck.api.RundeckClient
import org.rundeck.api.OptionsBuilder
import org.rundeck.api.NodeFiltersBuilder
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// find a job from its name, group and project
job = rundeck.findJob("my-project", "main-group/sub-group", "job-name")
@ -85,9 +85,9 @@ h2. Running an ad-hoc command
import org.rundeck.api.RundeckClient
import org.rundeck.api.NodeFiltersBuilder
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// trigger the execution of the "uptime" command on the RunDeck server
// trigger the execution of the "uptime" command on the Rundeck server
execution = rundeck.triggerAdhocCommand("my-project", "uptime")
// run the "uptime" command on all unix nodes
@ -101,9 +101,9 @@ import org.rundeck.api.RundeckClient
import org.rundeck.api.OptionsBuilder
import org.rundeck.api.NodeFiltersBuilder
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// trigger the execution of a custom bash script on the RunDeck server
// trigger the execution of a custom bash script on the Rundeck server
execution = rundeck.triggerAdhocScript("my-project", "/tmp/my-script.sh")
// run a bash script (with options) on all unix nodes
@ -114,7 +114,7 @@ h2. Exporting jobs
{code}
import org.rundeck.api.RundeckClient
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
rundeck.exportJobsToFile("/tmp/jobs.xml", "xml", "my-project")
rundeck.exportJobToFile("/tmp/job.yaml", "yaml", "job-id")
@ -124,7 +124,7 @@ h2. Importing jobs
{code}
import org.rundeck.api.RundeckClient
rundeck = RundeckClient.new("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
result = rundeck.importJobs("/tmp/jobs.xml", "xml")
puts "#{result.succeededJobs.size} jobs successfully imported, #{result.skippedJobs.size} jobs skipped, and #{result.failedJobs.size} jobs failed"
@ -132,5 +132,5 @@ puts "#{result.succeededJobs.size} jobs successfully imported, #{result.skippedJ
h2. And more...
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your Rundeck instance...

View file

@ -1,5 +1,5 @@
h1. Using the RunDeck API from Jython scripts
h1. Using the Rundeck API from Jython scripts
Here are some examples of what you can do with this lib and a few lines of [Python|http://www.jython.org/] (for the pythonist that don't fear running on the JVM !)
@ -12,27 +12,27 @@ Save the following script in a file named "{{rundeck.py}}", and execute it with
{code}
from org.rundeck.api import RundeckClient
rundeck = RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
print("RunDeck uptime : %s" % rundeck.systemInfo.uptime)
print("All RunDeck projects : %s" % rundeck.projects)
print("All RunDeck nodes : %s" % rundeck.nodes)
print("All RunDeck jobs : %s" % rundeck.jobs)
print("All RunDeck running executions : %s" % rundeck.runningExecutions)
print("Rundeck uptime : %s" % rundeck.systemInfo.uptime)
print("All Rundeck projects : %s" % rundeck.projects)
print("All Rundeck nodes : %s" % rundeck.nodes)
print("All Rundeck jobs : %s" % rundeck.jobs)
print("All Rundeck running executions : %s" % rundeck.runningExecutions)
{code}
h2. Authentication
Starting with RunDeck API 2, there are 2 ways to authenticate :
Starting with Rundeck API 2, there are 2 ways to authenticate :
* the *login-based authentication* : with your login and password
* the *token-based authentication* : with a unique token that you can generate from the RunDeck webUI
* the *token-based authentication* : with a unique token that you can generate from the Rundeck webUI
{code}
// using login-based authentication (admin/admin is the default login/password for a new RunDeck instance) :
rundeck = RundeckClient("http://localhost:4440", "admin", "admin");
// using login-based authentication (admin/admin is the default login/password for a new Rundeck instance) :
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// using token-based authentication :
rundeck = RundeckClient("http://localhost:4440", "PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD");
rundeck = RundeckClient.builder().url("http://localhost:4440").token("PDDNKo5VE29kpk4prOUDr2rsKdRkEvsD").build()
{code}
h2. Running a job
@ -42,7 +42,7 @@ from org.rundeck.api import RundeckClient
from org.rundeck.api import OptionsBuilder
from org.rundeck.api import NodeFiltersBuilder
rundeck = RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// find a job from its name, group and project
job = rundeck.findJob("my-project", "main-group/sub-group", "job-name")
@ -69,9 +69,9 @@ h2. Running an ad-hoc command
from org.rundeck.api import RundeckClient
from org.rundeck.api import NodeFiltersBuilder
rundeck = RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// trigger the execution of the "uptime" command on the RunDeck server
// trigger the execution of the "uptime" command on the Rundeck server
execution = rundeck.triggerAdhocCommand("my-project", "uptime")
// run the "uptime" command on all unix nodes
@ -85,9 +85,9 @@ from org.rundeck.api import RundeckClient
from org.rundeck.api import OptionsBuilder
from org.rundeck.api import NodeFiltersBuilder
rundeck = RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
// trigger the execution of a custom bash script on the RunDeck server
// trigger the execution of a custom bash script on the Rundeck server
execution = rundeck.triggerAdhocScript("my-project", "/tmp/my-script.sh")
// run a bash script (with options) on all unix nodes
@ -98,7 +98,7 @@ h2. Exporting jobs
{code}
from org.rundeck.api import RundeckClient
rundeck = RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
rundeck.exportJobsToFile("/tmp/jobs.xml", "xml", "my-project")
rundeck.exportJobToFile("/tmp/job.yaml", "yaml", "job-id")
@ -108,7 +108,7 @@ h2. Importing jobs
{code}
from org.rundeck.api import RundeckClient
rundeck = RundeckClient("http://localhost:4440", "admin", "admin")
rundeck = RundeckClient.builder().url("http://localhost:4440").login("admin", "admin").build()
result = rundeck.importJobs("/tmp/jobs.xml", "xml")
print("%s jobs successfully imported, %s jobs skipped, and %s jobs failed" % (result.succeededJobs.size, result.skippedJobs.size, result.failedJobs.size))
@ -116,5 +116,5 @@ print("%s jobs successfully imported, %s jobs skipped, and %s jobs failed" % (re
h2. And more...
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your RunDeck instance...
See the API documentation of the [RundeckClient|./apidocs/reference/org/rundeck/api/RundeckClient.html] class for more interactions with your Rundeck instance...

View file

@ -1,9 +1,9 @@
h1. Status of the implementation of the RunDeck API
h1. Status of the implementation of the Rundeck API
h2. RunDeck API version 1
h2. Rundeck API version 1
[Documentation of the RunDeck API version 1|http://rundeck.org/1.2.1/RunDeck-Guide.html#rundeck-api]
[Documentation of the Rundeck API version 1|http://rundeck.org/1.2.1/Rundeck-Guide.html#rundeck-api]
* Login-based authentication - OK
* System Info - OK
@ -26,67 +26,67 @@ h2. RunDeck API version 1
* Listing Resources - OK
* Getting Resource Info - OK
h2. RunDeck API version 2
h2. Rundeck API version 2
[Documentation of the RunDeck API version 2|http://rundeck.org/1.3.2/api/index.html]
[Documentation of the Rundeck API version 2|http://rundeck.org/1.3.2/api/index.html]
* Token-based authentication - OK
* Listing Jobs for a Project - *TODO*
* Updating and Listing Resources for a Project - *TODO*
* Refreshing Resources for a Project - *TODO*
h2. RunDeck API version 3
h2. Rundeck API version 3
[Documentation of the RunDeck API version 3|http://rundeck.org/1.4.2/api/index.html]
[Documentation of the Rundeck API version 3|http://rundeck.org/1.4.2/api/index.html]
* (only updates to Resource endpoints) - *TODO*
h2. RunDeck API version 4
h2. Rundeck API version 4
[Documentation of the RunDeck API version 4|http://rundeck.org/1.4.3/api/index.html]
[Documentation of the Rundeck API version 4|http://rundeck.org/1.4.3/api/index.html]
* Running Adhoc Script URLs - *TODO*
h2. RunDeck API version 5
h2. Rundeck API version 5
[Documentation of the RunDeck API version 5|http://rundeck.org/1.4.4/api/index.html]
[Documentation of the Rundeck API version 5|http://rundeck.org/1.4.4/api/index.html]
* Bulk Job Delete - OK
* Execution Output - OK
* Execution Query - OK
* History list query - OK
h2. RunDeck API version 6
h2. Rundeck API version 6
[Documentation of the RunDeck API version 6|http://rundeck.org/1.5/api/index.html]
[Documentation of the Rundeck API version 6|http://rundeck.org/1.5/api/index.html]
* Execution Output format fixed - OK
h2. RunDeck API version 7
h2. Rundeck API version 7
[Documentation of the RunDeck API version 7|http://rundeck.org/1.5.3/api/index.html]
[Documentation of the Rundeck API version 7|http://rundeck.org/1.5.3/api/index.html]
* Incubator for cluster mode job takeover - *TODO*
h2. RunDeck API version 8
h2. Rundeck API version 8
[Documentation of the RunDeck API version 8|http://rundeck.org/1.6.0/api/index.html]
[Documentation of the Rundeck API version 8|http://rundeck.org/1.6.0/api/index.html]
* scriptInterpreter addition to run script and run url - OK
* project parameter added to jobs import - OK
h2. RunDeck API version 9
h2. Rundeck API version 9
[Documentation of the RunDeck API version 9|http://rundeck.org/1.6.1/api/index.html]
[Documentation of the Rundeck API version 9|http://rundeck.org/1.6.1/api/index.html]
* list running executions across all projects - OK
* include project name in execution results - OK
* Add uuidOption parameter to allow removing imported UUIDs to avoid creation conflicts - OK
h2. RunDeck API version 10
h2. Rundeck API version 10
[Documentation of the RunDeck API version 10|http://rundeck.org/2.0.0/api/index.html]
[Documentation of the Rundeck API version 10|http://rundeck.org/2.0.0/api/index.html]
* Execution State - Retrieve workflow step and node state information - OK
* Execution Output with State - Retrieve log output with state change information - OK
@ -95,9 +95,9 @@ h2. RunDeck API version 10
* Deprecation: Remove methods deprecated until version 10. - OK
h2. RunDeck API version 11
h2. Rundeck API version 11
[Documentation of the RunDeck API version 11|http://rundeck.org/2.1.0/api/index.html]
[Documentation of the Rundeck API version 11|http://rundeck.org/2.1.0/api/index.html]
* Project creation - OK
* Get Project configuration - OK
@ -113,3 +113,11 @@ h2. RunDeck API version 11
* API Token create - OK
* API Token list - OK
* API Token delete - OK
h2. Rundeck API version 12
[Documentation of the Rundeck API version 12|http://rundeck.org/2.2.0/api/index.html]
* Bulk delete executions - OK
* Delete execution - OK
* Delete all executions for a job - OK

View file

@ -28,8 +28,8 @@
</skin>
<body>
<breadcrumbs>
<item name="RunDeck" href="http://rundeck.org" />
<item name="RunDeck API - Java Client" href="" />
<item name="Rundeck" href="http://rundeck.org" />
<item name="Rundeck API - Java Client" href="" />
</breadcrumbs>
<menu name="${project.name}">
<item name="Introduction" href="index.html" />
@ -46,7 +46,7 @@
<item name="Jython" href="jython.html" />
</menu>
<!-- <menu name="Older versions">
<item name="1.x (RunDeck 1.2)" href="1.x/index.html" />
<item name="1.x (Rundeck 1.2)" href="1.x/index.html" />
</menu> -->
<menu ref="reports" />
</body>

View file

@ -0,0 +1,54 @@
package org.rundeck.api;
import junit.framework.Assert;
import org.junit.Test;
import org.rundeck.api.query.ExecutionQuery;
import java.util.Arrays;
import java.util.Date;
/**
* ExecutionQueryParametersTest is ...
*
* @author Greg Schueler <greg@simplifyops.com>
* @since 2014-11-07
*/
public class ExecutionQueryParametersTest {
@Test
public void stringParameter() {
ExecutionQuery.Builder description = ExecutionQuery.builder().description("a description");
ExecutionQueryParameters executionQueryParameters = new ExecutionQueryParameters(
description.build()
);
ApiPathBuilder param = new ApiPathBuilder("").param(executionQueryParameters);
Assert.assertEquals("?descFilter=a+description", param.toString());
}
@Test
public void listParameter() {
ExecutionQuery.Builder description = ExecutionQuery.builder().excludeJobList(
Arrays.asList(
"a",
"b"
)
);
ExecutionQueryParameters executionQueryParameters = new ExecutionQueryParameters(
description.build()
);
ApiPathBuilder param = new ApiPathBuilder("").param(executionQueryParameters);
Assert.assertEquals("?excludeJobListFilter=a&excludeJobListFilter=b", param.toString());
}
@Test
public void dateParameter() {
ExecutionQuery.Builder description = ExecutionQuery.builder().end(
new Date(1347581178168L)
);
ExecutionQueryParameters executionQueryParameters = new ExecutionQueryParameters(
description.build()
);
ApiPathBuilder param = new ApiPathBuilder("").param(executionQueryParameters);
//nb: timezone should be GMT
//2012-09-14T00:06:18Z
Assert.assertEquals("?end=2012-09-14T00%3A06%3A18Z", param.toString());
}
}

View file

@ -56,6 +56,7 @@ public class RundeckClientTest {
public static final String TEST_TOKEN_5 = "C3O6d5O98Kr6Dpv71sdE4ERdCuU12P6d";
public static final String TEST_TOKEN_6 = "Do4d3NUD5DKk21DR4sNK755RcPk618vn";
public static final String TEST_TOKEN_7 = "8Dp9op111ER6opsDRkddvE86K9sE499s";
public static final String TEST_TOKEN_8 = "GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI";
@Rule
public Recorder recorder = new Recorder();
@ -274,7 +275,47 @@ public class RundeckClientTest {
}
Assert.assertEquals(Arrays.asList("bob"), names);
}
@Test
@Betamax(tape="get_execution")
public void getExecution() throws Exception{
RundeckClient client = createClient(TEST_TOKEN_7, 5);
RundeckExecution execution = client.getExecution(945L);
Assert.assertEquals("echo test trigger_adhoc_command", execution.getDescription());
Assert.assertEquals("2 seconds", execution.getDuration());
Assert.assertEquals("test", execution.getProject());
Assert.assertEquals("admin", execution.getStartedBy());
Assert.assertEquals(null, execution.getJob());
Assert.assertEquals(null, execution.getAbortedBy());
}
@Test
@Betamax(tape="get_execution_v11")
public void getExecution_v11() throws Exception{
RundeckClient client = createClient(TEST_TOKEN_7, 11);
RundeckExecution execution = client.getExecution(945L);
Assert.assertEquals("echo test trigger_adhoc_command", execution.getDescription());
Assert.assertEquals("2 seconds", execution.getDuration());
Assert.assertEquals("test", execution.getProject());
Assert.assertEquals("admin", execution.getStartedBy());
Assert.assertEquals(null, execution.getJob());
Assert.assertEquals(null, execution.getAbortedBy());
}
/**
* Test incorrect &lt;result&gt; wrapper is handled correctly
* @throws Exception
*/
@Test
@Betamax(tape="get_execution_v11_buggy")
public void getExecution_v11_buggy() throws Exception{
RundeckClient client = createClient(TEST_TOKEN_7, 11);
RundeckExecution execution = client.getExecution(945L);
Assert.assertEquals("echo test trigger_adhoc_command", execution.getDescription());
Assert.assertEquals("2 seconds", execution.getDuration());
Assert.assertEquals("test", execution.getProject());
Assert.assertEquals("admin", execution.getStartedBy());
Assert.assertEquals(null, execution.getJob());
Assert.assertEquals(null, execution.getAbortedBy());
}
@Test
@Betamax(tape = "get_executions",
mode = TapeMode.READ_ONLY,
@ -401,6 +442,132 @@ public class RundeckClientTest {
.build(), 2L, 0L);
assertPageResults(adhocTest, 2, 2, 2, 0, 2);
}
@Test
@Betamax(tape = "get_executions_v11",
mode = TapeMode.READ_ONLY,
match = {MatchRule.uri, MatchRule.headers, MatchRule.method, MatchRule.path, MatchRule.query})
public void getExecutionsV11() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
final String projectName = "blah";
final PagedResults<RundeckExecution> jobTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.job("test job")
.build(),
2L,
0L);
assertPageResults(jobTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> jobExactTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.jobExact("test job")
.build(),
2L,
0L);
assertPageResults(jobExactTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> excludeJobTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.excludeJob("test job")
.build(),
2L,
0L);
assertPageResults(excludeJobTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> excludeJobExactTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.excludeJobExact("test job")
.build(),
2L,
0L);
assertPageResults(excludeJobExactTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> descriptionTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.description("a description")
.build(), 2L, 0L);
assertPageResults(descriptionTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> abortedbyTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.abortedby("admin")
.build(),
2L,
0L);
assertPageResults(abortedbyTest, 1, 1, 2, 0, 1);
final PagedResults<RundeckExecution> beginTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.begin(new Date(1347581178168L))
.build(), 2L, 0L);
assertPageResults(beginTest, 2, 2, 2, 0, 6);
final PagedResults<RundeckExecution> endTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.end(new Date(1415388156385L))
.build(), 2L, 0L);
assertPageResults(endTest, 2, 2, 2, 0, 4);
final List<String> excludeJobIdList = Arrays.asList("123", "456");
final PagedResults<RundeckExecution> excludeJobIdListTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.excludeJobIdList(excludeJobIdList)
.build(), 2L, 0L);
assertPageResults(excludeJobIdListTest, 2, 2, 2, 0, 4);
final List<String> jobList = Arrays.asList("fruit/mango", "fruit/lemon");
final PagedResults<RundeckExecution> jobListTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.jobList(jobList)
.build(), 2L, 0L);
assertPageResults(jobListTest, 2, 2, 2, 0, 2);
final List<String> excludeJobList = Arrays.asList("a/path/job1", "path/to/job2");
final PagedResults<RundeckExecution> excludeJobListTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.excludeJobList(excludeJobList)
.build(), 2L, 0L);
assertPageResults(excludeJobListTest, 2, 2, 2, 0, 4);
final List<String> list = Arrays.asList("9aa33253-17a3-4dce-890c-e5f10f9f00d6",
"2dd94199-00c4-4690-9b4d-beda4812bed0");
final PagedResults<RundeckExecution> jobIdListTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.jobIdList(list)
.build(), 2L, 0L);
assertPageResults(jobIdListTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> groupPathTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.groupPath("fruit")
.build(),
2L,
0L);
assertPageResults(groupPathTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> groupPathExactTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.groupPathExact("fruit")
.build(), 2L, 0L);
assertPageResults(groupPathExactTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> excludeGroupPathTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.excludeGroupPath("fruit")
.build(),
2L,
0L);
assertPageResults(excludeGroupPathTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> excliudeGroupPathExactTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.excludeGroupPathExact("fruit")
.build(), 2L, 0L);
assertPageResults(excliudeGroupPathExactTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> recentTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.recent("1h").build(), 2L, 0L);
assertPageResults(recentTest, 2, 2, 2, 0, 2);
final PagedResults<RundeckExecution> statusTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.status(RundeckExecution.ExecutionStatus.SUCCEEDED)
.build(), 2L, 0L);
assertPageResults(statusTest, 2, 2, 2, 0, 3);
final PagedResults<RundeckExecution> adhocTest = client.getExecutions(ExecutionQuery.builder()
.project(projectName)
.adhoc(true)
.build(), 2L, 0L);
assertPageResults(adhocTest, 2, 2, 2, 0, 2);
}
/**
* Test paging values from results
@ -508,6 +675,48 @@ public class RundeckClientTest {
}
/**
* API v11 request to trigger job, with expected xml response without &lt;result&gt; wrapper
* @throws Exception
*/
@Test
@Betamax(tape = "trigger_job_basic_v11")
public void triggerJobBasic_v11() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
final RundeckExecution test
= client.triggerJob(RunJobBuilder.builder().setJobId("bda8b956-43a5-4eef-9c67" +
"-3f27cc0ee1a5").build());
Assert.assertEquals((Long) 943L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
/**
* Response for API v11 incorrectly includes &lt;result&gt;, but we should handle this case
* @throws Exception
*/
@Test
@Betamax(tape = "trigger_job_basic_v11_patch")
public void triggerJobBasic_v11_patch() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
final RundeckExecution test
= client.triggerJob(RunJobBuilder.builder().setJobId("bda8b956-43a5-4eef-9c67" +
"-3f27cc0ee1a5").build());
Assert.assertEquals((Long) 944L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("echo hi there ${job.username} ; sleep 90", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
@Test
@Betamax(tape = "trigger_job_as_user")
public void triggerJobAsUser() throws Exception {
@ -566,6 +775,43 @@ public class RundeckClientTest {
Assert.assertEquals(RundeckExecution.ExecutionStatus.SUCCEEDED, test.getStatus());
}
@Test
@Betamax(tape = "trigger_adhoc_command_v11_buggy")
public void triggerAdhocCommand_v11_buggy() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
final RundeckExecution test
= client.triggerAdhocCommand(RunAdhocCommandBuilder.builder()
.setProject("test")
.setCommand("echo test trigger_adhoc_command")
.build());
Assert.assertEquals((Long) 945L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("echo test trigger_adhoc_command", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
@Test
@Betamax(tape = "trigger_adhoc_command_v11")
public void triggerAdhocCommand_v11() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
final RundeckExecution test
= client.triggerAdhocCommand(RunAdhocCommandBuilder.builder()
.setProject("test")
.setCommand("echo test trigger_adhoc_command")
.build());
Assert.assertEquals((Long) 946L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("echo test trigger_adhoc_command", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
@Test
@Betamax(tape = "trigger_adhoc_command_as_user")
@ -630,6 +876,54 @@ public class RundeckClientTest {
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
/**
* Handle incorrect &lt;result&gt; wrapper for v11 response
* @throws Exception
*/
@Test
@Betamax(tape = "trigger_adhoc_script_v11_buggy")
public void triggerAdhocScript_v11_buggy() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
String script = "#!/bin/bash\n" +
"echo test trigger_adhoc_script\n";
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes());
final RundeckExecution test
= client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript
(byteArrayInputStream).build());
Assert.assertEquals((Long) 947L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
/**
* Handle v11 response without &lt;result&gt; wrapper
* @throws Exception
*/
@Test
@Betamax(tape = "trigger_adhoc_script_v11")
public void triggerAdhocScript_v11() throws Exception {
RundeckClient client = createClient(TEST_TOKEN_7, 11);
String script = "#!/bin/bash\n" +
"echo test trigger_adhoc_script\n";
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(script.getBytes());
final RundeckExecution test
= client.triggerAdhocScript(RunAdhocScriptBuilder.builder().setProject("test").setScript
(byteArrayInputStream).build());
Assert.assertEquals((Long) 948L, test.getId());
Assert.assertEquals(null, test.getArgstring());
Assert.assertEquals(null, test.getAbortedBy());
Assert.assertEquals("#!/bin/bash\necho test trigger_adhoc_script", test.getDescription());
Assert.assertEquals("admin", test.getStartedBy());
Assert.assertEquals(RundeckExecution.ExecutionStatus.RUNNING, test.getStatus());
}
@Test
@Betamax(tape = "trigger_adhoc_script_as_user")
public void triggerAdhocScriptAsUser() throws Exception {
@ -1516,6 +1810,159 @@ public class RundeckClientTest {
}
/**
* delete executions with failure
*/
@Test
@Betamax(tape = "delete_executions_unauthorized", mode = TapeMode.READ_ONLY)
public void deleteExecutionsUnauthorized() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
final DeleteExecutionsResponse response = client.deleteExecutions(
new HashSet<Long>() {{
add(640L);
add(641L);
}}
);
Assert.assertEquals(2, response.getRequestCount());
Assert.assertEquals(0, response.getSuccessCount());
Assert.assertEquals(2, response.getFailedCount());
Assert.assertFalse(response.isAllsuccessful());
Assert.assertNotNull(response.getFailures());
Assert.assertEquals(2, response.getFailures().size());
Assert.assertEquals(Long.valueOf(641L), response.getFailures().get(0).getExecutionId());
Assert.assertEquals(
"Unauthorized: Delete execution in project test",
response.getFailures().get(0).getMessage()
);
Assert.assertEquals(Long.valueOf(640L), response.getFailures().get(1).getExecutionId());
Assert.assertEquals(
"Unauthorized: Delete execution in project test",
response.getFailures().get(1).getMessage()
);
}
/**
* delete executions with success
*/
@Test
@Betamax(tape = "delete_executions_success", mode = TapeMode.READ_ONLY)
public void deleteExecutionsSuccess() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
final DeleteExecutionsResponse response = client.deleteExecutions(
new HashSet<Long>() {{
add(640L);
add(641L);
}}
);
Assert.assertEquals(2, response.getRequestCount());
Assert.assertEquals(2, response.getSuccessCount());
Assert.assertEquals(0, response.getFailedCount());
Assert.assertTrue(response.isAllsuccessful());
Assert.assertNotNull(response.getFailures());
Assert.assertEquals(0, response.getFailures().size());
}
/**
* delete executions mixed success
*/
@Test
@Betamax(tape = "delete_executions_mixed", mode = TapeMode.READ_ONLY)
public void deleteExecutionsMixed() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
final DeleteExecutionsResponse response = client.deleteExecutions(
new HashSet<Long>() {{
add(642L);
add(640L);
add(1640L);
}}
);
Assert.assertEquals(3, response.getRequestCount());
Assert.assertEquals(1, response.getSuccessCount());
Assert.assertEquals(2, response.getFailedCount());
Assert.assertFalse(response.isAllsuccessful());
Assert.assertNotNull(response.getFailures());
Assert.assertEquals(2, response.getFailures().size());
Assert.assertEquals(Long.valueOf(1640L), response.getFailures().get(0).getExecutionId());
Assert.assertEquals(
"Execution Not found: 1640",
response.getFailures().get(0).getMessage()
);
Assert.assertEquals(Long.valueOf(640L), response.getFailures().get(1).getExecutionId());
Assert.assertEquals(
"Execution Not found: 640",
response.getFailures().get(1).getMessage()
);
}
/**
* delete executions with failure
*/
@Test
@Betamax(tape = "delete_all_job_executions_unauthorized", mode = TapeMode.READ_ONLY)
public void deleteAllJobExecutionsUnauthorized() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
try {
final DeleteExecutionsResponse response = client.deleteAllJobExecutions(
"764c1209-68ed-4185-8d43-a739364bf156"
);
Assert.fail();
} catch (RundeckApiException.RundeckApiTokenException e) {
e.printStackTrace();
}
}
/**
*
* @throws Exception
*/
@Test
@Betamax(tape = "delete_all_job_executions_success", mode = TapeMode.READ_ONLY)
public void deleteAllJobExecutionsSuccess() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
final DeleteExecutionsResponse response = client.deleteAllJobExecutions(
"764c1209-68ed-4185-8d43-a739364bf156"
);
Assert.assertEquals(2, response.getRequestCount());
Assert.assertEquals(2, response.getSuccessCount());
Assert.assertEquals(0, response.getFailedCount());
Assert.assertTrue(response.isAllsuccessful());
Assert.assertNotNull(response.getFailures());
Assert.assertEquals(0, response.getFailures().size());
}
/**
* delete single execution success
*/
@Test
@Betamax(tape = "delete_execution_success", mode = TapeMode.READ_ONLY)
public void deleteExecutionSuccess() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
client.deleteExecution(643L);
}
/**
* delete single execution failure (does not exist)
*/
@Test
@Betamax(tape = "delete_execution_failure", mode = TapeMode.READ_ONLY)
public void deleteExecutionFailure() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
try {
client.deleteExecution(640L);
Assert.fail();
} catch (RundeckApiException.RundeckApiHttpStatusException e) {
Assert.assertEquals(404, e.getStatusCode());
}
}
/**
* delete single execution null input
*/
@Test
public void deleteExecutionNullInput() throws Exception {
final RundeckClient client = createClient(TEST_TOKEN_8, 12);
try {
client.deleteExecution(null);
Assert.fail();
} catch (IllegalArgumentException e) {
}
}
@Before
public void setUp() throws Exception {
// not that you can put whatever here, because we don't actually connect to the RunDeck instance

View file

@ -0,0 +1,23 @@
!tape
name: delete_all_job_executions_success
interactions:
- recorded: 2014-11-06T18:03:44.789Z
request:
method: DELETE
uri: http://rundeck.local:4440/api/12/job/764c1209-68ed-4185-8d43-a739364bf156/executions
headers:
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 12
X-RunDeck-Auth-Token: GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=cqqoff205qus10sz1v3t54rk7;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGRlbGV0ZUV4ZWN1dGlvbnMgcmVxdWVzdENvdW50PScyJyBhbGxzdWNjZXNzZnVsPSd0cnVlJz4KICA8c3VjY2Vzc2Z1bCBjb3VudD0nMicgLz4KPC9kZWxldGVFeGVjdXRpb25zPg==

View file

@ -0,0 +1,21 @@
!tape
name: delete_all_job_executions_unauthorized
interactions:
- recorded: 2014-11-06T17:57:02.905Z
request:
method: DELETE
uri: http://rundeck.local:4440/api/12/job/764c1209-68ed-4185-8d43-a739364bf156/executions
headers:
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 12
X-RunDeck-Auth-Token: GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI
response:
status: 403
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=splzhkd5xunl1noidus2o7im3;Path=/
X-Rundeck-API-Version: '12'
body: "<result error='true' apiversion='12'>\n <error code='api.error.item.unauthorized'>\n <message>Not authorized for action \"Delete Execution\" for Project test</message>\n </error>\n</result>"

View file

@ -0,0 +1,21 @@
!tape
name: delete_execution_failure
interactions:
- recorded: 2014-11-06T17:45:47.952Z
request:
method: DELETE
uri: http://rundeck.local:4440/api/12/execution/640
headers:
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 12
X-RunDeck-Auth-Token: GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI
response:
status: 404
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1eynpbisggwsy18ax352yya8k0;Path=/
X-Rundeck-API-Version: '12'
body: "<result error='true' apiversion='12'>\n <error code='api.error.item.doesnotexist'>\n <message>Execution ID does not exist: 640</message>\n </error>\n</result>"

View file

@ -0,0 +1,19 @@
!tape
name: delete_execution_success
interactions:
- recorded: 2014-11-06T17:45:47.749Z
request:
method: DELETE
uri: http://rundeck.local:4440/api/12/execution/643
headers:
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 12
X-RunDeck-Auth-Token: GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI
response:
status: 204
headers:
Content-Type: text/html;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1hlysemt7deir1j9r7l6ildg5x;Path=/

View file

@ -0,0 +1,26 @@
!tape
name: delete_executions_mixed
interactions:
- recorded: 2014-11-06T17:29:44.266Z
request:
method: POST
uri: http://rundeck.local:4440/api/12/executions/delete
headers:
Accept: text/xml
Content-Type: application/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
User-Agent: RunDeck API Java Client 12
X-RunDeck-Auth-Token: GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=smlj6wcfe4yccemt6bptnmgy;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGRlbGV0ZUV4ZWN1dGlvbnMgcmVxdWVzdENvdW50PSczJyBhbGxzdWNjZXNzZnVsPSdmYWxzZSc+CiAgPHN1Y2Nlc3NmdWwgY291bnQ9JzEnIC8+CiAgPGZhaWxlZCBjb3VudD0nMic+CiAgICA8ZXhlY3V0aW9uIGlkPScxNjQwJyBtZXNzYWdlPSdFeGVjdXRpb24gTm90IGZvdW5kOiAxNjQwJyAvPgogICAgPGV4ZWN1dGlvbiBpZD0nNjQwJyBtZXNzYWdlPSdFeGVjdXRpb24gTm90IGZvdW5kOiA2NDAnIC8+CiAgPC9mYWlsZWQ+CjwvZGVsZXRlRXhlY3V0aW9ucz4=

View file

@ -0,0 +1,26 @@
!tape
name: delete_executions_success
interactions:
- recorded: 2014-11-06T17:24:56.487Z
request:
method: POST
uri: http://rundeck.local:4440/api/12/executions/delete
headers:
Accept: text/xml
Content-Type: application/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
User-Agent: RunDeck API Java Client 12
X-RunDeck-Auth-Token: GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1xueq6cjfrsnxjn43hcfadqyk;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGRlbGV0ZUV4ZWN1dGlvbnMgcmVxdWVzdENvdW50PScyJyBhbGxzdWNjZXNzZnVsPSd0cnVlJz4KICA8c3VjY2Vzc2Z1bCBjb3VudD0nMicgLz4KPC9kZWxldGVFeGVjdXRpb25zPg==

View file

@ -0,0 +1,26 @@
!tape
name: delete_executions_success
interactions:
- recorded: 2014-11-06T17:15:24.673Z
request:
method: POST
uri: http://rundeck.local:4440/api/12/executions/delete
headers:
Accept: text/xml
Content-Type: application/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
User-Agent: RunDeck API Java Client 12
X-RunDeck-Auth-Token: GG7uj1y6UGahOs7QlmeN2sIwz1Y2j7zI
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1kzmot0r2scpjfxlcpfthh7tz;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGRlbGV0ZUV4ZWN1dGlvbnMgcmVxdWVzdENvdW50PScyJyBhbGxzdWNjZXNzZnVsPSdmYWxzZSc+CiAgPHN1Y2Nlc3NmdWwgY291bnQ9JzAnIC8+CiAgPGZhaWxlZCBjb3VudD0nMic+CiAgICA8ZXhlY3V0aW9uIGlkPSc2NDEnIG1lc3NhZ2U9J1VuYXV0aG9yaXplZDogRGVsZXRlIGV4ZWN1dGlvbiBpbiBwcm9qZWN0IHRlc3QnIC8+CiAgICA8ZXhlY3V0aW9uIGlkPSc2NDAnIG1lc3NhZ2U9J1VuYXV0aG9yaXplZDogRGVsZXRlIGV4ZWN1dGlvbiBpbiBwcm9qZWN0IHRlc3QnIC8+CiAgPC9mYWlsZWQ+CjwvZGVsZXRlRXhlY3V0aW9ucz4=

View file

@ -0,0 +1,25 @@
!tape
name: get_execution
interactions:
- recorded: 2014-11-10T19:43:41.415Z
request:
method: GET
uri: http://rundeck.local:4440/api/5/execution/945
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 5
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1x4pkxxmmforonss2ga8ylvdc;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'true'
body: "<result success='true' apiversion='12'>\n <executions count='1'>\n <execution id='945' href='http://dignan:4440/execution/follow/945' status='succeeded' project='test'>\n <user>admin</user>\n <date-started unixtime='1415647116739'>2014-11-10T19:18:36Z</date-started>\n\
\ <date-ended unixtime='1415647118931'>2014-11-10T19:18:38Z</date-ended>\n <description>echo test trigger_adhoc_command</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n \
\ </execution>\n </executions>\n</result>"

View file

@ -0,0 +1,24 @@
!tape
name: get_execution_v11
interactions:
- recorded: 2014-11-10T19:44:57.642Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/execution/945
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=yzyycrxo7utb154qrsuggbtp6;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbnMgY291bnQ9JzEnPgogIDxleGVjdXRpb24gaWQ9Jzk0NScgaHJlZj0naHR0cDovL2RpZ25hbjo0NDQwL2V4ZWN1dGlvbi9mb2xsb3cvOTQ1JyBzdGF0dXM9J3N1Y2NlZWRlZCcgcHJvamVjdD0ndGVzdCc+CiAgICA8dXNlcj5hZG1pbjwvdXNlcj4KICAgIDxkYXRlLXN0YXJ0ZWQgdW5peHRpbWU9JzE0MTU2NDcxMTY3MzknPjIwMTQtMTEtMTBUMTk6MTg6MzZaPC9kYXRlLXN0YXJ0ZWQ+CiAgICA8ZGF0ZS1lbmRlZCB1bml4dGltZT0nMTQxNTY0NzExODkzMSc+MjAxNC0xMS0xMFQxOToxODozOFo8L2RhdGUtZW5kZWQ+CiAgICA8ZGVzY3JpcHRpb24+ZWNobyB0ZXN0IHRyaWdnZXJfYWRob2NfY29tbWFuZDwvZGVzY3JpcHRpb24+CiAgICA8YXJnc3RyaW5nIC8+CiAgICA8c3VjY2Vzc2Z1bE5vZGVzPgogICAgICA8bm9kZSBuYW1lPSdkaWduYW4nIC8+CiAgICA8L3N1Y2Nlc3NmdWxOb2Rlcz4KICA8L2V4ZWN1dGlvbj4KPC9leGVjdXRpb25zPg==

View file

@ -0,0 +1,24 @@
!tape
name: get_execution_v11_buggy
interactions:
- recorded: 2014-11-10T19:47:33.973Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/execution/945
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=prilmlypvi8r14cvs72xu9865;Path=/
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='1'>\n <execution id='945' href='http://dignan:4440/execution/follow/945' status='succeeded' project='test'>\n <user>admin</user>\n <date-started unixtime='1415647116739'>2014-11-10T19:18:36Z</date-started>\n\
\ <date-ended unixtime='1415647118931'>2014-11-10T19:18:38Z</date-ended>\n <description>echo test trigger_adhoc_command</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n \
\ </execution>\n </executions>\n</result>"

View file

@ -38,7 +38,7 @@ interactions:
- recorded: 2012-09-14T22:04:13.342Z
request:
method: GET
uri: http://rundeck.local:4440/api/5/executions?project=blah&begin=2012-09-13T17%3A06%3A18Z&max=2&offset=0
uri: http://rundeck.local:4440/api/5/executions?project=blah&begin=2012-09-14T00%3A06%3A18Z&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
@ -54,7 +54,7 @@ interactions:
- recorded: 2012-09-14T22:04:13.404Z
request:
method: GET
uri: http://rundeck.local:4440/api/5/executions?project=blah&end=2012-09-13T17%3A06%3A18Z&max=2&offset=0
uri: http://rundeck.local:4440/api/5/executions?project=blah&end=2012-09-14T00%3A06%3A18Z&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440

View file

@ -0,0 +1,419 @@
!tape
name: get_executions_v11
interactions:
- recorded: 2014-11-07T23:18:13.076Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?jobFilter=test+job&project=blah&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1jt4f1ctz8i6rfsou34u5suz2;Path=/
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='937' href='http://dignan:4440/execution/follow/937' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386304167'>2014-11-07T18:51:44Z</date-started>\n <date-ended unixtime='1415386309757'>2014-11-07T18:51:49Z</date-ended>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n\
\ <group></group>\n <project>blah</project>\n <description>a description</description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='936' href='http://dignan:4440/execution/follow/936' status='aborted' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386292080'>2014-11-07T18:51:32Z</date-started>\n <date-ended unixtime='1415386299535'>2014-11-07T18:51:39Z</date-ended>\n\
\ <abortedby>admin</abortedby>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n <group></group>\n <project>blah</project>\n <description>a description</description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:18:13.426Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?jobExactFilter=test+job&project=blah&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='937' href='http://dignan:4440/execution/follow/937' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386304167'>2014-11-07T18:51:44Z</date-started>\n <date-ended unixtime='1415386309757'>2014-11-07T18:51:49Z</date-ended>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n\
\ <group></group>\n <project>blah</project>\n <description>a description</description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='936' href='http://dignan:4440/execution/follow/936' status='aborted' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386292080'>2014-11-07T18:51:32Z</date-started>\n <date-ended unixtime='1415386299535'>2014-11-07T18:51:39Z</date-ended>\n\
\ <abortedby>admin</abortedby>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n <group></group>\n <project>blah</project>\n <description>a description</description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:18:13.591Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?excludeJobFilter=test+job&project=blah&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:18:13.748Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?excludeJobExactFilter=test+job&project=blah&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:18:13.897Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&descFilter=a+description&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='937' href='http://dignan:4440/execution/follow/937' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386304167'>2014-11-07T18:51:44Z</date-started>\n <date-ended unixtime='1415386309757'>2014-11-07T18:51:49Z</date-ended>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n\
\ <group></group>\n <project>blah</project>\n <description>a description</description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='936' href='http://dignan:4440/execution/follow/936' status='aborted' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386292080'>2014-11-07T18:51:32Z</date-started>\n <date-ended unixtime='1415386299535'>2014-11-07T18:51:39Z</date-ended>\n\
\ <abortedby>admin</abortedby>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n <group></group>\n <project>blah</project>\n <description>a description</description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:18:14.025Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&abortedbyFilter=admin&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='1' total='1' offset='0' max='2'>\n <execution id='936' href='http://dignan:4440/execution/follow/936' status='aborted' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386292080'>2014-11-07T18:51:32Z</date-started>\n <date-ended unixtime='1415386299535'>2014-11-07T18:51:39Z</date-ended>\n <abortedby>admin</abortedby>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n\
\ <name>test job</name>\n <group></group>\n <project>blah</project>\n <description>a description</description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <failedNodes>\n <node\
\ name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:18:14.155Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&begin=2012-09-14T00%3A06%3A18Z&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='6' offset='0' max='2'>\n <execution id='941' href='http://dignan:4440/execution/follow/941' status='failed' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415402275736'>2014-11-07T23:17:55Z</date-started>\n\
\ <date-ended unixtime='1415402276329'>2014-11-07T23:17:56Z</date-ended>\n <description>echo bye ; false</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n <execution\
\ id='940' href='http://dignan:4440/execution/follow/940' status='failed' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415402267951'>2014-11-07T23:17:47Z</date-started>\n <date-ended unixtime='1415402270687'>2014-11-07T23:17:50Z</date-ended>\n\
\ <description>echo hi ; false</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:50.560Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&end=2014-11-07T19%3A22%3A36Z&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1olgmevldd8n2d4lib3pzifep;Path=/
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='4' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:50.701Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&excludeJobIdListFilter=123&excludeJobIdListFilter=456&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='4' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:50.837Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&jobListFilter=fruit%2Fmango&jobListFilter=fruit%2Flemon&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:50.966Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&excludeJobListFilter=a%2Fpath%2Fjob1&excludeJobListFilter=path%2Fto%2Fjob2&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='4' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:51.097Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&jobIdListFilter=9aa33253-17a3-4dce-890c-e5f10f9f00d6&jobIdListFilter=2dd94199-00c4-4690-9b4d-beda4812bed0&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:51.229Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&groupPath=fruit&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:51.358Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&groupPathExact=fruit&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:51.483Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&excludeGroupPath=fruit&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='937' href='http://dignan:4440/execution/follow/937' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386304167'>2014-11-07T18:51:44Z</date-started>\n <date-ended unixtime='1415386309757'>2014-11-07T18:51:49Z</date-ended>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n\
\ <group></group>\n <project>blah</project>\n <description>a description</description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='936' href='http://dignan:4440/execution/follow/936' status='aborted' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386292080'>2014-11-07T18:51:32Z</date-started>\n <date-ended unixtime='1415386299535'>2014-11-07T18:51:39Z</date-ended>\n\
\ <abortedby>admin</abortedby>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n <group></group>\n <project>blah</project>\n <description>a description</description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:51.607Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&excludeGroupPathExact=fruit&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='937' href='http://dignan:4440/execution/follow/937' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386304167'>2014-11-07T18:51:44Z</date-started>\n <date-ended unixtime='1415386309757'>2014-11-07T18:51:49Z</date-ended>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n\
\ <group></group>\n <project>blah</project>\n <description>a description</description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='936' href='http://dignan:4440/execution/follow/936' status='aborted' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386292080'>2014-11-07T18:51:32Z</date-started>\n <date-ended unixtime='1415386299535'>2014-11-07T18:51:39Z</date-ended>\n\
\ <abortedby>admin</abortedby>\n <job id='5985a8cb-d155-4585-9fe0-c2342e07c999' averageDuration='5590'>\n <name>test job</name>\n <group></group>\n <project>blah</project>\n <description>a description</description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:51.724Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&recentFilter=1h&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='941' href='http://dignan:4440/execution/follow/941' status='failed' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415402275736'>2014-11-07T23:17:55Z</date-started>\n\
\ <date-ended unixtime='1415402276329'>2014-11-07T23:17:56Z</date-ended>\n <description>echo bye ; false</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n <execution\
\ id='940' href='http://dignan:4440/execution/follow/940' status='failed' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415402267951'>2014-11-07T23:17:47Z</date-started>\n <date-ended unixtime='1415402270687'>2014-11-07T23:17:50Z</date-ended>\n\
\ <description>echo hi ; false</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:19:51.845Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&statusFilter=succeeded&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='3' offset='0' max='2'>\n <execution id='939' href='http://dignan:4440/execution/follow/939' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started\
\ unixtime='1415386450856'>2014-11-07T18:54:10Z</date-started>\n <date-ended unixtime='1415386456531'>2014-11-07T18:54:16Z</date-ended>\n <job id='2dd94199-00c4-4690-9b4d-beda4812bed0' averageDuration='5675'>\n <name>mango</name>\n \
\ <group>fruit</group>\n <project>blah</project>\n <description></description>\n </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n\
\ </execution>\n <execution id='938' href='http://dignan:4440/execution/follow/938' status='succeeded' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415386448511'>2014-11-07T18:54:08Z</date-started>\n <date-ended\
\ unixtime='1415386454083'>2014-11-07T18:54:14Z</date-ended>\n <job id='9aa33253-17a3-4dce-890c-e5f10f9f00d6' averageDuration='5572'>\n <name>lemon</name>\n <group>fruit</group>\n <project>blah</project>\n <description></description>\n\
\ </job>\n <description>sleep 5</description>\n <argstring />\n <successfulNodes>\n <node name='dignan' />\n </successfulNodes>\n </execution>\n </executions>\n</result>"
- recorded: 2014-11-07T23:20:12.975Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/executions?project=blah&adhoc=true&max=2&offset=0
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=11ubcx5ejb1sr6nycorkmdrg3;Path=/
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='2' total='2' offset='0' max='2'>\n <execution id='941' href='http://dignan:4440/execution/follow/941' status='failed' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415402275736'>2014-11-07T23:17:55Z</date-started>\n\
\ <date-ended unixtime='1415402276329'>2014-11-07T23:17:56Z</date-ended>\n <description>echo bye ; false</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n <execution\
\ id='940' href='http://dignan:4440/execution/follow/940' status='failed' project='blah'>\n <user>admin</user>\n <date-started unixtime='1415402267951'>2014-11-07T23:17:47Z</date-started>\n <date-ended unixtime='1415402270687'>2014-11-07T23:17:50Z</date-ended>\n\
\ <description>echo hi ; false</description>\n <argstring />\n <failedNodes>\n <node name='dignan' />\n </failedNodes>\n </execution>\n </executions>\n</result>"

View file

@ -0,0 +1,43 @@
!tape
name: trigger_adhoc_command_v11
interactions:
- recorded: 2014-11-10T19:37:31.471Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/run/command?project=test&exec=echo+test+trigger_adhoc_command
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1lzqzroq2oz9d1oiwcyb9qjsk8;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbiBpZD0nOTQ2JyAvPg==
- recorded: 2014-11-10T19:37:31.807Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/execution/946
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbnMgY291bnQ9JzEnPgogIDxleGVjdXRpb24gaWQ9Jzk0NicgaHJlZj0naHR0cDovL2RpZ25hbjo0NDQwL2V4ZWN1dGlvbi9mb2xsb3cvOTQ2JyBzdGF0dXM9J3J1bm5pbmcnIHByb2plY3Q9J3Rlc3QnPgogICAgPHVzZXI+YWRtaW48L3VzZXI+CiAgICA8ZGF0ZS1zdGFydGVkIHVuaXh0aW1lPScxNDE1NjQ4MjUxMTg0Jz4yMDE0LTExLTEwVDE5OjM3OjMxWjwvZGF0ZS1zdGFydGVkPgogICAgPGRlc2NyaXB0aW9uPmVjaG8gdGVzdCB0cmlnZ2VyX2FkaG9jX2NvbW1hbmQ8L2Rlc2NyaXB0aW9uPgogICAgPGFyZ3N0cmluZyAvPgogIDwvZXhlY3V0aW9uPgo8L2V4ZWN1dGlvbnM+

View file

@ -0,0 +1,42 @@
!tape
name: trigger_adhoc_command_v11_buggy
interactions:
- recorded: 2014-11-10T19:18:37.071Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/run/command?project=test&exec=echo+test+trigger_adhoc_command
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=jjryjdfuxtdw1808gclmb7uuj;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbiBpZD0nOTQ1JyAvPg==
- recorded: 2014-11-10T19:18:37.444Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/execution/945
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='1'>\n <execution id='945' href='http://dignan:4440/execution/follow/945' status='running' project='test'>\n <user>admin</user>\n <date-started unixtime='1415647116739'>2014-11-10T19:18:36Z</date-started>\n\
\ <description>echo test trigger_adhoc_command</description>\n <argstring />\n </execution>\n </executions>\n</result>"

View file

@ -0,0 +1,45 @@
!tape
name: trigger_adhoc_script_v11
interactions:
- recorded: 2014-11-10T20:04:36.573Z
request:
method: POST
uri: http://rundeck.local:4440/api/11/run/script?project=test
headers:
Accept: text/xml
Content-Type: multipart/form-data; boundary=W2S1I8XOmvOWsdnLEHprcw3N6cQveJEm_aV17Oz
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=18uoooauscne2eqtuq466djm;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbiBpZD0nOTQ4JyAvPg==
- recorded: 2014-11-10T20:04:36.876Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/execution/948
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbnMgY291bnQ9JzEnPgogIDxleGVjdXRpb24gaWQ9Jzk0OCcgaHJlZj0naHR0cDovL2RpZ25hbjo0NDQwL2V4ZWN1dGlvbi9mb2xsb3cvOTQ4JyBzdGF0dXM9J3J1bm5pbmcnIHByb2plY3Q9J3Rlc3QnPgogICAgPHVzZXI+YWRtaW48L3VzZXI+CiAgICA8ZGF0ZS1zdGFydGVkIHVuaXh0aW1lPScxNDE1NjQ5ODc2MzA1Jz4yMDE0LTExLTEwVDIwOjA0OjM2WjwvZGF0ZS1zdGFydGVkPgogICAgPGRlc2NyaXB0aW9uPiMhL2Jpbi9iYXNoCmVjaG8gdGVzdCB0cmlnZ2VyX2FkaG9jX3NjcmlwdAo8L2Rlc2NyaXB0aW9uPgogICAgPGFyZ3N0cmluZyAvPgogIDwvZXhlY3V0aW9uPgo8L2V4ZWN1dGlvbnM+

View file

@ -0,0 +1,44 @@
!tape
name: trigger_adhoc_script_v11_buggy
interactions:
- recorded: 2014-11-10T19:54:03.631Z
request:
method: POST
uri: http://rundeck.local:4440/api/11/run/script?project=test
headers:
Accept: text/xml
Content-Type: multipart/form-data; boundary=7ijcD_EYqXFXKLau3Bg9Oy0PIqf37Vn
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=z5e76c45acya1h081pryh4avz;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbiBpZD0nOTQ3JyAvPg==
- recorded: 2014-11-10T19:54:03.770Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/execution/947
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Server: Jetty(7.6.0.v20120127)
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='1'>\n <execution id='947' href='http://dignan:4440/execution/follow/947' status='running' project='test'>\n <user>admin</user>\n <date-started unixtime='1415649243468'>2014-11-10T19:54:03Z</date-started>\n\
\ <description>#!/bin/bash\necho test trigger_adhoc_script\n</description>\n <argstring />\n </execution>\n </executions>\n</result>"

View file

@ -0,0 +1,24 @@
!tape
name: trigger_job_basic_v11
interactions:
- recorded: 2014-11-08T00:00:58.749Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/job/bda8b956-43a5-4eef-9c67-3f27cc0ee1a5/run
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: application/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=19ui1v6otua3h1714jv2zbkbid;Path=/
X-Rundeck-API-Version: '12'
X-Rundeck-API-XML-Response-Wrapper: 'false'
body: !!binary |-
PGV4ZWN1dGlvbnMgY291bnQ9JzEnPgogIDxleGVjdXRpb24gaWQ9Jzk0MycgaHJlZj0naHR0cDovL2RpZ25hbjo0NDQwL2V4ZWN1dGlvbi9mb2xsb3cvOTQzJyBzdGF0dXM9J3J1bm5pbmcnIHByb2plY3Q9J2RlbW8nPgogICAgPHVzZXI+YWRtaW48L3VzZXI+CiAgICA8ZGF0ZS1zdGFydGVkIHVuaXh0aW1lPScxNDE1NDA0ODU4NTE4Jz4yMDE0LTExLTA4VDAwOjAwOjU4WjwvZGF0ZS1zdGFydGVkPgogICAgPGpvYiBpZD0nYmRhOGI5NTYtNDNhNS00ZWVmLTljNjctM2YyN2NjMGVlMWE1Jz4KICAgICAgPG5hbWU+YSBqb2I8L25hbWU+CiAgICAgIDxncm91cD48L2dyb3VwPgogICAgICA8cHJvamVjdD5kZW1vPC9wcm9qZWN0PgogICAgICA8ZGVzY3JpcHRpb24+PC9kZXNjcmlwdGlvbj4KICAgIDwvam9iPgogICAgPGRlc2NyaXB0aW9uPmVjaG8gaGkgdGhlcmUgJHtqb2IudXNlcm5hbWV9IDsgc2xlZXAgOTA8L2Rlc2NyaXB0aW9uPgogICAgPGFyZ3N0cmluZyAvPgogIDwvZXhlY3V0aW9uPgo8L2V4ZWN1dGlvbnM+

View file

@ -0,0 +1,24 @@
!tape
name: trigger_job_basic_v11_patch
interactions:
- recorded: 2014-11-08T00:05:15.235Z
request:
method: GET
uri: http://rundeck.local:4440/api/11/job/bda8b956-43a5-4eef-9c67-3f27cc0ee1a5/run
headers:
Accept: text/xml
Host: rundeck.local:4440
Proxy-Connection: Keep-Alive
User-Agent: RunDeck API Java Client 11
X-RunDeck-Auth-Token: 8Dp9op111ER6opsDRkddvE86K9sE499s
response:
status: 200
headers:
Content-Type: text/xml;charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: Jetty(7.6.0.v20120127)
Set-Cookie: JSESSIONID=1dfooymrwshimhr8fe4ncoc93;Path=/
X-Rundeck-API-Version: '12'
body: "<result success='true' apiversion='12'>\n <executions count='1'>\n <execution id='944' href='http://dignan:4440/execution/follow/944' status='running' project='demo'>\n <user>admin</user>\n <date-started unixtime='1415405114785'>2014-11-08T00:05:14Z</date-started>\n\
\ <job id='bda8b956-43a5-4eef-9c67-3f27cc0ee1a5' averageDuration='90593'>\n <name>a job</name>\n <group></group>\n <project>demo</project>\n <description></description>\n </job>\n <description>echo hi there ${job.username}\
\ ; sleep 90</description>\n <argstring />\n </execution>\n </executions>\n</result>"