summaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r--src/k8splugin/api/api.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go
index 4bf8d6a6..604ccdc8 100644
--- a/src/k8splugin/api/api.go
+++ b/src/k8splugin/api/api.go
@@ -23,7 +23,9 @@ import (
// NewRouter creates a router that registers the various urls that are supported
func NewRouter(defClient rb.DefinitionManager,
profileClient rb.ProfileManager,
- instClient app.InstanceManager) *mux.Router {
+ instClient app.InstanceManager,
+ configClient rb.ConfigManager,
+ templateClient rb.ConfigTemplateManager) *mux.Router {
router := mux.NewRouter()
@@ -68,5 +70,27 @@ func NewRouter(defClient rb.DefinitionManager,
resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}", profileHandler.getHandler).Methods("GET")
resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}", profileHandler.deleteHandler).Methods("DELETE")
+ // Config Template
+ if templateClient == nil {
+ templateClient = rb.NewConfigTemplateClient()
+ }
+ templateHandler := rbTemplateHandler{client: templateClient}
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/config-template", templateHandler.createHandler).Methods("POST")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/config-template/{tname}/content", templateHandler.uploadHandler).Methods("POST")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/config-template/{tname}", templateHandler.getHandler).Methods("GET")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/config-template/{tname}", templateHandler.deleteHandler).Methods("DELETE")
+
+ // Config value
+ if configClient == nil {
+ configClient = rb.NewConfigClient()
+ }
+ configHandler := rbConfigHandler{client: configClient}
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}/config", configHandler.createHandler).Methods("POST")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}/config/{cfgname}", configHandler.getHandler).Methods("GET")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}/config/{cfgname}", configHandler.updateHandler).Methods("PUT")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}/config/{cfgname}", configHandler.deleteHandler).Methods("DELETE")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}/config/rollback", configHandler.rollbackHandler).Methods("POST")
+ resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}/config/tagit", configHandler.tagitHandler).Methods("POST")
+
return router
}