GetRuleGroup gets a rule group.
(namespace string, groupName string)
| 853 | |
| 854 | // GetRuleGroup gets a rule group. |
| 855 | func (c *Client) GetRuleGroup(namespace string, groupName string) (*http.Response, error) { |
| 856 | // Create HTTP request |
| 857 | req, err := http.NewRequest("GET", fmt.Sprintf("http://%s/api/prom/rules/%s/%s", c.rulerAddress, url.PathEscape(namespace), url.PathEscape(groupName)), nil) |
| 858 | if err != nil { |
| 859 | return nil, err |
| 860 | } |
| 861 | |
| 862 | req.Header.Set("Content-Type", "application/yaml") |
| 863 | req.Header.Set("X-Scope-OrgID", c.orgID) |
| 864 | |
| 865 | ctx, cancel := context.WithTimeout(context.Background(), c.timeout) |
| 866 | defer cancel() |
| 867 | |
| 868 | // Execute HTTP request |
| 869 | return c.httpClient.Do(req.WithContext(ctx)) |
| 870 | } |
| 871 | |
| 872 | // DeleteRuleGroup deletes a rule group. |
| 873 | func (c *Client) DeleteRuleGroup(namespace string, groupName string) error { |