mirror of
https://github.com/Fishwaldo/rundeck-api-java-client.git
synced 2025-07-10 06:58:47 +00:00
Update for changes to v5 executions query api
This commit is contained in:
parent
2960f59cc8
commit
8b75c4770d
4 changed files with 163 additions and 8 deletions
|
@ -46,9 +46,13 @@ class ExecutionQueryParameters extends QueryParameterBuilder {
|
||||||
|
|
||||||
seen |= visit("jobFilter", query.getJob(), doPost, builder);
|
seen |= visit("jobFilter", query.getJob(), doPost, builder);
|
||||||
seen |= visit("jobExactFilter", query.getJobExact(), doPost, builder);
|
seen |= visit("jobExactFilter", query.getJobExact(), doPost, builder);
|
||||||
|
seen |= visit("excludeJobFilter", query.getExcludeJob(), doPost, builder);
|
||||||
|
seen |= visit("excludeJobExactFilter", query.getExcludeJobExact(), doPost, builder);
|
||||||
seen |= visit("project", query.getProject(), doPost, builder);
|
seen |= visit("project", query.getProject(), doPost, builder);
|
||||||
seen |= visit("groupPath", query.getGroupPath(), doPost, builder);
|
seen |= visit("groupPath", query.getGroupPath(), doPost, builder);
|
||||||
seen |= visit("groupPathExact", query.getGroupPathExact(), doPost, builder);
|
seen |= visit("groupPathExact", query.getGroupPathExact(), doPost, builder);
|
||||||
|
seen |= visit("excludeGroupPath", query.getExcludeGroupPath(), doPost, builder);
|
||||||
|
seen |= visit("excludeGroupPathExact", query.getExcludeGroupPathExact(), doPost, builder);
|
||||||
seen |= visit("descFilter", query.getDescription(), doPost, builder);
|
seen |= visit("descFilter", query.getDescription(), doPost, builder);
|
||||||
seen |= visit("userFilter", query.getUser(), doPost, builder);
|
seen |= visit("userFilter", query.getUser(), doPost, builder);
|
||||||
if(null!=query.getAdhoc()){
|
if(null!=query.getAdhoc()){
|
||||||
|
|
|
@ -48,9 +48,13 @@ public class ExecutionQuery {
|
||||||
private String recent;
|
private String recent;
|
||||||
private String job;
|
private String job;
|
||||||
private String jobExact;
|
private String jobExact;
|
||||||
|
private String excludeJob;
|
||||||
|
private String excludeJobExact;
|
||||||
private String project;
|
private String project;
|
||||||
private String groupPath;
|
private String groupPath;
|
||||||
private String groupPathExact;
|
private String groupPathExact;
|
||||||
|
private String excludeGroupPath;
|
||||||
|
private String excludeGroupPathExact;
|
||||||
private String user;
|
private String user;
|
||||||
private String description;
|
private String description;
|
||||||
private Boolean adhoc;
|
private Boolean adhoc;
|
||||||
|
@ -70,9 +74,13 @@ public class ExecutionQuery {
|
||||||
this.recent = query.getRecent();
|
this.recent = query.getRecent();
|
||||||
this.job = query.getJob();
|
this.job = query.getJob();
|
||||||
this.jobExact = query.getJobExact();
|
this.jobExact = query.getJobExact();
|
||||||
|
this.excludeJob = query.getExcludeJob();
|
||||||
|
this.excludeJobExact = query.getExcludeJobExact();
|
||||||
this.project = query.getProject();
|
this.project = query.getProject();
|
||||||
this.groupPath = query.getGroupPath();
|
this.groupPath = query.getGroupPath();
|
||||||
this.groupPathExact = query.getGroupPathExact();
|
this.groupPathExact = query.getGroupPathExact();
|
||||||
|
this.excludeGroupPath = query.getExcludeGroupPath();
|
||||||
|
this.excludeGroupPathExact = query.getExcludeGroupPathExact();
|
||||||
this.description = query.getDescription();
|
this.description = query.getDescription();
|
||||||
this.user = query.getUser();
|
this.user = query.getUser();
|
||||||
this.adhoc = query.getAdhoc();
|
this.adhoc = query.getAdhoc();
|
||||||
|
@ -87,8 +95,12 @@ public class ExecutionQuery {
|
||||||
!StringUtils.isBlank(recent) ||
|
!StringUtils.isBlank(recent) ||
|
||||||
!StringUtils.isBlank(job) ||
|
!StringUtils.isBlank(job) ||
|
||||||
!StringUtils.isBlank(jobExact) ||
|
!StringUtils.isBlank(jobExact) ||
|
||||||
|
!StringUtils.isBlank(excludeJob) ||
|
||||||
|
!StringUtils.isBlank(excludeJobExact) ||
|
||||||
!StringUtils.isBlank(groupPath) ||
|
!StringUtils.isBlank(groupPath) ||
|
||||||
!StringUtils.isBlank(groupPathExact) ||
|
!StringUtils.isBlank(groupPathExact) ||
|
||||||
|
!StringUtils.isBlank(excludeGroupPath) ||
|
||||||
|
!StringUtils.isBlank(excludeGroupPathExact) ||
|
||||||
!StringUtils.isBlank(description) ||
|
!StringUtils.isBlank(description) ||
|
||||||
//boolean
|
//boolean
|
||||||
(null!=adhoc) ||
|
(null!=adhoc) ||
|
||||||
|
@ -178,6 +190,22 @@ public class ExecutionQuery {
|
||||||
return adhoc;
|
return adhoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getExcludeJob() {
|
||||||
|
return excludeJob;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExcludeJobExact() {
|
||||||
|
return excludeJobExact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExcludeGroupPath() {
|
||||||
|
return excludeGroupPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExcludeGroupPathExact() {
|
||||||
|
return excludeGroupPathExact;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder for ExecutionQueries
|
* Builder for ExecutionQueries
|
||||||
|
@ -276,6 +304,21 @@ public class ExecutionQuery {
|
||||||
query.jobExact = exact;
|
query.jobExact = exact;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Job name filter to exclude, which can match any part of the name
|
||||||
|
*/
|
||||||
|
public Builder excludeJob(String job) {
|
||||||
|
query.excludeJob = job;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Job exact name filter to exclude, much match exactly
|
||||||
|
*/
|
||||||
|
public Builder excludeJobExact(String exact) {
|
||||||
|
query.excludeJobExact = exact;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project name
|
* Project name
|
||||||
|
@ -294,12 +337,27 @@ public class ExecutionQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exact group path match
|
* Exact group path to include
|
||||||
*/
|
*/
|
||||||
public Builder groupPathExact(String exact) {
|
public Builder groupPathExact(String exact) {
|
||||||
query.groupPathExact = exact;
|
query.groupPathExact = exact;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Group path or super path, which will exclude any jobs within the subtree.
|
||||||
|
*/
|
||||||
|
public Builder excludeGroupPath(String excludeGroupPath) {
|
||||||
|
query.excludeGroupPath = excludeGroupPath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exact group path to exclude
|
||||||
|
*/
|
||||||
|
public Builder excludeGroupPathExact(String excludeGroupPathExact) {
|
||||||
|
query.excludeGroupPathExact = excludeGroupPathExact;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Job description match
|
* Job description match
|
||||||
|
|
|
@ -140,6 +140,27 @@ public class RundeckClientTest {
|
||||||
2L,
|
2L,
|
||||||
0L);
|
0L);
|
||||||
Assert.assertEquals(2, jobTest.size());
|
Assert.assertEquals(2, jobTest.size());
|
||||||
|
final List<RundeckExecution> jobExactTest = client.getExecutions(ExecutionQuery.builder()
|
||||||
|
.project(projectName)
|
||||||
|
.jobExact("test job")
|
||||||
|
.build(),
|
||||||
|
2L,
|
||||||
|
0L);
|
||||||
|
Assert.assertEquals(2, jobExactTest.size());
|
||||||
|
final List<RundeckExecution> excludeJobTest = client.getExecutions(ExecutionQuery.builder()
|
||||||
|
.project(projectName)
|
||||||
|
.excludeJob("test job")
|
||||||
|
.build(),
|
||||||
|
2L,
|
||||||
|
0L);
|
||||||
|
Assert.assertEquals(2, excludeJobTest.size());
|
||||||
|
final List<RundeckExecution> excludeJobExactTest = client.getExecutions(ExecutionQuery.builder()
|
||||||
|
.project(projectName)
|
||||||
|
.excludeJobExact("test job")
|
||||||
|
.build(),
|
||||||
|
2L,
|
||||||
|
0L);
|
||||||
|
Assert.assertEquals(2, excludeJobExactTest.size());
|
||||||
final List<RundeckExecution> descriptionTest = client.getExecutions(ExecutionQuery.builder()
|
final List<RundeckExecution> descriptionTest = client.getExecutions(ExecutionQuery.builder()
|
||||||
.project(projectName)
|
.project(projectName)
|
||||||
.description("a description")
|
.description("a description")
|
||||||
|
@ -199,13 +220,19 @@ public class RundeckClientTest {
|
||||||
.groupPathExact("fruit")
|
.groupPathExact("fruit")
|
||||||
.build(), 2L, 0L);
|
.build(), 2L, 0L);
|
||||||
Assert.assertEquals(2, groupPathExactTest.size());
|
Assert.assertEquals(2, groupPathExactTest.size());
|
||||||
final List<RundeckExecution> jobExactTest = client.getExecutions(ExecutionQuery.builder()
|
|
||||||
.project(projectName)
|
final List<RundeckExecution> excludeGroupPathTest = client.getExecutions(ExecutionQuery.builder()
|
||||||
.jobExact("test job")
|
.project(projectName)
|
||||||
.build(),
|
.excludeGroupPath("fruit")
|
||||||
2L,
|
.build(),
|
||||||
0L);
|
2L,
|
||||||
Assert.assertEquals(2, jobExactTest.size());
|
0L);
|
||||||
|
Assert.assertEquals(2, excludeGroupPathTest.size());
|
||||||
|
final List<RundeckExecution> excliudeGroupPathExactTest = client.getExecutions(ExecutionQuery.builder()
|
||||||
|
.project(projectName)
|
||||||
|
.excludeGroupPathExact("fruit")
|
||||||
|
.build(), 2L, 0L);
|
||||||
|
Assert.assertEquals(2, excliudeGroupPathExactTest.size());
|
||||||
|
|
||||||
final List<RundeckExecution> recentTest = client.getExecutions(ExecutionQuery.builder()
|
final List<RundeckExecution> recentTest = client.getExecutions(ExecutionQuery.builder()
|
||||||
.project(projectName)
|
.project(projectName)
|
||||||
|
|
|
@ -247,3 +247,69 @@ interactions:
|
||||||
Server: Jetty(6.1.21)
|
Server: Jetty(6.1.21)
|
||||||
Set-Cookie: JSESSIONID=1ciy2jy8y2agx;Path=/
|
Set-Cookie: JSESSIONID=1ciy2jy8y2agx;Path=/
|
||||||
body: <result success='true' apiversion='5'><executions count='1'><execution id='30' href='http://Venkman.local:4440/execution/follow/30' status='aborted'><user>admin</user><date-started unixtime='1347581285308'>2012-09-14T00:08:05Z</date-started><date-ended unixtime='1347581288381'>2012-09-14T00:08:08Z</date-ended><abortedby>admin</abortedby><job id='c545bdba-c823-4fa8-bbfd-3364e8cc8ba5'><name>test job2</name><group></group><project>blah</project><description>a description to test</description></job><description>echo this is a test [... 2 steps]</description><argstring/></execution></executions></result>
|
body: <result success='true' apiversion='5'><executions count='1'><execution id='30' href='http://Venkman.local:4440/execution/follow/30' status='aborted'><user>admin</user><date-started unixtime='1347581285308'>2012-09-14T00:08:05Z</date-started><date-ended unixtime='1347581288381'>2012-09-14T00:08:08Z</date-ended><abortedby>admin</abortedby><job id='c545bdba-c823-4fa8-bbfd-3364e8cc8ba5'><name>test job2</name><group></group><project>blah</project><description>a description to test</description></job><description>echo this is a test [... 2 steps]</description><argstring/></execution></executions></result>
|
||||||
|
- recorded: 2012-09-22T00:05:27.273Z
|
||||||
|
request:
|
||||||
|
method: GET
|
||||||
|
uri: http://rundeck.local:4440/api/5/executions?excludeJobFilter=test+job&project=blah&max=2&offset=0
|
||||||
|
headers:
|
||||||
|
Host: rundeck.local:4440
|
||||||
|
Proxy-Connection: Keep-Alive
|
||||||
|
User-Agent: RunDeck API Java Client 5
|
||||||
|
X-RunDeck-Auth-Token: 0UUNkeRp4d58EDeCs7S6UdODp334DvK9
|
||||||
|
response:
|
||||||
|
status: 200
|
||||||
|
headers:
|
||||||
|
Content-Type: text/xml; charset=utf-8
|
||||||
|
Expires: Thu, 01 Jan 1970 00:00:00 GMT
|
||||||
|
Server: Jetty(6.1.21)
|
||||||
|
Set-Cookie: JSESSIONID=1php90lpv6wvm;Path=/
|
||||||
|
body: <result success='true' apiversion='5'><executions count='2'><execution id='34' href='http://Venkman.local:4440/execution/follow/34' status='succeeded'><user>admin</user><date-started unixtime='1347660234844'>2012-09-14T22:03:54Z</date-started><date-ended unixtime='1347660234934'>2012-09-14T22:03:54Z</date-ended><job id='62a26001-b9fe-430a-8ba1-92cf04c10bba'><name>bonkers job</name><group></group><project>blah</project><description></description></job><description>echo why</description><argstring/></execution><execution id='32' href='http://Venkman.local:4440/execution/follow/32' status='failed'><user>admin</user><date-started unixtime='1347644775513'>2012-09-14T17:46:15Z</date-started><date-ended unixtime='1347644775663'>2012-09-14T17:46:15Z</date-ended><job id='1f4415d7-3b52-4fc8-ba42-b6ac97508bff'><name>lemon</name><group>fruit</group><project>blah</project><description></description></job><description>echo lemon lemon [... 2 steps]</description><argstring/></execution></executions></result>
|
||||||
|
- recorded: 2012-09-22T00:05:27.376Z
|
||||||
|
request:
|
||||||
|
method: GET
|
||||||
|
uri: http://rundeck.local:4440/api/5/executions?excludeJobExactFilter=test+job&project=blah&max=2&offset=0
|
||||||
|
headers:
|
||||||
|
Host: rundeck.local:4440
|
||||||
|
Proxy-Connection: Keep-Alive
|
||||||
|
User-Agent: RunDeck API Java Client 5
|
||||||
|
X-RunDeck-Auth-Token: 0UUNkeRp4d58EDeCs7S6UdODp334DvK9
|
||||||
|
response:
|
||||||
|
status: 200
|
||||||
|
headers:
|
||||||
|
Content-Type: text/xml; charset=utf-8
|
||||||
|
Server: Jetty(6.1.21)
|
||||||
|
body: <result success='true' apiversion='5'><executions count='2'><execution id='34' href='http://Venkman.local:4440/execution/follow/34' status='succeeded'><user>admin</user><date-started unixtime='1347660234844'>2012-09-14T22:03:54Z</date-started><date-ended unixtime='1347660234934'>2012-09-14T22:03:54Z</date-ended><job id='62a26001-b9fe-430a-8ba1-92cf04c10bba'><name>bonkers job</name><group></group><project>blah</project><description></description></job><description>echo why</description><argstring/></execution><execution id='32' href='http://Venkman.local:4440/execution/follow/32' status='failed'><user>admin</user><date-started unixtime='1347644775513'>2012-09-14T17:46:15Z</date-started><date-ended unixtime='1347644775663'>2012-09-14T17:46:15Z</date-ended><job id='1f4415d7-3b52-4fc8-ba42-b6ac97508bff'><name>lemon</name><group>fruit</group><project>blah</project><description></description></job><description>echo lemon lemon [... 2 steps]</description><argstring/></execution></executions></result>
|
||||||
|
- recorded: 2012-09-22T00:08:25.613Z
|
||||||
|
request:
|
||||||
|
method: GET
|
||||||
|
uri: http://rundeck.local:4440/api/5/executions?project=blah&excludeGroupPath=fruit&max=2&offset=0
|
||||||
|
headers:
|
||||||
|
Host: rundeck.local:4440
|
||||||
|
Proxy-Connection: Keep-Alive
|
||||||
|
User-Agent: RunDeck API Java Client 5
|
||||||
|
X-RunDeck-Auth-Token: 0UUNkeRp4d58EDeCs7S6UdODp334DvK9
|
||||||
|
response:
|
||||||
|
status: 200
|
||||||
|
headers:
|
||||||
|
Content-Type: text/xml; charset=utf-8
|
||||||
|
Expires: Thu, 01 Jan 1970 00:00:00 GMT
|
||||||
|
Server: Jetty(6.1.21)
|
||||||
|
Set-Cookie: JSESSIONID=173p2d55pbnsv;Path=/
|
||||||
|
body: <result success='true' apiversion='5'><executions count='2'><execution id='34' href='http://Venkman.local:4440/execution/follow/34' status='succeeded'><user>admin</user><date-started unixtime='1347660234844'>2012-09-14T22:03:54Z</date-started><date-ended unixtime='1347660234934'>2012-09-14T22:03:54Z</date-ended><job id='62a26001-b9fe-430a-8ba1-92cf04c10bba'><name>bonkers job</name><group></group><project>blah</project><description></description></job><description>echo why</description><argstring/></execution><execution id='33' href='http://Venkman.local:4440/execution/follow/33' status='succeeded'><user>admin</user><date-started unixtime='1347660078157'>2012-09-14T22:01:18Z</date-started><date-ended unixtime='1347660078425'>2012-09-14T22:01:18Z</date-ended><job id='4cfdfc23-be50-4a23-b291-b8a98897813b'><name>test job</name><group></group><project>blah</project><description></description></job><description>echo this is a test</description><argstring/></execution></executions></result>
|
||||||
|
- recorded: 2012-09-22T00:20:49.353Z
|
||||||
|
request:
|
||||||
|
method: GET
|
||||||
|
uri: http://rundeck.local:4440/api/5/executions?project=blah&excludeGroupPathExact=fruit&max=2&offset=0
|
||||||
|
headers:
|
||||||
|
Host: rundeck.local:4440
|
||||||
|
Proxy-Connection: Keep-Alive
|
||||||
|
User-Agent: RunDeck API Java Client 5
|
||||||
|
X-RunDeck-Auth-Token: 0UUNkeRp4d58EDeCs7S6UdODp334DvK9
|
||||||
|
response:
|
||||||
|
status: 200
|
||||||
|
headers:
|
||||||
|
Content-Type: text/xml; charset=utf-8
|
||||||
|
Expires: Thu, 01 Jan 1970 00:00:00 GMT
|
||||||
|
Server: Jetty(6.1.21)
|
||||||
|
Set-Cookie: JSESSIONID=1gkaasiblkk34;Path=/
|
||||||
|
body: <result success='true' apiversion='5'><executions count='2'><execution id='34' href='http://Venkman.local:4440/execution/follow/34' status='succeeded'><user>admin</user><date-started unixtime='1347660234844'>2012-09-14T22:03:54Z</date-started><date-ended unixtime='1347660234934'>2012-09-14T22:03:54Z</date-ended><job id='62a26001-b9fe-430a-8ba1-92cf04c10bba'><name>bonkers job</name><group></group><project>blah</project><description></description></job><description>echo why</description><argstring/></execution><execution id='33' href='http://Venkman.local:4440/execution/follow/33' status='succeeded'><user>admin</user><date-started unixtime='1347660078157'>2012-09-14T22:01:18Z</date-started><date-ended unixtime='1347660078425'>2012-09-14T22:01:18Z</date-ended><job id='4cfdfc23-be50-4a23-b291-b8a98897813b'><name>test job</name><group></group><project>blah</project><description></description></job><description>echo this is a test</description><argstring/></execution></executions></result>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue