github.com/cookieai-jar/moby@v17.12.1-ce-rc2+incompatible/api/server/router/system/system.go (about) 1 package system 2 3 import ( 4 "github.com/docker/docker/api/server/router" 5 "github.com/docker/docker/builder/fscache" 6 "github.com/docker/docker/daemon/cluster" 7 ) 8 9 // systemRouter provides information about the Docker system overall. 10 // It gathers information about host, daemon and container events. 11 type systemRouter struct { 12 backend Backend 13 cluster *cluster.Cluster 14 routes []router.Route 15 builder *fscache.FSCache 16 } 17 18 // NewRouter initializes a new system router 19 func NewRouter(b Backend, c *cluster.Cluster, fscache *fscache.FSCache) router.Router { 20 r := &systemRouter{ 21 backend: b, 22 cluster: c, 23 builder: fscache, 24 } 25 26 r.routes = []router.Route{ 27 router.NewOptionsRoute("/{anyroute:.*}", optionsHandler), 28 router.NewGetRoute("/_ping", pingHandler), 29 router.NewGetRoute("/events", r.getEvents, router.WithCancel), 30 router.NewGetRoute("/info", r.getInfo), 31 router.NewGetRoute("/version", r.getVersion), 32 router.NewGetRoute("/system/df", r.getDiskUsage, router.WithCancel), 33 router.NewPostRoute("/auth", r.postAuth), 34 } 35 36 return r 37 } 38 39 // Routes returns all the API routes dedicated to the docker system 40 func (s *systemRouter) Routes() []router.Route { 41 return s.routes 42 }