mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
534a90a993
As described in our ROADMAP.md, introduce new Swarm management API endpoints relying on swarmkit to deploy services. It currently vendors docker/engine-api changes. This PR is fully backward compatible (joining a Swarm is an optional feature of the Engine, and existing commands are not impacted). Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Signed-off-by: Victor Vieux <vieux@docker.com> Signed-off-by: Daniel Nephin <dnephin@docker.com> Signed-off-by: Jana Radhakrishnan <mrjana@docker.com> Signed-off-by: Madhu Venugopal <madhu@docker.com>
38 lines
1 KiB
Go
38 lines
1 KiB
Go
package system
|
|
|
|
import (
|
|
"github.com/docker/docker/api/server/router"
|
|
"github.com/docker/docker/daemon/cluster"
|
|
)
|
|
|
|
// systemRouter provides information about the Docker system overall.
|
|
// It gathers information about host, daemon and container events.
|
|
type systemRouter struct {
|
|
backend Backend
|
|
clusterProvider *cluster.Cluster
|
|
routes []router.Route
|
|
}
|
|
|
|
// NewRouter initializes a new system router
|
|
func NewRouter(b Backend, c *cluster.Cluster) router.Router {
|
|
r := &systemRouter{
|
|
backend: b,
|
|
clusterProvider: c,
|
|
}
|
|
|
|
r.routes = []router.Route{
|
|
router.NewOptionsRoute("/{anyroute:.*}", optionsHandler),
|
|
router.NewGetRoute("/_ping", pingHandler),
|
|
router.Cancellable(router.NewGetRoute("/events", r.getEvents)),
|
|
router.NewGetRoute("/info", r.getInfo),
|
|
router.NewGetRoute("/version", r.getVersion),
|
|
router.NewPostRoute("/auth", r.postAuth),
|
|
}
|
|
|
|
return r
|
|
}
|
|
|
|
// Routes returns all the API routes dedicated to the docker system
|
|
func (s *systemRouter) Routes() []router.Route {
|
|
return s.routes
|
|
}
|