| 34 | } |
| 35 | |
| 36 | func (h *Handler) Awaken(w http.ResponseWriter, r *http.Request) { |
| 37 | var api userconfig.Resource |
| 38 | if err := json.NewDecoder(r.Body).Decode(&api); err != nil { |
| 39 | http.Error(w, "failed to json decode request body", http.StatusBadRequest) |
| 40 | return |
| 41 | } |
| 42 | defer func() { _ = r.Body.Close() }() |
| 43 | |
| 44 | if err := h.autoscaler.Awaken(api); err != nil { |
| 45 | http.Error(w, errors.Wrap(err, "failed to awaken api").Error(), http.StatusInternalServerError) |
| 46 | telemetry.Error(err) |
| 47 | return |
| 48 | } |
| 49 | |
| 50 | w.WriteHeader(http.StatusOK) |
| 51 | } |