-
Notifications
You must be signed in to change notification settings - Fork 1
/
volume.go
38 lines (33 loc) · 888 Bytes
/
volume.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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),
}
}