diff options
author | Konrad Bańka <k.banka@samsung.com> | 2021-02-25 00:08:05 +0100 |
---|---|---|
committer | Konrad Bańka <k.banka@samsung.com> | 2021-02-25 15:30:45 +0100 |
commit | 22a37f42a54c1acd2f095bc559ab03745e5ae7f9 (patch) | |
tree | 18be25e5475c5bf8d00d2e43a734d4eca2658a7b /src/k8splugin/api/api.go | |
parent | fec64d4a5d7986e4d92b1350f31c9a3c81e82e6e (diff) |
Provide Healthcheck API MVP0.8.0
Implements basic functionality of running starting Healthcheck.
Results can be inspected so-far without dedicated API, by using, for
example, Query API.
Issue-ID: MULTICLOUD-1233
Signed-off-by: Konrad Bańka <k.banka@samsung.com>
Change-Id: Ia4d96d936d573173d7d8f41e6c39d059bf5f8b1f
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r-- | src/k8splugin/api/api.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go index a7aa0be7..2c53a297 100644 --- a/src/k8splugin/api/api.go +++ b/src/k8splugin/api/api.go @@ -17,6 +17,7 @@ package api import ( "github.com/onap/multicloud-k8s/src/k8splugin/internal/app" "github.com/onap/multicloud-k8s/src/k8splugin/internal/connection" + "github.com/onap/multicloud-k8s/src/k8splugin/internal/healthcheck" "github.com/onap/multicloud-k8s/src/k8splugin/internal/rb" "github.com/gorilla/mux" @@ -28,7 +29,8 @@ func NewRouter(defClient rb.DefinitionManager, instClient app.InstanceManager, configClient app.ConfigManager, connectionClient connection.ConnectionManager, - templateClient rb.ConfigTemplateManager) *mux.Router { + templateClient rb.ConfigTemplateManager, + healthcheckClient healthcheck.InstanceHCManager) *mux.Router { router := mux.NewRouter() @@ -120,6 +122,16 @@ func NewRouter(defClient rb.DefinitionManager, instRouter.HandleFunc("/instance/{instID}/config/rollback", configHandler.rollbackHandler).Methods("POST") instRouter.HandleFunc("/instance/{instID}/config/tagit", configHandler.tagitHandler).Methods("POST") + // Instance Healthcheck API + if healthcheckClient == nil { + healthcheckClient = healthcheck.NewHCClient() + } + healthcheckHandler := instanceHCHandler{client: healthcheckClient} + instRouter.HandleFunc("/instance/{instID}/healthcheck", healthcheckHandler.listHandler).Methods("GET") + instRouter.HandleFunc("/instance/{instID}/healthcheck", healthcheckHandler.createHandler).Methods("POST") + instRouter.HandleFunc("/instance/{instID}/healthcheck/{hcID}", healthcheckHandler.getHandler).Methods("GET") + instRouter.HandleFunc("/instance/{instID}/healthcheck/{hcID}", healthcheckHandler.deleteHandler).Methods("DELETE") + // Add healthcheck path instRouter.HandleFunc("/healthcheck", healthCheckHandler).Methods("GET") |