(w http.ResponseWriter, req *http.Request)
| 532 | } |
| 533 | |
| 534 | func (a *API) GetRuleGroup(w http.ResponseWriter, req *http.Request) { |
| 535 | logger := util_log.WithContext(req.Context(), a.logger) |
| 536 | userID, namespace, groupName, err := parseRequest(req, true, true) |
| 537 | if err != nil { |
| 538 | util_api.RespondError(logger, w, v1.ErrBadData, err.Error(), http.StatusBadRequest) |
| 539 | return |
| 540 | } |
| 541 | |
| 542 | rg, err := a.store.GetRuleGroup(req.Context(), userID, namespace, groupName) |
| 543 | if err != nil { |
| 544 | if errors.Is(err, rulestore.ErrGroupNotFound) { |
| 545 | http.Error(w, err.Error(), http.StatusNotFound) |
| 546 | return |
| 547 | } |
| 548 | http.Error(w, err.Error(), http.StatusBadRequest) |
| 549 | return |
| 550 | } |
| 551 | |
| 552 | formatted := rulespb.FromProto(rg) |
| 553 | marshalAndSend(formatted, w, logger) |
| 554 | } |
| 555 | |
| 556 | func (a *API) CreateRuleGroup(w http.ResponseWriter, req *http.Request) { |
| 557 | logger := util_log.WithContext(req.Context(), a.logger) |
nothing calls this directly
no test coverage detected