From a75d489bbf87712371d67dce0753577bdacce0c3 Mon Sep 17 00:00:00 2001 From: Ritu Sood Date: Fri, 31 Jan 2020 23:29:51 -0800 Subject: Restructure code and create module library Restructures and moves code to make it aligned with the current design. https://wiki.onap.org/display/DW/Multi+Cluster+Application+Scheduler examples/example_module.go shows how to import and use modules from this package. Patch#2 Updated example Issue-ID: MULTICLOUD-871 Signed-off-by: Ritu Sood Change-Id: Ia1e9802a946a07dcca8f79f0e2250933ab3efa66 --- src/orchestrator/api/projecthandler.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/orchestrator/api/projecthandler.go') diff --git a/src/orchestrator/api/projecthandler.go b/src/orchestrator/api/projecthandler.go index 30f21de3..1830b91d 100644 --- a/src/orchestrator/api/projecthandler.go +++ b/src/orchestrator/api/projecthandler.go @@ -21,7 +21,7 @@ import ( "io" "net/http" - "github.com/onap/multicloud-k8s/src/orchestrator/internal/project" + moduleLib "github.com/onap/multicloud-k8s/src/orchestrator/pkg/module" "github.com/gorilla/mux" ) @@ -31,12 +31,12 @@ import ( type projectHandler struct { // Interface that implements Project operations // We will set this variable with a mock interface for testing - client project.ProjectManager + client moduleLib.ProjectManager } // Create handles creation of the Project entry in the database func (h projectHandler) createHandler(w http.ResponseWriter, r *http.Request) { - var p project.Project + var p moduleLib.Project err := json.NewDecoder(r.Body).Decode(&p) switch { @@ -54,7 +54,7 @@ func (h projectHandler) createHandler(w http.ResponseWriter, r *http.Request) { return } - ret, err := h.client.Create(p) + ret, err := h.client.CreateProject(p) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -75,7 +75,7 @@ func (h projectHandler) getHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) name := vars["project-name"] - ret, err := h.client.Get(name) + ret, err := h.client.GetProject(name) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -95,7 +95,7 @@ func (h projectHandler) deleteHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) name := vars["project-name"] - err := h.client.Delete(name) + err := h.client.DeleteProject(name) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return -- cgit 1.2.3-korg