1package plugin // import "github.com/docker/docker/api/server/router/plugin" 2 3import "github.com/docker/docker/api/server/router" 4 5// pluginRouter is a router to talk with the plugin controller 6type pluginRouter struct { 7 backend Backend 8 routes []router.Route 9} 10 11// NewRouter initializes a new plugin router 12func NewRouter(b Backend) router.Router { 13 r := &pluginRouter{ 14 backend: b, 15 } 16 r.initRoutes() 17 return r 18} 19 20// Routes returns the available routers to the plugin controller 21func (r *pluginRouter) Routes() []router.Route { 22 return r.routes 23} 24 25func (r *pluginRouter) initRoutes() { 26 r.routes = []router.Route{ 27 router.NewGetRoute("/plugins", r.listPlugins), 28 router.NewGetRoute("/plugins/{name:.*}/json", r.inspectPlugin), 29 router.NewGetRoute("/plugins/privileges", r.getPrivileges), 30 router.NewDeleteRoute("/plugins/{name:.*}", r.removePlugin), 31 router.NewPostRoute("/plugins/{name:.*}/enable", r.enablePlugin), 32 router.NewPostRoute("/plugins/{name:.*}/disable", r.disablePlugin), 33 router.NewPostRoute("/plugins/pull", r.pullPlugin), 34 router.NewPostRoute("/plugins/{name:.*}/push", r.pushPlugin), 35 router.NewPostRoute("/plugins/{name:.*}/upgrade", r.upgradePlugin), 36 router.NewPostRoute("/plugins/{name:.*}/set", r.setPlugin), 37 router.NewPostRoute("/plugins/create", r.createPlugin), 38 } 39} 40