Merge pull request #1362 from mxinden/deprecate-v0-alerts

api: Deprecate `api/alerts` endpoint
This commit is contained in:
Max Inden 2018-05-05 13:43:54 +02:00 committed by GitHub
commit 05fb09aebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -133,16 +133,10 @@ func (api *API) Register(r *route.Router) {
r.Options("/*path", wrap(func(w http.ResponseWriter, r *http.Request) {})) r.Options("/*path", wrap(func(w http.ResponseWriter, r *http.Request) {}))
// Register legacy forwarder for alert pushing.
r.Post("/alerts", wrap(api.legacyAddAlerts))
// Register actual API.
r = r.WithPrefix("/v1")
r.Get("/status", wrap(api.status)) r.Get("/status", wrap(api.status))
r.Get("/receivers", wrap(api.receivers)) r.Get("/receivers", wrap(api.receivers))
r.Get("/alerts/groups", wrap(api.alertGroups))
r.Get("/alerts/groups", wrap(api.alertGroups))
r.Get("/alerts", wrap(api.listAlerts)) r.Get("/alerts", wrap(api.listAlerts))
r.Post("/alerts", wrap(api.addAlerts)) r.Post("/alerts", wrap(api.addAlerts))

View File

@ -370,7 +370,7 @@ func main() {
ui.Register(router, webReload, logger) ui.Register(router, webReload, logger)
apiv.Register(router.WithPrefix("/api")) apiv.Register(router.WithPrefix("/api/v1"))
level.Info(logger).Log("msg", "Listening", "address", *listenAddress) level.Info(logger).Log("msg", "Listening", "address", *listenAddress)
go listen(*listenAddress, router, logger) go listen(*listenAddress, router, logger)