Example #1
0
File: pod.go Project: 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
}
Example #2
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
}