MCPcopy Create free account
hub / github.com/cortexproject/cortex / DeleteRuleGroup

Method DeleteRuleGroup

integration/e2ecortex/client.go:873–894  ·  view source on GitHub ↗

DeleteRuleGroup deletes a rule group.

(namespace string, groupName string)

Source from the content-addressed store, hash-verified

871
872// DeleteRuleGroup deletes a rule group.
873func (c *Client) DeleteRuleGroup(namespace string, groupName string) error {
874 // Create HTTP request
875 req, err := http.NewRequest("DELETE", fmt.Sprintf("http://%s/api/prom/rules/%s/%s", c.rulerAddress, url.PathEscape(namespace), url.PathEscape(groupName)), nil)
876 if err != nil {
877 return err
878 }
879
880 req.Header.Set("Content-Type", "application/yaml")
881 req.Header.Set("X-Scope-OrgID", c.orgID)
882
883 ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
884 defer cancel()
885
886 // Execute HTTP request
887 res, err := c.httpClient.Do(req.WithContext(ctx))
888 if err != nil {
889 return err
890 }
891
892 defer res.Body.Close()
893 return nil
894}
895
896// DeleteRuleNamespace deletes all the rule groups (and the namespace itself).
897func (c *Client) DeleteRuleNamespace(namespace string) error {

Callers 2

TestRulerAPIFunction · 0.95

Calls 3

SetMethod · 0.65
DoMethod · 0.65
CloseMethod · 0.65

Tested by 2

TestRulerAPIFunction · 0.76