aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/api/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8splugin/api/api.go')
-rw-r--r--src/k8splugin/api/api.go14
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")