job-scheduler
job-scheduler copied to clipboard
[Extensions] Delete Job Details API
Is your feature request related to a problem? Please describe. Create a Delete Job Details Rest API with documentId as a input parameter. It will help to delete job details objects with issues with the help of API
Describe the solution you'd like API input and output
Input: documentId = String
Output: status of the operation (DELETED or NOT_FOUND)
Prerequisites
- Have knowledge of how actionlisteners work to make async calls
- Have knowledge of the code-flow of RestGetJobDetailsAction
Additional context
- create RestDeleteJobDetailsAction in path org.opensearch.jobscheduler.action
- RestDeleteJobDetailsAction should extend abstract class BaseRestHandler
- Override routes() and prepareRequest() method in RestDeleteJobDetailsAction class
- Define two static strings in class
- public static final String DELETE_JOB_DETAILS_ACTION = "delete_job_details_action";
- public static final String DOCUMENT_ID = "document_id";
- In routes method return a list of route with given Route below
new Route(DELETE, String.format(Locale.ROOT, "%s/%s/{%s}", JobSchedulerPlugin.JS_BASE_URI, "_delete_job_details", DOCUMENT_ID))
- Override getName() method and return DELETE_JOB_DETAILS_ACTION
- Create a public constructor in RestDeleteJobDetailsAction with JobDetailsService as argument and initialize the local variable
public RestDeleteJobDetailsAction(JobDetailsService jobDetailsService){
this.jobDetailsService=jobDetailsService;
}
- call jobDetailsService.deleteJobDetails
- Return channel response