RegisterRulerAPI registers routes associated with the Ruler API
(r *ruler.API)
| 369 | |
| 370 | // RegisterRulerAPI registers routes associated with the Ruler API |
| 371 | func (a *API) RegisterRulerAPI(r *ruler.API) { |
| 372 | // Prometheus Rule API Routes |
| 373 | a.RegisterRoute(path.Join(a.cfg.PrometheusHTTPPrefix, "/api/v1/rules"), http.HandlerFunc(r.PrometheusRules), true, "GET") |
| 374 | a.RegisterRoute(path.Join(a.cfg.PrometheusHTTPPrefix, "/api/v1/alerts"), http.HandlerFunc(r.PrometheusAlerts), true, "GET") |
| 375 | |
| 376 | // Ruler API Routes |
| 377 | a.RegisterRoute("/api/v1/rules", http.HandlerFunc(r.ListRules), true, "GET") |
| 378 | a.RegisterRoute("/api/v1/rules/{namespace}", http.HandlerFunc(r.ListRules), true, "GET") |
| 379 | a.RegisterRoute("/api/v1/rules/{namespace}/{groupName}", http.HandlerFunc(r.GetRuleGroup), true, "GET") |
| 380 | a.RegisterRoute("/api/v1/rules/{namespace}", http.HandlerFunc(r.CreateRuleGroup), true, "POST") |
| 381 | a.RegisterRoute("/api/v1/rules/{namespace}/{groupName}", http.HandlerFunc(r.DeleteRuleGroup), true, "DELETE") |
| 382 | a.RegisterRoute("/api/v1/rules/{namespace}", http.HandlerFunc(r.DeleteNamespace), true, "DELETE") |
| 383 | |
| 384 | // Legacy Prometheus Rule API Routes |
| 385 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/api/v1/rules"), http.HandlerFunc(r.PrometheusRules), true, "GET") |
| 386 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/api/v1/alerts"), http.HandlerFunc(r.PrometheusAlerts), true, "GET") |
| 387 | |
| 388 | // Legacy Ruler API Routes |
| 389 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules"), http.HandlerFunc(r.ListRules), true, "GET") |
| 390 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}"), http.HandlerFunc(r.ListRules), true, "GET") |
| 391 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}/{groupName}"), http.HandlerFunc(r.GetRuleGroup), true, "GET") |
| 392 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}"), http.HandlerFunc(r.CreateRuleGroup), true, "POST") |
| 393 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}/{groupName}"), http.HandlerFunc(r.DeleteRuleGroup), true, "DELETE") |
| 394 | a.RegisterRoute(path.Join(a.cfg.LegacyHTTPPrefix, "/rules/{namespace}"), http.HandlerFunc(r.DeleteNamespace), true, "DELETE") |
| 395 | } |
| 396 | |
| 397 | // RegisterOverrides registers routes associated with the Overrides API |
| 398 | func (a *API) RegisterOverrides(o *overrides.API) { |
no test coverage detected