github.com/hms58/moby@v1.13.1/api/server/router/checkpoint/checkpoint.go (about) 1 package checkpoint 2 3 import ( 4 "github.com/docker/docker/api/server/httputils" 5 "github.com/docker/docker/api/server/router" 6 ) 7 8 // checkpointRouter is a router to talk with the checkpoint controller 9 type checkpointRouter struct { 10 backend Backend 11 decoder httputils.ContainerDecoder 12 routes []router.Route 13 } 14 15 // NewRouter initializes a new checkpoint router 16 func NewRouter(b Backend, decoder httputils.ContainerDecoder) router.Router { 17 r := &checkpointRouter{ 18 backend: b, 19 decoder: decoder, 20 } 21 r.initRoutes() 22 return r 23 } 24 25 // Routes returns the available routers to the checkpoint controller 26 func (r *checkpointRouter) Routes() []router.Route { 27 return r.routes 28 } 29 30 func (r *checkpointRouter) initRoutes() { 31 r.routes = []router.Route{ 32 router.Experimental(router.NewGetRoute("/containers/{name:.*}/checkpoints", r.getContainerCheckpoints)), 33 router.Experimental(router.NewPostRoute("/containers/{name:.*}/checkpoints", r.postContainerCheckpoint)), 34 router.Experimental(router.NewDeleteRoute("/containers/{name}/checkpoints/{checkpoint}", r.deleteContainerCheckpoint)), 35 } 36 }