1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/server/router/volume/volume.go
Shuwei Hao 6efa10f668 Modify improper comments in api/server/router/volume/volume.go
Signed-off-by: Shuwei Hao <haoshuwei24@gmail.com>
2015-11-08 04:05:59 +00:00

38 lines
888 B
Go

package volume
import (
"github.com/docker/docker/api/server/router"
"github.com/docker/docker/api/server/router/local"
)
// volumeRouter is a router to talk with the volumes controller
type volumeRouter struct {
backend Backend
routes []router.Route
}
// NewRouter initializes a new volumeRouter
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),
}
}