diff options
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) |