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