github.com/cookieai-jar/moby@v17.12.1-ce-rc2+incompatible/api/server/router/session/session.go (about)

     1  package session
     2  
     3  import "github.com/docker/docker/api/server/router"
     4  
     5  // sessionRouter is a router to talk with the session controller
     6  type sessionRouter struct {
     7  	backend Backend
     8  	routes  []router.Route
     9  }
    10  
    11  // NewRouter initializes a new session router
    12  func NewRouter(b Backend) router.Router {
    13  	r := &sessionRouter{
    14  		backend: b,
    15  	}
    16  	r.initRoutes()
    17  	return r
    18  }
    19  
    20  // Routes returns the available routers to the session controller
    21  func (r *sessionRouter) Routes() []router.Route {
    22  	return r.routes
    23  }
    24  
    25  func (r *sessionRouter) initRoutes() {
    26  	r.routes = []router.Route{
    27  		router.Experimental(router.NewPostRoute("/session", r.startSession)),
    28  	}
    29  }