summaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg/module/compositeapp.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/orchestrator/pkg/module/compositeapp.go')
-rw-r--r--src/orchestrator/pkg/module/compositeapp.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/orchestrator/pkg/module/compositeapp.go b/src/orchestrator/pkg/module/compositeapp.go
index 70502367..5bf7ddec 100644
--- a/src/orchestrator/pkg/module/compositeapp.go
+++ b/src/orchestrator/pkg/module/compositeapp.go
@@ -64,6 +64,7 @@ func (cK CompositeAppKey) String() string {
type CompositeAppManager interface {
CreateCompositeApp(c CompositeApp, p string) (CompositeApp, error)
GetCompositeApp(name string, version string, p string) (CompositeApp, error)
+ GetAllCompositeApps(p string) ([]CompositeApp, error)
DeleteCompositeApp(name string, version string, p string) error
}
@@ -140,6 +141,38 @@ func (v *CompositeAppClient) GetCompositeApp(name string, version string, p stri
return CompositeApp{}, pkgerrors.New("Error getting composite application")
}
+// GetAllCompositeApps returns all the compositeApp for a given project
+func (v *CompositeAppClient) GetAllCompositeApps(p string) ([]CompositeApp, error) {
+
+ _, err := NewProjectClient().GetProject(p)
+ if err != nil {
+ return []CompositeApp{}, pkgerrors.New("Unable to find the project")
+ }
+
+ key := CompositeAppKey{
+ CompositeAppName: "",
+ Version: "",
+ Project: p,
+ }
+
+ var caList []CompositeApp
+ values, err := db.DBconn.Find(v.storeName, key, v.tagMeta)
+ if err != nil {
+ return []CompositeApp{}, pkgerrors.Wrap(err, "Getting CompositeApps")
+ }
+
+ for _, value := range values {
+ ca := CompositeApp{}
+ err = db.DBconn.Unmarshal(value, &ca)
+ if err != nil {
+ return []CompositeApp{}, pkgerrors.Wrap(err, "Unmarshaling CompositeApp")
+ }
+ caList = append(caList, ca)
+ }
+
+ return caList, nil
+}
+
// DeleteCompositeApp deletes the CompositeApp from database
func (v *CompositeAppClient) DeleteCompositeApp(name string, version string, p string) error {