github.com/ncdc/docker@v0.10.1-0.20160129113957-6c6729ef5b74/api/server/router/build/build.go (about)

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