job-scheduler icon indicating copy to clipboard operation
job-scheduler copied to clipboard

[Extensions] Delete Job Details API

Open vibrantvarun opened this issue 2 years ago • 11 comments

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

  1. Have knowledge of how actionlisteners work to make async calls
  2. Have knowledge of the code-flow of RestGetJobDetailsAction

Additional context

  1. create RestDeleteJobDetailsAction in path org.opensearch.jobscheduler.action
  2. RestDeleteJobDetailsAction should extend abstract class BaseRestHandler
  3. Override routes() and prepareRequest() method in RestDeleteJobDetailsAction class
  4. Define two static strings in class
  5. public static final String DELETE_JOB_DETAILS_ACTION = "delete_job_details_action";
  6. public static final String DOCUMENT_ID = "document_id";
  7. 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))
  8. Override getName() method and return DELETE_JOB_DETAILS_ACTION
  9. Create a public constructor in RestDeleteJobDetailsAction with JobDetailsService as argument and initialize the local variable
public RestDeleteJobDetailsAction(JobDetailsService jobDetailsService){
this.jobDetailsService=jobDetailsService;
}
  1. call jobDetailsService.deleteJobDetails
  2. Return channel response

vibrantvarun avatar Feb 13 '23 21:02 vibrantvarun