summaryrefslogtreecommitdiffstats
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.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/k8splugin/api/api.go b/src/k8splugin/api/api.go
index cb094683..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()
@@ -48,6 +50,11 @@ func NewRouter(defClient rb.DefinitionManager,
instRouter.HandleFunc("/instance/{instID}", instHandler.getHandler).Methods("GET")
instRouter.HandleFunc("/instance/{instID}/status", instHandler.statusHandler).Methods("GET")
+ instRouter.HandleFunc("/instance/{instID}/query", instHandler.queryHandler).
+ Queries("ApiVersion", "{ApiVersion}",
+ "Kind", "{Kind}",
+ "Name", "{Name}",
+ "Labels", "{Labels}").Methods("GET")
instRouter.HandleFunc("/instance/{instID}", instHandler.deleteHandler).Methods("DELETE")
// (TODO): Fix update method
// instRouter.HandleFunc("/{vnfInstanceId}", UpdateHandler).Methods("PUT")
@@ -115,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")