mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
9c332b164f
Currently, daemonbuilder package (part of daemon) implemented the builder backend. However, it was a very thin wrapper around daemon methods and caused an implementation dependency for api/server build endpoint. api/server buildrouter should only know about the backend implementing the /build API endpoint. Removing daemonbuilder involved moving build specific methods to respective files in the daemon, where they fit naturally. Signed-off-by: Anusha Ragunathan <anusha@docker.com>
32 lines
655 B
Go
32 lines
655 B
Go
package build
|
|
|
|
import (
|
|
"github.com/docker/docker/api/server/router"
|
|
"github.com/docker/docker/api/server/router/local"
|
|
)
|
|
|
|
// buildRouter is a router to talk with the build controller
|
|
type buildRouter struct {
|
|
backend Backend
|
|
routes []router.Route
|
|
}
|
|
|
|
// NewRouter initializes a new build router
|
|
func NewRouter(b Backend) router.Router {
|
|
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{
|
|
local.NewPostRoute("/build", r.postBuild),
|
|
}
|
|
}
|