DeleteRuleNamespace deletes all the rule groups (and the namespace itself).
(namespace string)
| 895 | |
| 896 | // DeleteRuleNamespace deletes all the rule groups (and the namespace itself). |
| 897 | func (c *Client) DeleteRuleNamespace(namespace string) error { |
| 898 | // Create HTTP request |
| 899 | req, err := http.NewRequest("DELETE", fmt.Sprintf("http://%s/api/prom/rules/%s", c.rulerAddress, url.PathEscape(namespace)), nil) |
| 900 | if err != nil { |
| 901 | return err |
| 902 | } |
| 903 | |
| 904 | req.Header.Set("X-Scope-OrgID", c.orgID) |
| 905 | |
| 906 | ctx, cancel := context.WithTimeout(context.Background(), c.timeout) |
| 907 | defer cancel() |
| 908 | |
| 909 | // Execute HTTP request |
| 910 | _, err = c.httpClient.Do(req.WithContext(ctx)) |
| 911 | if err != nil { |
| 912 | return err |
| 913 | } |
| 914 | |
| 915 | return nil |
| 916 | } |
| 917 | |
| 918 | // userConfig is used to communicate a users alertmanager configs |
| 919 | type userConfig struct { |