aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/infra
diff options
context:
space:
mode:
authorRitu Sood <Ritu.Sood@intel.com>2020-04-13 20:38:39 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-13 20:38:39 +0000
commit7945fcd8ed65792eeb174d999138b99dbc936a6f (patch)
tree01baba65c845f5af830e724f746357e640b63599 /src/orchestrator/pkg/infra
parentc8ba8f21b68b64b4068f188614dd7c891edf035f (diff)
parentf65daf54a4ab24be9e2c82236a511cedc3bdf230 (diff)
Merge "Adding query APIs for AppIntents"
Diffstat (limited to 'src/orchestrator/pkg/infra')
-rw-r--r--src/orchestrator/pkg/infra/validation/validation.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/orchestrator/pkg/infra/validation/validation.go b/src/orchestrator/pkg/infra/validation/validation.go
index 03b37fa1..448ea5de 100644
--- a/src/orchestrator/pkg/infra/validation/validation.go
+++ b/src/orchestrator/pkg/infra/validation/validation.go
@@ -19,6 +19,7 @@ package validation
import (
"archive/tar"
"compress/gzip"
+ "fmt"
"io"
"net"
"regexp"
@@ -278,3 +279,22 @@ func IsValidNumber(value, min, max int) []string {
}
return errs
}
+
+/*
+IsValidParameterPresent method takes in a vars map and a array of string parameters
+that you expect to be present in the GET request.
+Returns Nil if all the parameters are present or else shall return error message.
+*/
+func IsValidParameterPresent(vars map[string]string, sp []string) error {
+
+ for i := range sp {
+ v := vars[sp[i]]
+ if v == "" {
+ errMessage := fmt.Sprintf("Missing %v in GET request", sp[i])
+ return fmt.Errorf(errMessage)
+ }
+
+ }
+ return nil
+
+}