github.com/cookieai-jar/moby@v17.12.1-ce-rc2+incompatible/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.NewGetRoute("/containers/{name:.*}/checkpoints", r.getContainerCheckpoints, router.Experimental),
    33  		router.NewPostRoute("/containers/{name:.*}/checkpoints", r.postContainerCheckpoint, router.Experimental),
    34  		router.NewDeleteRoute("/containers/{name}/checkpoints/{checkpoint}", r.deleteContainerCheckpoint, router.Experimental),
    35  	}
    36  }