Skip to content

Commit f5b6a14

Browse files
author
Derek Smart
committed
get job list and running jobs
Signed-off-by: Derek Smart <derek.smart@delphix.com>
1 parent 72ac03a commit f5b6a14

File tree

1 file changed

+20
-0
lines changed
  • src/main/kotlin/com/delphix/yamlparser/sdk/repos

1 file changed

+20
-0
lines changed

src/main/kotlin/com/delphix/yamlparser/sdk/repos/Job.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ class Job (
1313
) {
1414
val resource: String = "/resources/json/delphix/job"
1515

16+
fun list(): List<JobObj> {
17+
var jobs = mutableListOf<JobObj>()
18+
val response = http.handleGet("$resource").getJSONArray("result")
19+
for (i in 0 until response.length()) {
20+
val job = response.getJSONObject(i);
21+
jobs.add(JobObj.fromJson(job))
22+
}
23+
return jobs
24+
}
25+
26+
fun getWhereRunning(): List<JobObj> {
27+
var jobs = mutableListOf<JobObj>()
28+
val response = http.handleGet("$resource?jobState=RUNNING").getJSONArray("result")
29+
for (i in 0 until response.length()) {
30+
val job = response.getJSONObject(i);
31+
jobs.add(JobObj.fromJson(job))
32+
}
33+
return jobs
34+
}
35+
1636
fun get(ref: String): JobObj {
1737
val response = http.handleGet("$resource/$ref")
1838
val job = JobObj.fromJson(response.getJSONObject("result"))

0 commit comments

Comments
 (0)