X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Frestful%2Frestful.go;h=4255e2b02cb376d1ed1e87bab894e58ec2aada7c;hb=refs%2Fchanges%2F22%2F8922%2F1;hp=2b8dc96c61459ab4bbd6919812e9f38b7466b9ff;hpb=fbfb25a4dfffda5f400508e49fd46401934453de;p=ric-plt%2Fricdms.git diff --git a/pkg/restful/restful.go b/pkg/restful/restful.go index 2b8dc96..4255e2b 100644 --- a/pkg/restful/restful.go +++ b/pkg/restful/restful.go @@ -23,14 +23,22 @@ import ( "log" "os" + ph "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/health" "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi" "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations" + "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/health" + "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/resthooks" "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/ricdms" "github.com/go-openapi/loads" + "github.com/go-openapi/runtime/middleware" ) func NewRestful() *Restful { - r := &Restful{} + r := &Restful{ + rh: resthooks.NewResthook( + ph.NewHealthChecker(), + ), + } r.setupHandler() return r } @@ -42,6 +50,13 @@ func (r *Restful) setupHandler() { } api := operations.NewRICDMSAPI(swaggerSpec) + + api.HealthGetHealthCheckHandler = health.GetHealthCheckHandlerFunc(func(ghcp health.GetHealthCheckParams) middleware.Responder { + ricdms.Logger.Debug("==> HealthCheck API invoked.") + resp := r.rh.GetDMSHealth() + return resp + }) + r.api = api }