aboutsummaryrefslogtreecommitdiffstats
path: root/src/orchestrator/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'src/orchestrator/pkg')
-rw-r--r--src/orchestrator/pkg/module/project.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/orchestrator/pkg/module/project.go b/src/orchestrator/pkg/module/project.go
index a6f59254..02f6d827 100644
--- a/src/orchestrator/pkg/module/project.go
+++ b/src/orchestrator/pkg/module/project.go
@@ -58,6 +58,7 @@ type ProjectManager interface {
CreateProject(pr Project) (Project, error)
GetProject(name string) (Project, error)
DeleteProject(name string) error
+ GetAllProjects() ([]Project, error)
}
// ProjectClient implements the ProjectManager
@@ -123,6 +124,29 @@ func (v *ProjectClient) GetProject(name string) (Project, error) {
return Project{}, pkgerrors.New("Error getting Project")
}
+// GetAllProjects returns all the projects
+func (v *ProjectClient) GetAllProjects() ([]Project, error) {
+ key := ProjectKey{
+ ProjectName: "",
+ }
+
+ var res []Project
+ values, err := db.DBconn.Find(v.storeName, key, v.tagMeta)
+ if err != nil {
+
+ }
+
+ for _, value := range values {
+ p := Project{}
+ err = db.DBconn.Unmarshal(value, &p)
+ if err != nil {
+ return []Project{}, pkgerrors.Wrap(err, "Unmarshaling Project")
+ }
+ res = append(res, p)
+ }
+ return res, nil
+}
+
// DeleteProject the Project from database
func (v *ProjectClient) DeleteProject(name string) error {