2016-10-25 15:20:06 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/influxdata/chronograf"
|
|
|
|
)
|
|
|
|
|
|
|
|
type getRoutesResponse struct {
|
2016-12-08 00:31:22 +00:00
|
|
|
Layouts string `json:"layouts"` // Location of the layouts endpoint
|
|
|
|
Mappings string `json:"mappings"` // Location of the application mappings endpoint
|
|
|
|
Sources string `json:"sources"` // Location of the sources endpoint
|
|
|
|
Users string `json:"users"` // Location of the users endpoint
|
|
|
|
Me string `json:"me"` // Location of the me endpoint
|
|
|
|
Dashboards string `json:"dashboards"` // Location of the dashboards endpoint
|
2016-10-25 15:20:06 +00:00
|
|
|
}
|
|
|
|
|
2016-10-28 16:27:06 +00:00
|
|
|
// AllRoutes returns all top level routes within chronograf
|
2016-10-25 15:20:06 +00:00
|
|
|
func AllRoutes(logger chronograf.Logger) http.HandlerFunc {
|
|
|
|
routes := getRoutesResponse{
|
2016-12-08 00:31:22 +00:00
|
|
|
Sources: "/chronograf/v1/sources",
|
|
|
|
Layouts: "/chronograf/v1/layouts",
|
|
|
|
Users: "/chronograf/v1/users",
|
|
|
|
Me: "/chronograf/v1/me",
|
|
|
|
Mappings: "/chronograf/v1/mappings",
|
|
|
|
Dashboards: "/chronograf/v1/dashboards",
|
2016-10-25 15:20:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
encodeJSON(w, http.StatusOK, routes, logger)
|
|
|
|
return
|
|
|
|
})
|
|
|
|
}
|