X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Frestful%2Frestful.go;h=ca454178e73c237755d986829d2af9417386681d;hb=refs%2Fchanges%2F45%2F9245%2F1;hp=2b8dc96c61459ab4bbd6919812e9f38b7466b9ff;hpb=0158faf85fa2465c5f6f6179b988295179717885;p=ric-plt%2Fricdms.git diff --git a/pkg/restful/restful.go b/pkg/restful/restful.go index 2b8dc96..ca45417 100644 --- a/pkg/restful/restful.go +++ b/pkg/restful/restful.go @@ -23,14 +23,28 @@ import ( "log" "os" + ch "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/charts" + ph "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/health" + po "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/onboard" "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/charts" + "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/health" + "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/onboard" + "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(), + po.NewOnboarder(), + ch.NewChartmgr(), + ), + } r.setupHandler() return r } @@ -42,6 +56,37 @@ 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 + }) + + api.OnboardPostOnboardxAppsHandler = onboard.PostOnboardxAppsHandlerFunc(func(poap onboard.PostOnboardxAppsParams) middleware.Responder { + ricdms.Logger.Debug("==> onboard API invoked.") + resp := r.rh.OnBoard(poap.Body) + return resp + }) + + api.ChartsGetChartsListHandler = charts.GetChartsListHandlerFunc(func(param charts.GetChartsListParams) middleware.Responder { + ricdms.Logger.Debug("==> GetChartList") + resp := r.rh.GetCharts() + return resp + }) + + api.ChartsDownloadHelmChartHandler = charts.DownloadHelmChartHandlerFunc(func(param charts.DownloadHelmChartParams) middleware.Responder { + ricdms.Logger.Debug("==> Download helm chart") + resp := r.rh.DownloadChart(param.XAppName, param.Version) + return resp + }) + + api.ChartsGetChartHandler = charts.GetChartHandlerFunc(func(param charts.GetChartParams) middleware.Responder { + ricdms.Logger.Debug("==> Get Charts by name is invoked") + resp := r.rh.GetChartsByName(param.XAppName) + return resp + }) + r.api = api }