handlePauseJob pauses a running job.
(w http.ResponseWriter, r *http.Request)
| 306 | |
| 307 | // handlePauseJob pauses a running job. |
| 308 | func (s *Server) handlePauseJob(w http.ResponseWriter, r *http.Request) { |
| 309 | id := r.PathValue("id") |
| 310 | if id == "" { |
| 311 | writeError(w, http.StatusBadRequest, "Missing job ID", "") |
| 312 | return |
| 313 | } |
| 314 | |
| 315 | if s.jobs.PauseJob(id) { |
| 316 | writeJSON(w, http.StatusOK, SuccessResponse{ |
| 317 | Success: true, |
| 318 | Message: "Job paused", |
| 319 | }) |
| 320 | } else { |
| 321 | writeError(w, http.StatusNotFound, "Job not found or not running", "") |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | // handleResumeJob resumes a paused job. |
| 326 | func (s *Server) handleResumeJob(w http.ResponseWriter, r *http.Request) { |
nothing calls this directly
no test coverage detected