aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/orchestrator/api')
-rw-r--r--src/orchestrator/api/api.go18
-rw-r--r--src/orchestrator/api/app_intent_handler.go26
-rw-r--r--src/orchestrator/api/generic_placement_intent_handler.go17
3 files changed, 41 insertions, 20 deletions
diff --git a/src/orchestrator/api/api.go b/src/orchestrator/api/api.go
index de69d163..07f8fe34 100644
--- a/src/orchestrator/api/api.go
+++ b/src/orchestrator/api/api.go
@@ -128,13 +128,13 @@ func NewRouter(projectClient moduleLib.ProjectManager,
genericPlacementIntentHandler := genericPlacementIntentHandler{
client: genericPlacementIntentClient,
}
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents", genericPlacementIntentHandler.createGenericPlacementIntentHandler).Methods("POST")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents", genericPlacementIntentHandler.createGenericPlacementIntentHandler).Methods("POST")
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}", genericPlacementIntentHandler.getGenericPlacementHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents/{intent-name}", genericPlacementIntentHandler.getGenericPlacementHandler).Methods("GET")
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents", genericPlacementIntentHandler.getAllGenericPlacementIntentsHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents", genericPlacementIntentHandler.getAllGenericPlacementIntentsHandler).Methods("GET")
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}", genericPlacementIntentHandler.deleteGenericPlacementHandler).Methods("DELETE")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents/{intent-name}", genericPlacementIntentHandler.deleteGenericPlacementHandler).Methods("DELETE")
//setting routes for AppIntent
if appIntentClient == nil {
@@ -145,11 +145,11 @@ func NewRouter(projectClient moduleLib.ProjectManager,
client: appIntentClient,
}
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents", appIntentHandler.createAppIntentHandler).Methods("POST")
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.getAppIntentHandler).Methods("GET")
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents", appIntentHandler.getAllAppIntentsHandler).Methods("GET")
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/", appIntentHandler.getAllIntentsByAppHandler).Queries("app-name", "{app-name}")
- router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.deleteAppIntentHandler).Methods("DELETE")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents/{intent-name}/app-intents", appIntentHandler.createAppIntentHandler).Methods("POST")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.getAppIntentHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents/{intent-name}/app-intents", appIntentHandler.getAllAppIntentsHandler).Methods("GET")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents/{intent-name}/app-intents/", appIntentHandler.getAllIntentsByAppHandler).Queries("app-name", "{app-name}")
+ router.HandleFunc("/projects/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intents/{intent-name}/app-intents/{app-intent-name}", appIntentHandler.deleteAppIntentHandler).Methods("DELETE")
//setting routes for deploymentIntentGroup
if deploymentIntentGrpClient == nil {
deploymentIntentGrpClient = moduleClient.DeploymentIntentGroup
diff --git a/src/orchestrator/api/app_intent_handler.go b/src/orchestrator/api/app_intent_handler.go
index 1d48f8a6..3d0d5bad 100644
--- a/src/orchestrator/api/app_intent_handler.go
+++ b/src/orchestrator/api/app_intent_handler.go
@@ -62,8 +62,9 @@ func (h appIntentHandler) createAppIntentHandler(w http.ResponseWriter, r *http.
compositeAppName := vars["composite-app-name"]
version := vars["composite-app-version"]
intent := vars["intent-name"]
+ digName := vars["deployment-intent-group-name"]
- appIntent, createErr := h.client.CreateAppIntent(a, projectName, compositeAppName, version, intent)
+ appIntent, createErr := h.client.CreateAppIntent(a, projectName, compositeAppName, version, intent, digName)
if createErr != nil {
http.Error(w, createErr.Error(), http.StatusInternalServerError)
return
@@ -104,13 +105,19 @@ func (h appIntentHandler) getAppIntentHandler(w http.ResponseWriter, r *http.Req
return
}
+ dig := vars["deployment-intent-group-name"]
+ if dig == "" {
+ http.Error(w, "Missing deploymentIntentGroupName in GET request", http.StatusBadRequest)
+ return
+ }
+
ai := vars["app-intent-name"]
if ai == "" {
http.Error(w, "Missing appIntentName in GET request", http.StatusBadRequest)
return
}
- appIntent, err := h.client.GetAppIntent(ai, p, ca, v, i)
+ appIntent, err := h.client.GetAppIntent(ai, p, ca, v, i,dig)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -128,7 +135,7 @@ func (h appIntentHandler) getAppIntentHandler(w http.ResponseWriter, r *http.Req
/*
getAllIntentsByAppHandler handles the URL:
-/v2/project/{project-name}/composite-apps/{composite-app-name}/{version}/generic-placement-intent/{intent-name}/app-intents?app-name=<app-name>
+/v2/project/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intent/{intent-name}/app-intents?app-name=<app-name>
*/
func (h appIntentHandler) getAllIntentsByAppHandler(w http.ResponseWriter, r *http.Request) {
@@ -142,13 +149,15 @@ func (h appIntentHandler) getAllIntentsByAppHandler(w http.ResponseWriter, r *ht
ca := vars["composite-app-name"]
v := vars["composite-app-version"]
i := vars["intent-name"]
+ digName := vars["deployment-intent-group-name"]
+
aN := r.URL.Query().Get("app-name")
if aN == "" {
http.Error(w, "Missing appName in GET request", http.StatusBadRequest)
return
}
- specData, err := h.client.GetAllIntentsByApp(aN, p, ca, v, i)
+ specData, err := h.client.GetAllIntentsByApp(aN, p, ca, v, i, digName)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -166,7 +175,7 @@ func (h appIntentHandler) getAllIntentsByAppHandler(w http.ResponseWriter, r *ht
/*
getAllAppIntentsHandler handles the URL:
-/v2/project/{project-name}/composite-apps/{composite-app-name}/{version}/generic-placement-intent/{intent-name}/app-intents
+/v2/project/{project-name}/composite-apps/{composite-app-name}/{composite-app-version}/deployment-intent-groups/{deployment-intent-group-name}/generic-placement-intent/{intent-name}/app-intents
*/
func (h appIntentHandler) getAllAppIntentsHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
@@ -179,8 +188,9 @@ func (h appIntentHandler) getAllAppIntentsHandler(w http.ResponseWriter, r *http
ca := vars["composite-app-name"]
v := vars["composite-app-version"]
i := vars["intent-name"]
+ digName := vars["deployment-intent-group-name"]
- applicationsAndClusterInfo, err := h.client.GetAllAppIntents(p, ca, v, i)
+ applicationsAndClusterInfo, err := h.client.GetAllAppIntents(p, ca, v, i, digName)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -205,8 +215,10 @@ func (h appIntentHandler) deleteAppIntentHandler(w http.ResponseWriter, r *http.
v := vars["composite-app-version"]
i := vars["intent-name"]
ai := vars["app-intent-name"]
+ digName := vars["deployment-intent-group-name"]
+
- err := h.client.DeleteAppIntent(ai, p, ca, v, i)
+ err := h.client.DeleteAppIntent(ai, p, ca, v, i, digName)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
diff --git a/src/orchestrator/api/generic_placement_intent_handler.go b/src/orchestrator/api/generic_placement_intent_handler.go
index 2415ae2c..cb23776a 100644
--- a/src/orchestrator/api/generic_placement_intent_handler.go
+++ b/src/orchestrator/api/generic_placement_intent_handler.go
@@ -62,8 +62,9 @@ func (h genericPlacementIntentHandler) createGenericPlacementIntentHandler(w htt
projectName := vars["project-name"]
compositeAppName := vars["composite-app-name"]
version := vars["composite-app-version"]
+ digName := vars["deployment-intent-group-name"]
- gPIntent, createErr := h.client.CreateGenericPlacementIntent(g, projectName, compositeAppName, version)
+ gPIntent, createErr := h.client.CreateGenericPlacementIntent(g, projectName, compositeAppName, version, digName)
if createErr != nil {
http.Error(w, createErr.Error(), http.StatusInternalServerError)
return
@@ -103,7 +104,13 @@ func (h genericPlacementIntentHandler) getGenericPlacementHandler(w http.Respons
return
}
- gPIntent, err := h.client.GetGenericPlacementIntent(intentName, projectName, compositeAppName, version)
+ dig := vars["deployment-intent-group-name"]
+ if dig == "" {
+ http.Error(w, "Missing deploymentIntentGroupName in GET request", http.StatusBadRequest)
+ return
+ }
+
+ gPIntent, err := h.client.GetGenericPlacementIntent(intentName, projectName, compositeAppName, version, dig)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
@@ -128,8 +135,9 @@ func (h genericPlacementIntentHandler) getAllGenericPlacementIntentsHandler(w ht
p := vars["project-name"]
ca := vars["composite-app-name"]
v := vars["composite-app-version"]
+ digName := vars["deployment-intent-group-name"]
- gpList, err := h.client.GetAllGenericPlacementIntents(p, ca, v)
+ gpList, err := h.client.GetAllGenericPlacementIntents(p, ca, v, digName)
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return
@@ -150,8 +158,9 @@ func (h genericPlacementIntentHandler) deleteGenericPlacementHandler(w http.Resp
p := vars["project-name"]
ca := vars["composite-app-name"]
v := vars["composite-app-version"]
+ digName := vars["deployment-intent-group-name"]
- err := h.client.DeleteGenericPlacementIntent(i, p, ca, v)
+ err := h.client.DeleteGenericPlacementIntent(i, p, ca, v, digName)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return