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

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