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