github.com/hms58/moby@v1.13.1/api/server/router/swarm/cluster.go (about) 1 package swarm 2 3 import "github.com/docker/docker/api/server/router" 4 5 // swarmRouter is a router to talk with the build controller 6 type swarmRouter struct { 7 backend Backend 8 routes []router.Route 9 } 10 11 // NewRouter initializes a new build router 12 func NewRouter(b Backend) router.Router { 13 r := &swarmRouter{ 14 backend: b, 15 } 16 r.initRoutes() 17 return r 18 } 19 20 // Routes returns the available routers to the swarm controller 21 func (sr *swarmRouter) Routes() []router.Route { 22 return sr.routes 23 } 24 25 func (sr *swarmRouter) initRoutes() { 26 sr.routes = []router.Route{ 27 router.NewPostRoute("/swarm/init", sr.initCluster), 28 router.NewPostRoute("/swarm/join", sr.joinCluster), 29 router.NewPostRoute("/swarm/leave", sr.leaveCluster), 30 router.NewGetRoute("/swarm", sr.inspectCluster), 31 router.NewGetRoute("/swarm/unlockkey", sr.getUnlockKey), 32 router.NewPostRoute("/swarm/update", sr.updateCluster), 33 router.NewPostRoute("/swarm/unlock", sr.unlockCluster), 34 router.NewGetRoute("/services", sr.getServices), 35 router.NewGetRoute("/services/{id}", sr.getService), 36 router.NewPostRoute("/services/create", sr.createService), 37 router.NewPostRoute("/services/{id}/update", sr.updateService), 38 router.NewDeleteRoute("/services/{id}", sr.removeService), 39 router.Experimental(router.Cancellable(router.NewGetRoute("/services/{id}/logs", sr.getServiceLogs))), 40 router.NewGetRoute("/nodes", sr.getNodes), 41 router.NewGetRoute("/nodes/{id}", sr.getNode), 42 router.NewDeleteRoute("/nodes/{id}", sr.removeNode), 43 router.NewPostRoute("/nodes/{id}/update", sr.updateNode), 44 router.NewGetRoute("/tasks", sr.getTasks), 45 router.NewGetRoute("/tasks/{id}", sr.getTask), 46 router.NewGetRoute("/secrets", sr.getSecrets), 47 router.NewPostRoute("/secrets/create", sr.createSecret), 48 router.NewDeleteRoute("/secrets/{id}", sr.removeSecret), 49 router.NewGetRoute("/secrets/{id}", sr.getSecret), 50 router.NewPostRoute("/secrets/{id}/update", sr.updateSecret), 51 } 52 }