diff options
author | Eric Multanen <eric.w.multanen@intel.com> | 2020-09-30 22:38:59 -0700 |
---|---|---|
committer | Eric Multanen <eric.w.multanen@intel.com> | 2020-10-02 23:41:52 -0700 |
commit | 1fc90f15489ae3eafeb5994f5285f09750feae4c (patch) | |
tree | bb42ac610b2fbc13e5cfc746bb32f3b8ccabd2b3 /src/ovnaction/api/workloadintenthandler.go | |
parent | d4b89af411ec7444b554a8b0ddeb7e239fa0fc73 (diff) |
Ovnaction and vfw updates for deploy api change
Update the ovnaction controller APIs to support
the api change of including the deployment intent
group in the URL. Also fixup:
- vfw and other test cases to support the change
- updates to emcoctl tool and examples
Issue-ID: MULTICLOUD-1218
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Change-Id: Icadacb5ec6d7c238bb3bf8a44a39c30692ecebee
Diffstat (limited to 'src/ovnaction/api/workloadintenthandler.go')
-rw-r--r-- | src/ovnaction/api/workloadintenthandler.go | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/ovnaction/api/workloadintenthandler.go b/src/ovnaction/api/workloadintenthandler.go index acf4edbb..485f6f40 100644 --- a/src/ovnaction/api/workloadintenthandler.go +++ b/src/ovnaction/api/workloadintenthandler.go @@ -22,8 +22,8 @@ import ( "io" "net/http" - moduleLib "github.com/onap/multicloud-k8s/src/ovnaction/pkg/module" "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation" + moduleLib "github.com/onap/multicloud-k8s/src/ovnaction/pkg/module" pkgerrors "github.com/pkg/errors" "github.com/gorilla/mux" @@ -71,6 +71,7 @@ func (h workloadintentHandler) createHandler(w http.ResponseWriter, r *http.Requ project := vars["project"] compositeApp := vars["composite-app-name"] compositeAppVersion := vars["version"] + deployIntentGroup := vars["deployment-intent-group-name"] netControlIntent := vars["net-control-intent"] err := json.NewDecoder(r.Body).Decode(&wi) @@ -85,10 +86,10 @@ func (h workloadintentHandler) createHandler(w http.ResponseWriter, r *http.Requ } err, httpError := validation.ValidateJsonSchemaData(workloadIntJSONFile, wi) -if err != nil { - http.Error(w, err.Error(), httpError) - return -} + if err != nil { + http.Error(w, err.Error(), httpError) + return + } // Name is required. if wi.Metadata.Name == "" { @@ -102,7 +103,7 @@ if err != nil { return } - ret, err := h.client.CreateWorkloadIntent(wi, project, compositeApp, compositeAppVersion, netControlIntent, false) + ret, err := h.client.CreateWorkloadIntent(wi, project, compositeApp, compositeAppVersion, deployIntentGroup, netControlIntent, false) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -125,6 +126,7 @@ func (h workloadintentHandler) putHandler(w http.ResponseWriter, r *http.Request project := vars["project"] compositeApp := vars["composite-app-name"] compositeAppVersion := vars["version"] + deployIntentGroup := vars["deployment-intent-group-name"] netControlIntent := vars["net-control-intent"] err := json.NewDecoder(r.Body).Decode(&wi) @@ -157,7 +159,7 @@ func (h workloadintentHandler) putHandler(w http.ResponseWriter, r *http.Request return } - ret, err := h.client.CreateWorkloadIntent(wi, project, compositeApp, compositeAppVersion, netControlIntent, true) + ret, err := h.client.CreateWorkloadIntent(wi, project, compositeApp, compositeAppVersion, deployIntentGroup, netControlIntent, true) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -180,18 +182,19 @@ func (h workloadintentHandler) getHandler(w http.ResponseWriter, r *http.Request project := vars["project"] compositeApp := vars["composite-app-name"] compositeAppVersion := vars["version"] + deployIntentGroup := vars["deployment-intent-group-name"] netControlIntent := vars["net-control-intent"] var ret interface{} var err error if len(name) == 0 { - ret, err = h.client.GetWorkloadIntents(project, compositeApp, compositeAppVersion, netControlIntent) + ret, err = h.client.GetWorkloadIntents(project, compositeApp, compositeAppVersion, deployIntentGroup, netControlIntent) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } } else { - ret, err = h.client.GetWorkloadIntent(name, project, compositeApp, compositeAppVersion, netControlIntent) + ret, err = h.client.GetWorkloadIntent(name, project, compositeApp, compositeAppVersion, deployIntentGroup, netControlIntent) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -214,9 +217,10 @@ func (h workloadintentHandler) deleteHandler(w http.ResponseWriter, r *http.Requ project := vars["project"] compositeApp := vars["composite-app-name"] compositeAppVersion := vars["version"] + deployIntentGroup := vars["deployment-intent-group-name"] netControlIntent := vars["net-control-intent"] - err := h.client.DeleteWorkloadIntent(name, project, compositeApp, compositeAppVersion, netControlIntent) + err := h.client.DeleteWorkloadIntent(name, project, compositeApp, compositeAppVersion, deployIntentGroup, netControlIntent) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return |