X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fresthooks%2Fresthooks.go;h=cc144d4fcef6ae212e528c92e591b3a3404b403d;hb=6e8d970e6ec582bd4473c3fbb6772906658608ca;hp=072fa1d6fcd4d3aa96d8059d2c2591e1f38cee14;hpb=04897e6ba579f0cfd11453f589fc1fb24be4e820;p=ric-plt%2Fricdms.git diff --git a/pkg/resthooks/resthooks.go b/pkg/resthooks/resthooks.go index 072fa1d..cc144d4 100644 --- a/pkg/resthooks/resthooks.go +++ b/pkg/resthooks/resthooks.go @@ -21,18 +21,21 @@ package resthooks import ( + ch "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/charts" ph "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/health" "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/models" "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/onboard" + "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/ricdms" "github.com/go-openapi/runtime/middleware" ) -func NewResthook(h ph.IHealthChecker, o onboard.IOnboarder) *Resthook { +func NewResthook(h ph.IHealthChecker, o onboard.IOnboarder, chMgr ch.IChartMgr) *Resthook { return &Resthook{ HealthChecker: h, Onboarder: o, + ChartMgr: chMgr, } } @@ -45,3 +48,13 @@ func (rh *Resthook) OnBoard(params *models.Descriptor) (resp middleware.Responde ricdms.Logger.Debug("onboarder: invoked") return rh.Onboarder.Onboard(params) } + +func (rh *Resthook) GetCharts() (resp middleware.Responder) { + ricdms.Logger.Debug("getcharts: invoked") + chartList, err := rh.ChartMgr.GetCharts() + + if err != nil { + return charts.NewGetChartsListInternalServerError() + } + return charts.NewGetChartsListOK().WithPayload(chartList) +}