diff options
author | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-05-15 16:47:39 -0700 |
---|---|---|
committer | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2019-05-15 16:47:49 -0700 |
commit | 401aba14c5f5e55480afb491af2bf953cabc6ac2 (patch) | |
tree | 0a0d855f97f749ed3b8020ac4f5d99528948fa8a /src/k8splugin/api | |
parent | 881bb510d7f0b7a3f1110589e8aa3596e655e38c (diff) |
Move config to app and connect to instance
Move config instantiation to app and connect it
to the instance to allow updates and so on.
Issue-ID: MULTICLOUD-464
Change-Id: Ic994ef78a6e0d2db5e695e33b7b8a302c74c10da
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/api')
-rw-r--r-- | src/k8splugin/api/api.go | 4 | ||||
-rw-r--r-- | src/k8splugin/api/confighandler.go | 15 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go index 5fed28a0..0ddbcf83 100644 --- a/src/k8splugin/api/api.go +++ b/src/k8splugin/api/api.go @@ -25,7 +25,7 @@ import ( func NewRouter(defClient rb.DefinitionManager, profileClient rb.ProfileManager, instClient app.InstanceManager, - configClient rb.ConfigManager, + configClient app.ConfigManager, templateClient rb.ConfigTemplateManager) *mux.Router { router := mux.NewRouter() @@ -91,7 +91,7 @@ func NewRouter(defClient rb.DefinitionManager, // Config value if configClient == nil { - configClient = rb.NewConfigClient() + configClient = app.NewConfigClient() } configHandler := rbConfigHandler{client: configClient} resRouter.HandleFunc("/definition/{rbname}/{rbversion}/profile/{prname}/config", configHandler.createHandler).Methods("POST") diff --git a/src/k8splugin/api/confighandler.go b/src/k8splugin/api/confighandler.go index 93098d61..9bd9db83 100644 --- a/src/k8splugin/api/confighandler.go +++ b/src/k8splugin/api/confighandler.go @@ -18,9 +18,10 @@ package api import ( "encoding/json" - "k8splugin/internal/rb" "net/http" + "k8splugin/internal/app" + "github.com/gorilla/mux" ) @@ -29,12 +30,12 @@ import ( type rbConfigHandler struct { // Interface that implements bundle Definition operations // We will set this variable with a mock interface for testing - client rb.ConfigManager + client app.ConfigManager } // createHandler handles creation of the definition entry in the database func (h rbConfigHandler) createHandler(w http.ResponseWriter, r *http.Request) { - var p rb.Config + var p app.Config vars := mux.Vars(r) rbName := vars["rbname"] rbVersion := vars["rbversion"] @@ -73,7 +74,7 @@ func (h rbConfigHandler) createHandler(w http.ResponseWriter, r *http.Request) { } // getHandler handles GET operations on a particular config -// Returns a rb.Definition +// Returns a app.Definition func (h rbConfigHandler) getHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) rbName := vars["rbname"] @@ -128,7 +129,7 @@ func (h rbConfigHandler) updateHandler(w http.ResponseWriter, r *http.Request) { prName := vars["prname"] cfgName := vars["cfgname"] - var p rb.Config + var p app.Config if r.Body == nil { http.Error(w, "Empty body", http.StatusBadRequest) @@ -168,7 +169,7 @@ func (h rbConfigHandler) rollbackHandler(w http.ResponseWriter, r *http.Request) return } - var p rb.ConfigRollback + var p app.ConfigRollback err := json.NewDecoder(r.Body).Decode(&p) if err != nil { http.Error(w, err.Error(), http.StatusUnprocessableEntity) @@ -194,7 +195,7 @@ func (h rbConfigHandler) tagitHandler(w http.ResponseWriter, r *http.Request) { return } - var p rb.ConfigTagit + var p app.ConfigTagit err := json.NewDecoder(r.Body).Decode(&p) if err != nil { http.Error(w, err.Error(), http.StatusUnprocessableEntity) |