github.com/hms58/moby@v1.13.1/api/server/router/volume/volume.go (about)

     1  package volume
     2  
     3  import "github.com/docker/docker/api/server/router"
     4  
     5  // volumeRouter is a router to talk with the volumes controller
     6  type volumeRouter struct {
     7  	backend Backend
     8  	routes  []router.Route
     9  }
    10  
    11  // NewRouter initializes a new volume router
    12  func NewRouter(b Backend) router.Router {
    13  	r := &volumeRouter{
    14  		backend: b,
    15  	}
    16  	r.initRoutes()
    17  	return r
    18  }
    19  
    20  // Routes returns the available routes to the volumes controller
    21  func (r *volumeRouter) Routes() []router.Route {
    22  	return r.routes
    23  }
    24  
    25  func (r *volumeRouter) initRoutes() {
    26  	r.routes = []router.Route{
    27  		// GET
    28  		router.NewGetRoute("/volumes", r.getVolumesList),
    29  		router.NewGetRoute("/volumes/{name:.*}", r.getVolumeByName),
    30  		// POST
    31  		router.NewPostRoute("/volumes/create", r.postVolumesCreate),
    32  		router.NewPostRoute("/volumes/prune", r.postVolumesPrune),
    33  		// DELETE
    34  		router.NewDeleteRoute("/volumes/{name:.*}", r.deleteVolumes),
    35  	}
    36  }