summaryrefslogtreecommitdiffstats
path: root/src/ncm/api/clusterhandler.go
diff options
context:
space:
mode:
authorRitu Sood <Ritu.Sood@intel.com>2020-04-17 22:45:23 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-17 22:45:23 +0000
commite49d4f0f4b4252b2e3acc713e8dba7084e285273 (patch)
treed964b0c07c7ae1da00f74590d79023163503f0cb /src/ncm/api/clusterhandler.go
parent1c3a22e3de0dd24b4161ae8b34794627620a208b (diff)
parentb7a4e00a6cd9d4ce903448ea958d85f17c8d68ab (diff)
Merge "Add apply API for network intents"
Diffstat (limited to 'src/ncm/api/clusterhandler.go')
-rw-r--r--src/ncm/api/clusterhandler.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ncm/api/clusterhandler.go b/src/ncm/api/clusterhandler.go
index 8c50f720..78453aa8 100644
--- a/src/ncm/api/clusterhandler.go
+++ b/src/ncm/api/clusterhandler.go
@@ -324,6 +324,36 @@ 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)