X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Frestapi%2Foperations%2Fpolicy%2Fsubscribe_policy.go;fp=pkg%2Frestapi%2Foperations%2Fpolicy%2Fsubscribe_policy.go;h=f812cecfa865d975255f188c381a27381c17a2fd;hb=3895a8c8775ef96652e6473414fdd7366c59f404;hp=0000000000000000000000000000000000000000;hpb=5120ec103eead26427b977f4b2456c2ce57b36ac;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/restapi/operations/policy/subscribe_policy.go b/pkg/restapi/operations/policy/subscribe_policy.go new file mode 100644 index 0000000..f812cec --- /dev/null +++ b/pkg/restapi/operations/policy/subscribe_policy.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package policy + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + middleware "github.com/go-openapi/runtime/middleware" +) + +// SubscribePolicyHandlerFunc turns a function with the right signature into a subscribe policy handler +type SubscribePolicyHandlerFunc func(SubscribePolicyParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn SubscribePolicyHandlerFunc) Handle(params SubscribePolicyParams) middleware.Responder { + return fn(params) +} + +// SubscribePolicyHandler interface for that can handle valid subscribe policy params +type SubscribePolicyHandler interface { + Handle(SubscribePolicyParams) middleware.Responder +} + +// NewSubscribePolicy creates a new http.Handler for the subscribe policy operation +func NewSubscribePolicy(ctx *middleware.Context, handler SubscribePolicyHandler) *SubscribePolicy { + return &SubscribePolicy{Context: ctx, Handler: handler} +} + +/*SubscribePolicy swagger:route POST /subscriptions/policy policy subscribePolicy + +Subscribe and send "POLICY" message to RAN to execute a specific POLICY during call processing in RAN after each occurrence of a defined SUBSCRIPTION + +*/ +type SubscribePolicy struct { + Context *middleware.Context + Handler SubscribePolicyHandler +} + +func (o *SubscribePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + var Params = NewSubscribePolicyParams() + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params) // actually handle the request + + o.Context.Respond(rw, r, route.Produces, route, res) + +}