mirror of
https://github.com/docker/docs.git
synced 2026-04-03 09:49:05 +07:00
- create a volume-specific interface that for the methods of daemon
that are used
- remove dependency on daemon package by volume package of server
- like 5087977fc1
Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
39 lines
891 B
Go
39 lines
891 B
Go
package volume
|
|
|
|
import (
|
|
"github.com/docker/docker/api/server/router"
|
|
"github.com/docker/docker/api/server/router/local"
|
|
)
|
|
|
|
// volumesRouter is a router to talk with the volumes controller
|
|
type volumeRouter struct {
|
|
backend Backend
|
|
routes []router.Route
|
|
}
|
|
|
|
// NewRouter initializes a new volumes router
|
|
func NewRouter(b Backend) router.Router {
|
|
r := &volumeRouter{
|
|
backend: b,
|
|
}
|
|
r.initRoutes()
|
|
return r
|
|
}
|
|
|
|
//Routes returns the available routers to the volumes controller
|
|
func (r *volumeRouter) Routes() []router.Route {
|
|
return r.routes
|
|
}
|
|
|
|
func (r *volumeRouter) initRoutes() {
|
|
r.routes = []router.Route{
|
|
// GET
|
|
local.NewGetRoute("/volumes", r.getVolumesList),
|
|
local.NewGetRoute("/volumes/{name:.*}", r.getVolumeByName),
|
|
// POST
|
|
local.NewPostRoute("/volumes/create", r.postVolumesCreate),
|
|
// DELETE
|
|
local.NewDeleteRoute("/volumes/{name:.*}", r.deleteVolumes),
|
|
}
|
|
}
|