From b11b37f11fa45ab149e8a88a183b70f077c0f48e Mon Sep 17 00:00:00 2001 From: Srivahni Chivukula Date: Fri, 14 Feb 2020 05:11:08 -0800 Subject: Add Composite Application API Implemented Composite application API and added create, get and delete handlers for the composite applications. Formatted Project related .go files Issue-ID: MULTICLOUD-994 Signed-off-by: Srivahni Chivukula Change-Id: I7cef1a2c75f8cb39f397dcbb3f5d7bb2a57b4a72 --- src/orchestrator/pkg/module/project.go | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/orchestrator/pkg/module/project.go') diff --git a/src/orchestrator/pkg/module/project.go b/src/orchestrator/pkg/module/project.go index 796e9e99..a95251b5 100644 --- a/src/orchestrator/pkg/module/project.go +++ b/src/orchestrator/pkg/module/project.go @@ -18,27 +18,25 @@ package module import ( "encoding/json" + "github.com/onap/multicloud-k8s/src/orchestrator/pkg/infra/db" pkgerrors "github.com/pkg/errors" ) - // Project contains the metaData for Projects type Project struct { - MetaData ProjectMetaData`json:"metadata"` + MetaData ProjectMetaData `json:"metadata"` } - // ProjectMetaData contains the parameters for creating a project type ProjectMetaData struct { - Name string `json:"name"` + Name string `json:"name"` Description string `json:"description"` - UserData1 string `userData1:"userData1"` - UserData2 string `userData2:"userData2"` + UserData1 string `userData1:"userData1"` + UserData2 string `userData2:"userData2"` } - // ProjectKey is the key structure that is used in the database type ProjectKey struct { ProjectName string `json:"project"` @@ -55,7 +53,6 @@ func (pk ProjectKey) String() string { return string(out) } - // ProjectManager is an interface exposes the Project functionality type ProjectManager interface { CreateProject(pr Project) (Project, error) @@ -63,7 +60,6 @@ type ProjectManager interface { DeleteProject(name string) error } - // ProjectClient implements the ProjectManager // It will also be used to maintain some localized state type ProjectClient struct { @@ -71,17 +67,15 @@ type ProjectClient struct { tagMeta, tagContent string } - // NewProjectClient returns an instance of the ProjectClient // which implements the ProjectManager func NewProjectClient() *ProjectClient { return &ProjectClient{ storeName: "orchestrator", - tagMeta: "projectmetadata", + tagMeta: "projectmetadata", } } - // CreateProject a new collection based on the project func (v *ProjectClient) CreateProject(p Project) (Project, error) { @@ -104,7 +98,6 @@ func (v *ProjectClient) CreateProject(p Project) (Project, error) { return p, nil } - // GetProject returns the Project for corresponding name func (v *ProjectClient) GetProject(name string) (Project, error) { @@ -130,7 +123,6 @@ func (v *ProjectClient) GetProject(name string) (Project, error) { return Project{}, pkgerrors.New("Error getting Project") } - // DeleteProject the Project from database func (v *ProjectClient) DeleteProject(name string) error { @@ -145,4 +137,4 @@ func (v *ProjectClient) DeleteProject(name string) error { //TODO: Delete the collection when the project is deleted return nil -} \ No newline at end of file +} -- cgit 1.2.3-korg