github.com/hms58/moby@v1.13.1/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/daemon/cluster"
     6  )
     7  
     8  // systemRouter provides information about the Docker system overall.
     9  // It gathers information about host, daemon and container events.
    10  type systemRouter struct {
    11  	backend         Backend
    12  	clusterProvider *cluster.Cluster
    13  	routes          []router.Route
    14  }
    15  
    16  // NewRouter initializes a new system router
    17  func NewRouter(b Backend, c *cluster.Cluster) router.Router {
    18  	r := &systemRouter{
    19  		backend:         b,
    20  		clusterProvider: c,
    21  	}
    22  
    23  	r.routes = []router.Route{
    24  		router.NewOptionsRoute("/{anyroute:.*}", optionsHandler),
    25  		router.NewGetRoute("/_ping", pingHandler),
    26  		router.Cancellable(router.NewGetRoute("/events", r.getEvents)),
    27  		router.NewGetRoute("/info", r.getInfo),
    28  		router.NewGetRoute("/version", r.getVersion),
    29  		router.NewGetRoute("/system/df", r.getDiskUsage),
    30  		router.NewPostRoute("/auth", r.postAuth),
    31  	}
    32  
    33  	return r
    34  }
    35  
    36  // Routes returns all the API routes dedicated to the docker system
    37  func (s *systemRouter) Routes() []router.Route {
    38  	return s.routes
    39  }