github.com/hms58/moby@v1.13.1/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  	routes  []router.Route
     9  }
    10  
    11  // NewRouter initializes a new build router
    12  func NewRouter(b Backend) router.Router {
    13  	r := &buildRouter{
    14  		backend: b,
    15  	}
    16  	r.initRoutes()
    17  	return r
    18  }
    19  
    20  // Routes returns the available routers to the build controller
    21  func (r *buildRouter) Routes() []router.Route {
    22  	return r.routes
    23  }
    24  
    25  func (r *buildRouter) initRoutes() {
    26  	r.routes = []router.Route{
    27  		router.Cancellable(router.NewPostRoute("/build", r.postBuild)),
    28  	}
    29  }