summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/api/add_intents_handler.go
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-08-21 00:11:26 +0000
committerGerrit Code Review <gerrit@onap.org>2020-08-21 00:11:26 +0000
commit38ed3fbf85636ad5f73538c2de07cce72499f5bf (patch)
tree0b0df9525e67e0180c00abaa078d07fc9b5d9e08 /src/orchestrator/api/add_intents_handler.go
parenta5ffa8aadf49bb92371f06797b264e0bf4c264e2 (diff)
parent6fc3a329aba55dfa2d4867bde9d8a3126b45f59a (diff)
Merge "Add Validation for API's"
Diffstat (limited to 'src/orchestrator/api/add_intents_handler.go')
-rw-r--r--src/orchestrator/api/add_intents_handler.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/orchestrator/api/add_intents_handler.go b/src/orchestrator/api/add_intents_handler.go
index ac8b400d..21a33739 100644
--- a/src/orchestrator/api/add_intents_handler.go
+++ b/src/orchestrator/api/add_intents_handler.go
@@ -31,6 +31,7 @@ type intentHandler struct {
client moduleLib.IntentManager
}
+// Add Intent in Deployment Group
func (h intentHandler) addIntentHandler(w http.ResponseWriter, r *http.Request) {
var i moduleLib.Intent
@@ -45,8 +46,11 @@ func (h intentHandler) addIntentHandler(w http.ResponseWriter, r *http.Request)
return
}
- if i.MetaData.Name == "" {
- http.Error(w, "Missing Intent in POST request", http.StatusBadRequest)
+ jsonFile := "json-schemas/deployment-intent.json"
+ // Verify JSON Body
+ err, httpError := validation.ValidateJsonSchemaData(jsonFile, i)
+ if err != nil {
+ http.Error(w, err.Error(), httpError)
return
}