2015-12-17 19:17:50 -05:00
|
|
|
package build
|
|
|
|
|
2015-12-30 12:20:41 -05:00
|
|
|
import "github.com/docker/docker/api/server/router"
|
2015-12-17 19:17:50 -05:00
|
|
|
|
|
|
|
// buildRouter is a router to talk with the build controller
|
|
|
|
type buildRouter struct {
|
2016-01-20 18:32:02 -05:00
|
|
|
backend Backend
|
2015-12-17 19:17:50 -05:00
|
|
|
routes []router.Route
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewRouter initializes a new build router
|
2016-01-20 18:32:02 -05:00
|
|
|
func NewRouter(b Backend) router.Router {
|
2015-12-17 19:17:50 -05:00
|
|
|
r := &buildRouter{
|
|
|
|
backend: b,
|
|
|
|
}
|
|
|
|
r.initRoutes()
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Routes returns the available routers to the build controller
|
|
|
|
func (r *buildRouter) Routes() []router.Route {
|
|
|
|
return r.routes
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *buildRouter) initRoutes() {
|
|
|
|
r.routes = []router.Route{
|
2015-12-30 12:20:41 -05:00
|
|
|
router.NewPostRoute("/build", r.postBuild),
|
2015-12-17 19:17:50 -05:00
|
|
|
}
|
|
|
|
}
|