diff options
author | Ritu Sood <ritu.sood@intel.com> | 2020-01-31 23:29:51 -0800 |
---|---|---|
committer | Srivahni Chivukula <srivahni.chivukula@intel.com> | 2020-02-14 03:54:11 -0800 |
commit | a75d489bbf87712371d67dce0753577bdacce0c3 (patch) | |
tree | dee646769aa432c814abd86645af612e714640be /src/orchestrator/api/projecthandler.go | |
parent | c06be6458e9985bd7ac0b25fab03d9c8605f6c4a (diff) |
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 <ritu.sood@intel.com>
Change-Id: Ia1e9802a946a07dcca8f79f0e2250933ab3efa66
Diffstat (limited to 'src/orchestrator/api/projecthandler.go')
-rw-r--r-- | src/orchestrator/api/projecthandler.go | 12 |
1 files changed, 6 insertions, 6 deletions
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 |