X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Frestapi%2Foperations%2Fcommon%2Funsubscribe.go;fp=pkg%2Frestapi%2Foperations%2Fcommon%2Funsubscribe.go;h=84dac8665f3df58d8e89d340bd1b9af7b2c9d3e6;hb=3895a8c8775ef96652e6473414fdd7366c59f404;hp=0000000000000000000000000000000000000000;hpb=5120ec103eead26427b977f4b2456c2ce57b36ac;p=ric-plt%2Fxapp-frame.git diff --git a/pkg/restapi/operations/common/unsubscribe.go b/pkg/restapi/operations/common/unsubscribe.go new file mode 100644 index 0000000..84dac86 --- /dev/null +++ b/pkg/restapi/operations/common/unsubscribe.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package common + +// 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" +) + +// UnsubscribeHandlerFunc turns a function with the right signature into a unsubscribe handler +type UnsubscribeHandlerFunc func(UnsubscribeParams) middleware.Responder + +// Handle executing the request and returning a response +func (fn UnsubscribeHandlerFunc) Handle(params UnsubscribeParams) middleware.Responder { + return fn(params) +} + +// UnsubscribeHandler interface for that can handle valid unsubscribe params +type UnsubscribeHandler interface { + Handle(UnsubscribeParams) middleware.Responder +} + +// NewUnsubscribe creates a new http.Handler for the unsubscribe operation +func NewUnsubscribe(ctx *middleware.Context, handler UnsubscribeHandler) *Unsubscribe { + return &Unsubscribe{Context: ctx, Handler: handler} +} + +/*Unsubscribe swagger:route DELETE /subscriptions/{subscriptionId} common unsubscribe + +Unsubscribe X2AP events from Subscription Manager + +*/ +type Unsubscribe struct { + Context *middleware.Context + Handler UnsubscribeHandler +} + +func (o *Unsubscribe) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + var Params = NewUnsubscribeParams() + + 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) + +}