diff options
author | 2019-04-12 03:26:01 +0000 | |
---|---|---|
committer | 2019-04-12 03:26:01 +0000 | |
commit | 84c644d692929bbf041aae16c91e6dbf5fbdeb7f (patch) | |
tree | 95ab5b4771b6b82c7b9cd1494b701263e88a30b6 /src/k8splugin/api/api.go | |
parent | 3357aa8ad47c923021d53796c618c94f7c4ef37c (diff) | |
parent | 10337dd73e55ecf6327515e70a60aef4325af589 (diff) |
Merge "Day 2 Configuration API's"
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r-- | src/k8splugin/api/api.go | 26 |
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 } |