MCPcopy Index your code
hub / github.com/cortexproject/cortex / deactivateConfig

Method deactivateConfig

pkg/configs/api/api.go:304–324  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

302}
303
304func (a *API) deactivateConfig(w http.ResponseWriter, r *http.Request) {
305 userID, _, err := users.ExtractTenantIDFromHTTPRequest(r)
306 if err != nil {
307 http.Error(w, err.Error(), http.StatusUnauthorized)
308 return
309 }
310 logger := util_log.WithContext(r.Context(), util_log.Logger)
311
312 if err := a.db.DeactivateConfig(r.Context(), userID); err != nil {
313 if err == sql.ErrNoRows {
314 level.Info(logger).Log("msg", "deactivate config - no configuration", "userID", userID)
315 http.Error(w, "No configuration", http.StatusNotFound)
316 return
317 }
318 level.Error(logger).Log("msg", "error deactivating config", "err", err)
319 http.Error(w, err.Error(), http.StatusInternalServerError)
320 return
321 }
322 level.Info(logger).Log("msg", "config deactivated", "userID", userID)
323 w.WriteHeader(http.StatusOK)
324}
325
326func (a *API) restoreConfig(w http.ResponseWriter, r *http.Request) {
327 userID, _, err := users.ExtractTenantIDFromHTTPRequest(r)

Callers

nothing calls this directly

Calls 5

DeactivateConfigMethod · 0.65
ErrorMethod · 0.45
ContextMethod · 0.45
LogMethod · 0.45

Tested by

no test coverage detected