-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from Kitware/jobs-endpoint
fix(io): added jobs endpoint
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
export default function({client, filterQuery, mustContain, busy}) { | ||
return { | ||
// GET /jobs List all jobs for a given user | ||
getJobs(offset, limit){ | ||
if (offset && limit) { | ||
return busy(client._.get(`/jobs?offset=${offset}&limit=${limit}`)); | ||
} else if (offset) { | ||
return busy(client._.get(`/jobs?offset=${offset}`)); | ||
} else if (limit) { | ||
return busy(client._.get(`/jobs?limit=${limit}`)); | ||
} | ||
|
||
return busy(client._.get('/jobs')); | ||
}, | ||
|
||
// POST /jobs Create a new job | ||
createJob(params){ | ||
return busy(client._.post('/jobs', params)); | ||
}, | ||
|
||
// GET /jobs/{id} Get a job | ||
getJob(id){ | ||
return busy(client._.post(`/jobs/${id}`)); | ||
}, | ||
|
||
// PATCH /jobs/{id} Update the job | ||
updateJob(id, params) { | ||
return busy(client._.patch(`/jobs/${id}`, params)); | ||
}, | ||
|
||
// DELETE /jobs/{id} Delete a job | ||
deleteJob(id) { | ||
return busy(client._.delete(`/jobs/${id}`)); | ||
}, | ||
|
||
// GET /jobs/{id}/log Get log entries for job | ||
getJobLog(id, offset){ | ||
if (offset) { | ||
return busy(client._.get(`/jobs/${id}/log?offset=${offset}`)); | ||
} | ||
return busy(client._.get(`/jobs/${id}/log`)); | ||
}, | ||
|
||
// GET /jobs/{id}/output Get output entries for job | ||
getJobOutput(id, path, offset){ | ||
if (offset) { | ||
return busy(client._.get(`/jobs/${id}/output?path=${path}&offset=${offset}`)); | ||
} | ||
return busy(client._.get(`/jobs/${id}/output?path=${path}`)); | ||
}, | ||
|
||
// GET /jobs/{id}/status Get the status of a job | ||
getJobStatus(id){ | ||
return busy(client._.get(`/jobs/${id}/status`)); | ||
}, | ||
|
||
// PUT /jobs/{id}/terminate Terminate a job | ||
terminateJob(id){ | ||
return busy(client._.put(`/jobs/${id}/terminate`)); | ||
}, | ||
}; | ||
} |