diff options
author | Rajamohan Raj <rajamohan.raj@intel.com> | 2020-07-17 14:04:19 +0000 |
---|---|---|
committer | Rajamohan Raj <rajamohan.raj@intel.com> | 2020-07-17 20:38:24 +0000 |
commit | 75178df33f0cc45f46051394ad9d14f6a84cd8e9 (patch) | |
tree | 3c89f320e6879c175a2760e41bec634fff5aa22c /src/orchestrator/api/deployment_intent_groups_handler.go | |
parent | 09ade2b51d5e3d4da5921115a993bec97a905e1b (diff) |
Add APIs for getAll DeploymentIntents and GetAll GenericPlacemnetIntents
In this patch, implemented two separate routes for getting all
genericPlacemnetIntents and getting all deployment intents.
Issue-ID: MULTICLOUD-1128
Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com>
Change-Id: I81fadb126752788da7c459aa43896fafa583310e
Diffstat (limited to 'src/orchestrator/api/deployment_intent_groups_handler.go')
-rw-r--r-- | src/orchestrator/api/deployment_intent_groups_handler.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/orchestrator/api/deployment_intent_groups_handler.go b/src/orchestrator/api/deployment_intent_groups_handler.go index 3f5b3969..7620737b 100644 --- a/src/orchestrator/api/deployment_intent_groups_handler.go +++ b/src/orchestrator/api/deployment_intent_groups_handler.go @@ -22,6 +22,7 @@ import ( "net/http" moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module" + "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/validation" "github.com/gorilla/mux" ) @@ -116,6 +117,31 @@ func (h deploymentIntentGroupHandler) getDeploymentIntentGroupHandler(w http.Res } +func (h deploymentIntentGroupHandler) getAllDeploymentIntentGroupsHandler(w http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + pList := []string{"project-name", "composite-app-name", "composite-app-version"} + err := validation.IsValidParameterPresent(vars, pList) + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + } + p := vars["project-name"] + ca := vars["composite-app-name"] + v := vars["composite-app-version"] + + diList, err := h.client.GetAllDeploymentIntentGroups(p, ca, v) + if err != nil { + http.Error(w, err.Error(), http.StatusNotFound) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + err = json.NewEncoder(w).Encode(diList) + if err != nil { + http.Error(w, err.Error(), http.StatusNotFound) + return + } +} + func (h deploymentIntentGroupHandler) deleteDeploymentIntentGroupHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) |