feat: add runner failover policies and traces
This commit is contained in:
@@ -19,6 +19,31 @@ func (s *Server) listRuntimePolicySets(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, http.StatusOK, map[string]any{"items": items})
|
||||
}
|
||||
|
||||
func (s *Server) getRunnerPolicy(w http.ResponseWriter, r *http.Request) {
|
||||
item, err := s.store.GetActiveRunnerPolicy(r.Context())
|
||||
if err != nil {
|
||||
s.logger.Error("get runner policy failed", "error", err)
|
||||
writeError(w, http.StatusInternalServerError, "get runner policy failed")
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, item)
|
||||
}
|
||||
|
||||
func (s *Server) updateRunnerPolicy(w http.ResponseWriter, r *http.Request) {
|
||||
var input store.RunnerPolicyInput
|
||||
if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
|
||||
writeError(w, http.StatusBadRequest, "invalid json body")
|
||||
return
|
||||
}
|
||||
item, err := s.store.UpsertDefaultRunnerPolicy(r.Context(), input)
|
||||
if err != nil {
|
||||
s.logger.Error("update runner policy failed", "error", err)
|
||||
writeError(w, http.StatusInternalServerError, "update runner policy failed")
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, item)
|
||||
}
|
||||
|
||||
func (s *Server) createRuntimePolicySet(w http.ResponseWriter, r *http.Request) {
|
||||
var input store.RuntimePolicySetInput
|
||||
if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user