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

Method DeleteOverrides

pkg/overrides/api.go:129–143  ·  view source on GitHub ↗

DeleteOverrides removes tenant-specific overrides

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

127
128// DeleteOverrides removes tenant-specific overrides
129func (a *API) DeleteOverrides(w http.ResponseWriter, r *http.Request) {
130 userID, _, err := users.ExtractTenantIDFromHTTPRequest(r)
131 if err != nil {
132 http.Error(w, err.Error(), http.StatusBadRequest)
133 return
134 }
135
136 if err := a.deleteOverridesFromBucket(r.Context(), userID); err != nil {
137 level.Error(a.logger).Log("msg", "failed to delete overrides from bucket", "userID", userID, "err", err)
138 http.Error(w, "Internal server error", http.StatusInternalServerError)
139 return
140 }
141
142 w.WriteHeader(http.StatusOK)
143}
144
145// getOverridesFromBucket reads overrides for a specific tenant from the runtime config file
146func (a *API) getOverridesFromBucket(ctx context.Context, userID string) (map[string]any, error) {

Callers 2

TestAPIEndpointsFunction · 0.80
TestAPIBucketErrorsFunction · 0.80

Calls 5

ErrorMethod · 0.45
ContextMethod · 0.45
LogMethod · 0.45

Tested by 2

TestAPIEndpointsFunction · 0.64
TestAPIBucketErrorsFunction · 0.64