diff options
author | Eric Multanen <eric.w.multanen@intel.com> | 2020-07-28 16:28:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-07-28 16:28:10 +0000 |
commit | dd8caf8bc7024ec0ef1bfe448b0f61428a69ba05 (patch) | |
tree | 420a1bc428bc6ee6a7434f97a6ff245b9f32896e /src/orchestrator/pkg/module/project.go | |
parent | d641c3864d4ba71e127d332c4ac2082f98bba1e5 (diff) | |
parent | b102d4ab1a47809f514213eb1f997d4f60893c9f (diff) |
Merge "Adds PUT api to v2/projects"
Diffstat (limited to 'src/orchestrator/pkg/module/project.go')
-rw-r--r-- | src/orchestrator/pkg/module/project.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/orchestrator/pkg/module/project.go b/src/orchestrator/pkg/module/project.go index 02f6d827..e86266b9 100644 --- a/src/orchestrator/pkg/module/project.go +++ b/src/orchestrator/pkg/module/project.go @@ -55,7 +55,7 @@ func (pk ProjectKey) String() string { // ProjectManager is an interface exposes the Project functionality type ProjectManager interface { - CreateProject(pr Project) (Project, error) + CreateProject(pr Project, exists bool) (Project, error) GetProject(name string) (Project, error) DeleteProject(name string) error GetAllProjects() ([]Project, error) @@ -78,7 +78,7 @@ func NewProjectClient() *ProjectClient { } // CreateProject a new collection based on the project -func (v *ProjectClient) CreateProject(p Project) (Project, error) { +func (v *ProjectClient) CreateProject(p Project, exists bool) (Project, error) { //Construct the composite key to select the entry key := ProjectKey{ @@ -87,7 +87,7 @@ func (v *ProjectClient) CreateProject(p Project) (Project, error) { //Check if this Project already exists _, err := v.GetProject(p.MetaData.Name) - if err == nil { + if err == nil && !exists { return Project{}, pkgerrors.New("Project already exists") } |