aboutsummaryrefslogtreecommitdiffstats
path: root/src/ncm/api/clusterhandler.go
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-05-28 17:25:30 -0700
committerEric Multanen <eric.w.multanen@intel.com>2020-06-02 14:00:07 -0700
commita6e2a3a65a6e4f3f1d964578ae4e60c6f9dd1184 (patch)
treeab7fa1157f9b98840b0482592c886da61e62cc6d /src/ncm/api/clusterhandler.go
parentad7782cbf83c11f152a6457f3808a4da99a1ae56 (diff)
Reorganize ncm packages to align with architecture
Reorginize the ncm packges to delineate - cluster provider and cluster management - virtual and provider netowrk intent management - intent scheduler - internal ovn4k8s network controller Overall, no code changes, just moving things around. Issue-ID: MULTICLOUD-1029 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: I3d43c7e4eb6f285b51c0385ba18626d3511a14f5
Diffstat (limited to 'src/ncm/api/clusterhandler.go')
-rw-r--r--src/ncm/api/clusterhandler.go48
1 files changed, 9 insertions, 39 deletions
diff --git a/src/ncm/api/clusterhandler.go b/src/ncm/api/clusterhandler.go
index 78453aa8..08040408 100644
--- a/src/ncm/api/clusterhandler.go
+++ b/src/ncm/api/clusterhandler.go
@@ -27,7 +27,7 @@ import (
"net/http"
"net/textproto"
- moduleLib "github.com/onap/multicloud-k8s/src/ncm/pkg/module"
+ clusterPkg "github.com/onap/multicloud-k8s/src/ncm/pkg/cluster"
"github.com/gorilla/mux"
)
@@ -37,12 +37,12 @@ import (
type clusterHandler struct {
// Interface that implements Cluster operations
// We will set this variable with a mock interface for testing
- client moduleLib.ClusterManager
+ client clusterPkg.ClusterManager
}
// Create handles creation of the ClusterProvider entry in the database
func (h clusterHandler) createClusterProviderHandler(w http.ResponseWriter, r *http.Request) {
- var p moduleLib.ClusterProvider
+ var p clusterPkg.ClusterProvider
err := json.NewDecoder(r.Body).Decode(&p)
@@ -125,8 +125,8 @@ func (h clusterHandler) deleteClusterProviderHandler(w http.ResponseWriter, r *h
func (h clusterHandler) createClusterHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
provider := vars["provider-name"]
- var p moduleLib.Cluster
- var q moduleLib.ClusterContent
+ var p clusterPkg.Cluster
+ var q clusterPkg.ClusterContent
// Implemenation using multipart form
// Review and enable/remove at a later date
@@ -213,7 +213,7 @@ func (h clusterHandler) getClusterHandler(w http.ResponseWriter, r *http.Request
// handle the get all clusters case - return a list of only the json parts
if len(name) == 0 {
- var retList []moduleLib.Cluster
+ var retList []clusterPkg.Cluster
ret, err := h.client.GetClusters(provider)
if err != nil {
@@ -222,7 +222,7 @@ func (h clusterHandler) getClusterHandler(w http.ResponseWriter, r *http.Request
}
for _, cl := range ret {
- retList = append(retList, moduleLib.Cluster{Metadata: cl.Metadata})
+ retList = append(retList, clusterPkg.Cluster{Metadata: cl.Metadata})
}
w.Header().Set("Content-Type", "application/json")
@@ -324,42 +324,12 @@ func (h clusterHandler) deleteClusterHandler(w http.ResponseWriter, r *http.Requ
w.WriteHeader(http.StatusNoContent)
}
-// apply network intents associated with the cluster
-func (h clusterHandler) applyClusterHandler(w http.ResponseWriter, r *http.Request) {
- vars := mux.Vars(r)
- provider := vars["provider-name"]
- name := vars["name"]
-
- err := h.client.ApplyNetworkIntents(provider, name)
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
-
- w.WriteHeader(http.StatusNoContent)
-}
-
-// terminate network intents associated with the cluster
-func (h clusterHandler) terminateClusterHandler(w http.ResponseWriter, r *http.Request) {
- vars := mux.Vars(r)
- provider := vars["provider-name"]
- name := vars["name"]
-
- err := h.client.TerminateNetworkIntents(provider, name)
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
-
- w.WriteHeader(http.StatusNoContent)
-}
-
// Create handles creation of the ClusterLabel entry in the database
func (h clusterHandler) createClusterLabelHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
provider := vars["provider-name"]
cluster := vars["cluster-name"]
- var p moduleLib.ClusterLabel
+ var p clusterPkg.ClusterLabel
err := json.NewDecoder(r.Body).Decode(&p)
@@ -439,7 +409,7 @@ func (h clusterHandler) createClusterKvPairsHandler(w http.ResponseWriter, r *ht
vars := mux.Vars(r)
provider := vars["provider-name"]
cluster := vars["cluster-name"]
- var p moduleLib.ClusterKvPairs
+ var p clusterPkg.ClusterKvPairs
err := json.NewDecoder(r.Body).Decode(&p)