aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/infra
diff options
context:
space:
mode:
authorRajamohan Raj <rajamohan.raj@intel.com>2020-04-09 16:54:55 +0000
committerRajamohan Raj <rajamohan.raj@intel.com>2020-04-09 17:05:32 +0000
commitf65daf54a4ab24be9e2c82236a511cedc3bdf230 (patch)
tree293d16c3e15904a3f7474769c8ced4acbb7222fc /src/orchestrator/pkg/infra
parent1e240a189cfc4a02d9072241fdf30adbc8c1539b (diff)
Adding query APIs for AppIntents
In this patch the following tasks where performed: 1. Added APIs for query Intents for each App in the compositeApp. For example, you can see all intents of collectd or prometheus seperately if both formed a compositeApp Collection. 2. Added 'provider-name' parameter to denote the cluster objects used in all intents. Earlier we had only clusterName and clusterlabel to denote a cluster. Modified the tests also for this. 3. Fixed bugs in the plugin_collection_v2.sh. 4. Fixed some minor logging and formatting bugs. Issue-ID: MULTICLOUD-1048 Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com> Change-Id: Ic452d7ba5d98bb265eb301de84d679d1abe0e34e
Diffstat (limited to 'src/orchestrator/pkg/infra')
-rw-r--r--src/orchestrator/pkg/infra/db/mongo.go3
-rw-r--r--src/orchestrator/pkg/infra/db/store.go2
-rw-r--r--src/orchestrator/pkg/infra/validation/validation.go20
3 files changed, 22 insertions, 3 deletions
diff --git a/src/orchestrator/pkg/infra/db/mongo.go b/src/orchestrator/pkg/infra/db/mongo.go
index a344aa1c..b33d6c65 100644
--- a/src/orchestrator/pkg/infra/db/mongo.go
+++ b/src/orchestrator/pkg/infra/db/mongo.go
@@ -49,7 +49,7 @@ type MongoCollection interface {
opts ...*options.FindOptions) (*mongo.Cursor, error)
UpdateOne(ctx context.Context, filter interface{}, update interface{},
opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- CountDocuments(ctx context.Context, filter interface{},
+ CountDocuments(ctx context.Context, filter interface{},
opts ...*options.CountOptions) (int64, error)
}
@@ -587,4 +587,3 @@ func (m *MongoStore) Remove(coll string, key Key) error {
}
return nil
}
-
diff --git a/src/orchestrator/pkg/infra/db/store.go b/src/orchestrator/pkg/infra/db/store.go
index e87722cd..9c6532f1 100644
--- a/src/orchestrator/pkg/infra/db/store.go
+++ b/src/orchestrator/pkg/infra/db/store.go
@@ -59,7 +59,7 @@ type Store interface {
// Find the document(s) with key and get the tag values from the document(s)
Find(coll string, key Key, tag string) ([][]byte, error)
- // Removes the document(s) matching the key if no child reference in collection
+ // Removes the document(s) matching the key if no child reference in collection
Remove(coll string, key Key) error
// Remove all the document(s) matching the key
diff --git a/src/orchestrator/pkg/infra/validation/validation.go b/src/orchestrator/pkg/infra/validation/validation.go
index d744dc3d..0b44a8ba 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"
@@ -262,3 +263,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
+
+}