github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/bgp/get_bgp_route_policies.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright Authors of Cilium
     4  // SPDX-License-Identifier: Apache-2.0
     5  
     6  package bgp
     7  
     8  // This file was generated by the swagger tool.
     9  // Editing this file might prove futile when you re-run the generate command
    10  
    11  import (
    12  	"net/http"
    13  
    14  	"github.com/go-openapi/runtime/middleware"
    15  )
    16  
    17  // GetBgpRoutePoliciesHandlerFunc turns a function with the right signature into a get bgp route policies handler
    18  type GetBgpRoutePoliciesHandlerFunc func(GetBgpRoutePoliciesParams) middleware.Responder
    19  
    20  // Handle executing the request and returning a response
    21  func (fn GetBgpRoutePoliciesHandlerFunc) Handle(params GetBgpRoutePoliciesParams) middleware.Responder {
    22  	return fn(params)
    23  }
    24  
    25  // GetBgpRoutePoliciesHandler interface for that can handle valid get bgp route policies params
    26  type GetBgpRoutePoliciesHandler interface {
    27  	Handle(GetBgpRoutePoliciesParams) middleware.Responder
    28  }
    29  
    30  // NewGetBgpRoutePolicies creates a new http.Handler for the get bgp route policies operation
    31  func NewGetBgpRoutePolicies(ctx *middleware.Context, handler GetBgpRoutePoliciesHandler) *GetBgpRoutePolicies {
    32  	return &GetBgpRoutePolicies{Context: ctx, Handler: handler}
    33  }
    34  
    35  /*
    36  	GetBgpRoutePolicies swagger:route GET /bgp/route-policies bgp getBgpRoutePolicies
    37  
    38  Lists BGP route policies configured in BGP Control Plane.
    39  
    40  Retrieves route policies from BGP Control Plane.
    41  */
    42  type GetBgpRoutePolicies struct {
    43  	Context *middleware.Context
    44  	Handler GetBgpRoutePoliciesHandler
    45  }
    46  
    47  func (o *GetBgpRoutePolicies) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
    48  	route, rCtx, _ := o.Context.RouteInfo(r)
    49  	if rCtx != nil {
    50  		*r = *rCtx
    51  	}
    52  	var Params = NewGetBgpRoutePoliciesParams()
    53  	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
    54  		o.Context.Respond(rw, r, route.Produces, route, err)
    55  		return
    56  	}
    57  
    58  	res := o.Handler.Handle(Params) // actually handle the request
    59  	o.Context.Respond(rw, r, route.Produces, route, res)
    60  
    61  }