mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
240a9fcb83
Adds code to support Cluster Volumes in Swarm using CSI drivers. Signed-off-by: Drew Erny <derny@mirantis.com>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package volume // import "github.com/docker/docker/api/server/router/volume"
|
|
|
|
import "github.com/docker/docker/api/server/router"
|
|
|
|
// volumeRouter is a router to talk with the volumes controller
|
|
type volumeRouter struct {
|
|
backend Backend
|
|
cluster ClusterBackend
|
|
routes []router.Route
|
|
}
|
|
|
|
// NewRouter initializes a new volume router
|
|
func NewRouter(b Backend, cb ClusterBackend) router.Router {
|
|
r := &volumeRouter{
|
|
backend: b,
|
|
cluster: cb,
|
|
}
|
|
r.initRoutes()
|
|
return r
|
|
}
|
|
|
|
// Routes returns the available routes to the volumes controller
|
|
func (r *volumeRouter) Routes() []router.Route {
|
|
return r.routes
|
|
}
|
|
|
|
func (r *volumeRouter) initRoutes() {
|
|
r.routes = []router.Route{
|
|
// GET
|
|
router.NewGetRoute("/volumes", r.getVolumesList),
|
|
router.NewGetRoute("/volumes/{name:.*}", r.getVolumeByName),
|
|
// POST
|
|
router.NewPostRoute("/volumes/create", r.postVolumesCreate),
|
|
router.NewPostRoute("/volumes/prune", r.postVolumesPrune),
|
|
// PUT
|
|
router.NewPutRoute("/volumes/{name:.*}", r.putVolumesUpdate),
|
|
// DELETE
|
|
router.NewDeleteRoute("/volumes/{name:.*}", r.deleteVolumes),
|
|
}
|
|
}
|