aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-05-16 03:13:16 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-16 03:13:16 +0000
commitc8d038951d41978bb00005e23081e6562c0ab754 (patch)
treef1b8c1374d8289556223ad116d3ceaff5151003f /src/k8splugin/api
parent458c676f883514c8eec57f23a88abc2e79fffa20 (diff)
parent401aba14c5f5e55480afb491af2bf953cabc6ac2 (diff)
Merge "Move config to app and connect to instance"
Diffstat (limited to 'src/k8splugin/api')
-rw-r--r--src/k8splugin/api/api.go4
-rw-r--r--src/k8splugin/api/confighandler.go15
2 files changed, 10 insertions, 9 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go
index 2976b82f..58e50a16 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()
@@ -90,7 +90,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)