Add pause resume and abort controls
This commit is contained in:
@@ -41,6 +41,8 @@ func New(socket string, svc *service.Service, log *slog.Logger) *Server {
|
||||
mux.HandleFunc("GET /v1/workloads/{kind}", s.workloads)
|
||||
mux.HandleFunc("POST /v1/jobs/{id}/run", s.runJob)
|
||||
mux.HandleFunc("POST /v1/runs/{id}/cancel", s.cancelRun)
|
||||
mux.HandleFunc("POST /v1/runs/{id}/pause", s.pauseRun)
|
||||
mux.HandleFunc("POST /v1/runs/{id}/resume", s.resumeRun)
|
||||
mux.HandleFunc("POST /v1/repositories/{id}/test", s.testRepository)
|
||||
mux.HandleFunc("POST /v1/repositories/{id}/init", s.initRepository)
|
||||
mux.HandleFunc("POST /v1/repositories/{id}/{action}", s.maintenance)
|
||||
@@ -157,6 +159,22 @@ func (s *Server) cancelRun(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(204)
|
||||
}
|
||||
|
||||
func (s *Server) pauseRun(w http.ResponseWriter, r *http.Request) {
|
||||
if err := s.service.Pause(r.PathValue("id")); err != nil {
|
||||
writeError(w, err)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(204)
|
||||
}
|
||||
|
||||
func (s *Server) resumeRun(w http.ResponseWriter, r *http.Request) {
|
||||
if err := s.service.Resume(r.PathValue("id")); err != nil {
|
||||
writeError(w, err)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(204)
|
||||
}
|
||||
|
||||
func (s *Server) testRepository(w http.ResponseWriter, r *http.Request) {
|
||||
s.repositoryAction(w, r, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user