Ejemplo n.º 1
0
Archivo: pod.go Proyecto: ZJU-SEL/hyper
// NewRouter initializes a new systemRouter
func NewRouter(b Backend) router.Router {
	r := &podRouter{
		backend: b,
	}

	r.routes = []router.Route{
		// GET
		local.NewGetRoute("/pod/info", r.getPodInfo),
		local.NewGetRoute("/pod/stats", r.getPodStats),
		local.NewGetRoute("/list", r.getList),
		// POST
		local.NewPostRoute("/pod/create", r.postPodCreate),
		local.NewPostRoute("/pod/labels", r.postPodLabels),
		local.NewPostRoute("/pod/start", r.postPodStart),
		local.NewPostRoute("/pod/stop", r.postPodStop),
		local.NewPostRoute("/pod/pause", r.postPodPause),
		local.NewPostRoute("/pod/unpause", r.postPodUnpause),
		local.NewPostRoute("/vm/create", r.postVmCreate),
		// PUT
		// DELETE
		local.NewDeleteRoute("/pod", r.deletePod),
		local.NewDeleteRoute("/vm", r.deleteVm),
	}

	return r
}
Ejemplo n.º 2
0
// NewRouter initializes a new systemRouter
func NewRouter(b Backend) router.Router {
	r := &systemRouter{
		backend: b,
	}

	r.routes = []router.Route{
		local.NewGetRoute("/_ping", pingHandler),
		local.NewGetRoute("/info", r.getInfo),
		local.NewGetRoute("/version", r.getVersion),
		local.NewPostRoute("/auth", r.postAuth),
	}

	return r
}
Ejemplo n.º 3
0
// initRoutes initializes the routes in container router
func (r *containerRouter) initRoutes() {
	r.routes = []router.Route{
		// GET
		local.NewGetRoute("/container/info", r.getContainerInfo),
		local.NewGetRoute("/container/logs", r.getContainerLogs),
		local.NewGetRoute("/exitcode", r.getExitCode),
		// POST
		local.NewPostRoute("/container/create", r.postContainerCreate),
		local.NewPostRoute("/container/rename", r.postContainerRename),
		local.NewPostRoute("/container/commit", r.postContainerCommit),
		local.NewPostRoute("/exec", r.postContainerExec),
		local.NewPostRoute("/attach", r.postContainerAttach),
		local.NewPostRoute("/tty/resize", r.postTtyResize),
		// PUT
		// DELETE
	}
}
Ejemplo n.º 4
0
// NewRouter initializes a new systemRouter
func NewRouter(b Backend) router.Router {
	r := &serviceRouter{
		backend: b,
	}

	r.routes = []router.Route{
		// GET
		local.NewGetRoute("/service/list", r.getServices),
		// POST
		local.NewPostRoute("/service/add", r.postServiceAdd),
		local.NewPostRoute("/service/update", r.postServiceUpdate),
		// PUT
		// DELETE
		local.NewDeleteRoute("/service", r.deleteService),
	}

	return r
}