X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Frestapi%2Foperations%2Fxapp_framework_api.go;h=c2ef01b983e427bc28a85fadf4ee05cae8ff8c00;hb=refs%2Fchanges%2F89%2F5689%2F4;hp=5c85580b5327d56e3bc3804f0848e3b3704f357d;hpb=9568a2d73b96516b27f54650e309f0d157fb97d9;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/restapi/operations/xapp_framework_api.go b/pkg/restapi/operations/xapp_framework_api.go index 5c85580..c2ef01b 100644 --- a/pkg/restapi/operations/xapp_framework_api.go +++ b/pkg/restapi/operations/xapp_framework_api.go @@ -20,10 +20,10 @@ import ( "github.com/go-openapi/swag" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/common" - "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/control" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/policy" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/query" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/report" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/xapp" ) // NewXappFrameworkAPI creates a new XappFramework instance @@ -43,14 +43,15 @@ func NewXappFrameworkAPI(spec *loads.Document) *XappFrameworkAPI { BearerAuthenticator: security.BearerAuth, JSONConsumer: runtime.JSONConsumer(), JSONProducer: runtime.JSONProducer(), + XMLProducer: runtime.XMLProducer(), CommonUnsubscribeHandler: common.UnsubscribeHandlerFunc(func(params common.UnsubscribeParams) middleware.Responder { return middleware.NotImplemented("operation CommonUnsubscribe has not yet been implemented") }), QueryGetAllSubscriptionsHandler: query.GetAllSubscriptionsHandlerFunc(func(params query.GetAllSubscriptionsParams) middleware.Responder { return middleware.NotImplemented("operation QueryGetAllSubscriptions has not yet been implemented") }), - ControlSubscribeControlHandler: control.SubscribeControlHandlerFunc(func(params control.SubscribeControlParams) middleware.Responder { - return middleware.NotImplemented("operation ControlSubscribeControl has not yet been implemented") + XappGetXappConfigListHandler: xapp.GetXappConfigListHandlerFunc(func(params xapp.GetXappConfigListParams) middleware.Responder { + return middleware.NotImplemented("operation XappGetXappConfigList has not yet been implemented") }), PolicySubscribePolicyHandler: policy.SubscribePolicyHandlerFunc(func(params policy.SubscribePolicyParams) middleware.Responder { return middleware.NotImplemented("operation PolicySubscribePolicy has not yet been implemented") @@ -88,13 +89,15 @@ type XappFrameworkAPI struct { // JSONProducer registers a producer for a "application/json" mime type JSONProducer runtime.Producer + // XMLProducer registers a producer for a "application/xml" mime type + XMLProducer runtime.Producer // CommonUnsubscribeHandler sets the operation handler for the unsubscribe operation CommonUnsubscribeHandler common.UnsubscribeHandler // QueryGetAllSubscriptionsHandler sets the operation handler for the get all subscriptions operation QueryGetAllSubscriptionsHandler query.GetAllSubscriptionsHandler - // ControlSubscribeControlHandler sets the operation handler for the subscribe control operation - ControlSubscribeControlHandler control.SubscribeControlHandler + // XappGetXappConfigListHandler sets the operation handler for the get xapp config list operation + XappGetXappConfigListHandler xapp.GetXappConfigListHandler // PolicySubscribePolicyHandler sets the operation handler for the subscribe policy operation PolicySubscribePolicyHandler policy.SubscribePolicyHandler // ReportSubscribeReportHandler sets the operation handler for the subscribe report operation @@ -162,6 +165,10 @@ func (o *XappFrameworkAPI) Validate() error { unregistered = append(unregistered, "JSONProducer") } + if o.XMLProducer == nil { + unregistered = append(unregistered, "XMLProducer") + } + if o.CommonUnsubscribeHandler == nil { unregistered = append(unregistered, "common.UnsubscribeHandler") } @@ -170,8 +177,8 @@ func (o *XappFrameworkAPI) Validate() error { unregistered = append(unregistered, "query.GetAllSubscriptionsHandler") } - if o.ControlSubscribeControlHandler == nil { - unregistered = append(unregistered, "control.SubscribeControlHandler") + if o.XappGetXappConfigListHandler == nil { + unregistered = append(unregistered, "xapp.GetXappConfigListHandler") } if o.PolicySubscribePolicyHandler == nil { @@ -238,6 +245,9 @@ func (o *XappFrameworkAPI) ProducersFor(mediaTypes []string) map[string]runtime. case "application/json": result["application/json"] = o.JSONProducer + case "application/xml": + result["application/xml"] = o.XMLProducer + } if p, ok := o.customProducers[mt]; ok { @@ -290,10 +300,10 @@ func (o *XappFrameworkAPI) initHandlerCache() { } o.handlers["GET"]["/subscriptions"] = query.NewGetAllSubscriptions(o.context, o.QueryGetAllSubscriptionsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["POST"]["/subscriptions/control"] = control.NewSubscribeControl(o.context, o.ControlSubscribeControlHandler) + o.handlers["GET"]["/config"] = xapp.NewGetXappConfigList(o.context, o.XappGetXappConfigListHandler) if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler)