github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/api/server/router/system/system.go (about)

     1  package system // import "github.com/docker/docker/api/server/router/system"
     2  
     3  import (
     4  	"github.com/docker/docker/api/server/router"
     5  	"github.com/docker/docker/builder/builder-next"
     6  	"github.com/docker/docker/builder/fscache"
     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  ClusterBackend
    14  	routes   []router.Route
    15  	fscache  *fscache.FSCache // legacy
    16  	builder  *buildkit.Builder
    17  	features *map[string]bool
    18  }
    19  
    20  // NewRouter initializes a new system router
    21  func NewRouter(b Backend, c ClusterBackend, fscache *fscache.FSCache, builder *buildkit.Builder, features *map[string]bool) router.Router {
    22  	r := &systemRouter{
    23  		backend:  b,
    24  		cluster:  c,
    25  		fscache:  fscache,
    26  		builder:  builder,
    27  		features: features,
    28  	}
    29  
    30  	r.routes = []router.Route{
    31  		router.NewOptionsRoute("/{anyroute:.*}", optionsHandler),
    32  		router.NewGetRoute("/_ping", r.pingHandler),
    33  		router.NewHeadRoute("/_ping", r.pingHandler),
    34  		router.NewGetRoute("/events", r.getEvents),
    35  		router.NewGetRoute("/info", r.getInfo),
    36  		router.NewGetRoute("/version", r.getVersion),
    37  		router.NewGetRoute("/system/df", r.getDiskUsage),
    38  		router.NewPostRoute("/auth", r.postAuth),
    39  	}
    40  
    41  	return r
    42  }
    43  
    44  // Routes returns all the API routes dedicated to the docker system
    45  func (s *systemRouter) Routes() []router.Route {
    46  	return s.routes
    47  }