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

Function respondAccepted

pkg/ruler/api.go:422–438  ·  view source on GitHub ↗
(w http.ResponseWriter, logger log.Logger)

Source from the content-addressed store, hash-verified

420}
421
422func respondAccepted(w http.ResponseWriter, logger log.Logger) {
423 b, err := json.Marshal(&util_api.Response{
424 Status: "success",
425 })
426 if err != nil {
427 level.Error(logger).Log("msg", "error marshaling json response", "err", err)
428 util_api.RespondError(logger, w, v1.ErrServer, "unable to marshal the requested data", http.StatusInternalServerError)
429 return
430 }
431 w.Header().Set("Content-Type", "application/json")
432
433 // Return a status accepted because the rule has been stored and queued for polling, but is not currently active
434 w.WriteHeader(http.StatusAccepted)
435 if n, err := w.Write(b); err != nil {
436 level.Error(logger).Log("msg", "error writing response", "bytesWritten", n, "err", err)
437 }
438}
439
440// parseNamespace parses the namespace from the provided set of params, in this
441// api these params are derived from the url path

Callers 3

CreateRuleGroupMethod · 0.85
DeleteNamespaceMethod · 0.85
DeleteRuleGroupMethod · 0.85

Calls 6

SetMethod · 0.65
MarshalMethod · 0.45
LogMethod · 0.45
ErrorMethod · 0.45
HeaderMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected