Example #1
0
func (r *networkRouter) initRoutes() {
	r.routes = []router.Route{
		// GET
		local.NewGetRoute("/networks", r.getNetworksList),
		local.NewGetRoute("/networks/{id:.*}", r.getNetwork),
		// POST
		local.NewPostRoute("/networks/create", r.postNetworkCreate),
		local.NewPostRoute("/networks/{id:.*}/connect", r.postNetworkConnect),
		local.NewPostRoute("/networks/{id:.*}/disconnect", r.postNetworkDisconnect),
		// DELETE
		local.NewDeleteRoute("/networks/{id:.*}", r.deleteNetwork),
	}
}
Example #2
0
func (r *volumeRouter) initRoutes() {
	r.routes = []router.Route{
		// GET
		local.NewGetRoute("/volumes", r.getVolumesList),
		local.NewGetRoute("/volumes/{name:.*}", r.getVolumeByName),
		// POST
		local.NewPostRoute("/volumes/create", r.postVolumesCreate),
		// DELETE
		local.NewDeleteRoute("/volumes/{name:.*}", r.deleteVolumes),
	}
}
Example #3
0
// NewRouter initializes a new systemRouter
func NewRouter(b Backend) router.Router {
	r := &systemRouter{
		backend: b,
	}

	r.routes = []router.Route{
		local.NewOptionsRoute("/{anyroute:.*}", optionsHandler),
		local.NewGetRoute("/_ping", pingHandler),
		local.NewGetRoute("/events", r.getEvents),
		local.NewGetRoute("/info", r.getInfo),
		local.NewGetRoute("/version", r.getVersion),
		local.NewPostRoute("/auth", r.postAuth),
	}

	return r
}
Example #4
0
// initRoutes initializes the routes in container router
func (r *containerRouter) initRoutes() {
	r.routes = []router.Route{
		// HEAD
		local.NewHeadRoute("/containers/{name:.*}/archive", r.headContainersArchive),
		// GET
		local.NewGetRoute("/containers/json", r.getContainersJSON),
		local.NewGetRoute("/containers/{name:.*}/export", r.getContainersExport),
		local.NewGetRoute("/containers/{name:.*}/changes", r.getContainersChanges),
		local.NewGetRoute("/containers/{name:.*}/json", r.getContainersByName),
		local.NewGetRoute("/containers/{name:.*}/top", r.getContainersTop),
		local.NewGetRoute("/containers/{name:.*}/logs", r.getContainersLogs),
		local.NewGetRoute("/containers/{name:.*}/stats", r.getContainersStats),
		local.NewGetRoute("/containers/{name:.*}/attach/ws", r.wsContainersAttach),
		local.NewGetRoute("/exec/{id:.*}/json", r.getExecByID),
		local.NewGetRoute("/containers/{name:.*}/archive", r.getContainersArchive),
		// POST
		local.NewPostRoute("/containers/create", r.postContainersCreate),
		local.NewPostRoute("/containers/{name:.*}/kill", r.postContainersKill),
		local.NewPostRoute("/containers/{name:.*}/pause", r.postContainersPause),
		local.NewPostRoute("/containers/{name:.*}/unpause", r.postContainersUnpause),
		local.NewPostRoute("/containers/{name:.*}/restart", r.postContainersRestart),
		local.NewPostRoute("/containers/{name:.*}/start", r.postContainersStart),
		local.NewPostRoute("/containers/{name:.*}/stop", r.postContainersStop),
		local.NewPostRoute("/containers/{name:.*}/wait", r.postContainersWait),
		local.NewPostRoute("/containers/{name:.*}/resize", r.postContainersResize),
		local.NewPostRoute("/containers/{name:.*}/attach", r.postContainersAttach),
		local.NewPostRoute("/containers/{name:.*}/copy", r.postContainersCopy),
		local.NewPostRoute("/containers/{name:.*}/exec", r.postContainerExecCreate),
		local.NewPostRoute("/exec/{name:.*}/start", r.postContainerExecStart),
		local.NewPostRoute("/exec/{name:.*}/resize", r.postContainerExecResize),
		local.NewPostRoute("/containers/{name:.*}/rename", r.postContainerRename),
		local.NewPostRoute("/containers/{name:.*}/update", r.postContainerUpdate),
		// PUT
		local.NewPutRoute("/containers/{name:.*}/archive", r.putContainersArchive),
		// DELETE
		local.NewDeleteRoute("/containers/{name:.*}", r.deleteContainers),
	}
}
Example #5
0
func (r *buildRouter) initRoutes() {
	r.routes = []router.Route{
		local.NewPostRoute("/build", r.postBuild),
	}
}