diff options
author | 2019-06-25 11:42:31 -0700 | |
---|---|---|
committer | 2019-06-26 10:38:47 -0700 | |
commit | 6b911a5168a72e8659309db7349750cdec6eb8d2 (patch) | |
tree | c6bdb6aa1a528c2e653c786bab7953f8abafa550 /src/k8splugin/api/api.go | |
parent | 8445148cf095fcc55a9ada3e2bb0fece7a065089 (diff) |
Move connectionhandler.go into api package
Move connectionhandler.go into api package
This brings it inline with the other API handlers
Issue-ID: MULTICLOUD-666
Change-Id: Ia3b832159f537c6d8d8ecc93b56bc9b085649f7e
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r-- | src/k8splugin/api/api.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go index 636b80b4..353972a1 100644 --- a/src/k8splugin/api/api.go +++ b/src/k8splugin/api/api.go @@ -26,6 +26,7 @@ func NewRouter(defClient rb.DefinitionManager, profileClient rb.ProfileManager, instClient app.InstanceManager, configClient app.ConfigManager, + connectionClient connection.ConnectionManager, templateClient rb.ConfigTemplateManager) *mux.Router { router := mux.NewRouter() @@ -51,11 +52,13 @@ func NewRouter(defClient rb.DefinitionManager, router.HandleFunc("/{cloud-owner}/{cloud-region}/infra_workload/{instID}", brokerHandler.deleteHandler).Methods("DELETE") //Setup the connectivity api handler here - connectionClient := connection.NewConnectionClient() - connectionHandler := connection.ConnectionHandler{Client: connectionClient} - instRouter.HandleFunc("/connectivity-info", connectionHandler.CreateHandler).Methods("POST") - instRouter.HandleFunc("/connectivity-info/{connname}", connectionHandler.GetHandler).Methods("GET") - instRouter.HandleFunc("/connectivity-info/{connname}", connectionHandler.DeleteHandler).Methods("DELETE") + if connectionClient == nil { + connectionClient = connection.NewConnectionClient() + } + connectionHandler := connectionHandler{client: connectionClient} + instRouter.HandleFunc("/connectivity-info", connectionHandler.createHandler).Methods("POST") + instRouter.HandleFunc("/connectivity-info/{connname}", connectionHandler.getHandler).Methods("GET") + instRouter.HandleFunc("/connectivity-info/{connname}", connectionHandler.deleteHandler).Methods("DELETE") //Setup resource bundle definition routes if defClient == nil { |