public class JobRequest extends VaultRequest
HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_VAULT_CLIENT_ID, vaultClient
Modifier and Type | Method and Description |
---|---|
JobHistoryResponse |
retrieveJobHistories()
Retrieve Job Histories
|
JobMonitorResponse |
retrieveJobMonitors()
Retrieve Job Monitors
|
JobStatusResponse |
retrieveJobStatus(int jobId)
Retrieve Job Status
|
JobTaskResponse |
retrieveJobTasks(int jobId)
Retrieve Job Tasks
|
JobRequest |
setEndDate(ZonedDateTime endDate)
Sets the date to end retrieving completed jobs, in the format YYYY-MM-DDTHH:MM:SSZ.
|
JobRequest |
setLimit(String limit)
Paginate the results by specifying the maximum number of histories per page in the response.
|
JobRequest |
setOffset(String offset)
Paginate the results displayed per page by specifying
the amount of offset from the first job history returned.
|
JobRequest |
setStartDate(ZonedDateTime startDate)
Sets the date to start retrieving completed jobs, in the format YYYY-MM-DDTHH:MM:SSZ.
|
JobRequest |
setStats(String status)
Filter to only retrieve jobs in a certain status.
|
JobCreateResponse |
startJob(int jobId)
Start Job
|
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setVaultClient
public JobHistoryResponse retrieveJobHistories()
Retrieve a history of all completed jobs in the authenticated vault. A completed job is any job which has started and finished running, including jobs which did not complete successfully. In-progress or queued jobs do not appear here.
GET /api/{version}/services/jobs/{job_id}/tasks
JobHistoryResponse response = vaultClient.newRequest(JobRequest.class).retrieveJobHistories();
System.out.println("Status = " + response.getResponseStatus()); if (response.isSuccessful()) { System.out.println("Url = " + response.getUrl()); }
public JobMonitorResponse retrieveJobMonitors()
Retrieve monitors for jobs which have not yet completed in the authenticated vault. An uncompleted job is any job which has not finished running, such as scheduled, queued, or actively running jobs. Completed jobs do not appear here.
GET /api/{version}/services/jobs/monitors
JobMonitorResponse response = vaultClient.newRequest(JobRequest.class).retrieveJobMonitors();
System.out.println("Status = " + response.getResponseStatus()); if (response.isSuccessful()) { System.out.println("Url = " + response.getUrl()); }
public JobStatusResponse retrieveJobStatus(int jobId)
After submitting a request, you can query your vault to determine the status of the request. To do this, you must have a valid job_id for a job previously requested through the API.
The Job Status endpoint can only be requested once every 10 seconds. When this limit is reached, Vault returns API_LIMIT_EXCEEDED.
jobId
- job idGET /api/{version}/services/jobs/{job_id}
JobStatusResponse response = vaultClient.newRequest(JobRequest.class).retrieveJobStatus(jobId);
if ((response != null) && (!response.hasErrors()) && (response.getData() != null)) { JobStatusResponse.Job job = response.getData(); if (job.getRunEndDate() != null) { System.out.println("Made it!"); } }
public JobTaskResponse retrieveJobTasks(int jobId)
Retrieve the tasks associated with an SDK job.
jobId
- job idGET /api/{version}/services/jobs/{job_id}/tasks
JobTaskResponse response = vaultClient.newRequest(JobRequest.class).retrieveJobTasks(jobId);
System.out.println("Status = " + response.getResponseStatus()); if (response.isSuccessful()) { System.out.println("Number of Tasks = " + response.getResponseDetails().getTotal()); System.out.println("Url = " + response.getUrl()); }
public JobCreateResponse startJob(int jobId)
Moves up a scheduled job instance to start immediately. Each time a user calls this API, Vault cancels the next scheduled instance of the specified job. For example, calling this API against a scheduled daily job three times would cause the job to not run according to its schedule for three days. Once the affected Job ID is complete, Vault will schedule the next instance. This is analogous to the Start Now option in the Vault UI.
jobId
- job idPOST /api/{version}/services/jobs/start_now/{job_id}
JobCreateResponse response = vaultClient.newRequest(JobRequest.class).startJob(jobId);
System.out.println("Status = " + response.getResponseStatus()); if (response.isSuccessful()) { System.out.println("JobId = " + response.getJobId()); System.out.println("Url = " + response.getUrl()); }
public JobRequest setEndDate(ZonedDateTime endDate)
endDate
- end datepublic JobRequest setLimit(String limit)
limit
- the size of the result set in the pagepublic JobRequest setOffset(String offset)
offset
- page offsetpublic JobRequest setStats(String status)
status
- job statuspublic JobRequest setStartDate(ZonedDateTime startDate)
startDate
- start dateCopyright © 2021. All rights reserved.