github.com/kubearmor/cilium@v1.6.12/api/v1/health/server/restapi/get_healthz.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package restapi
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the generate command
     7  
     8  import (
     9  	"net/http"
    10  
    11  	middleware "github.com/go-openapi/runtime/middleware"
    12  )
    13  
    14  // GetHealthzHandlerFunc turns a function with the right signature into a get healthz handler
    15  type GetHealthzHandlerFunc func(GetHealthzParams) middleware.Responder
    16  
    17  // Handle executing the request and returning a response
    18  func (fn GetHealthzHandlerFunc) Handle(params GetHealthzParams) middleware.Responder {
    19  	return fn(params)
    20  }
    21  
    22  // GetHealthzHandler interface for that can handle valid get healthz params
    23  type GetHealthzHandler interface {
    24  	Handle(GetHealthzParams) middleware.Responder
    25  }
    26  
    27  // NewGetHealthz creates a new http.Handler for the get healthz operation
    28  func NewGetHealthz(ctx *middleware.Context, handler GetHealthzHandler) *GetHealthz {
    29  	return &GetHealthz{Context: ctx, Handler: handler}
    30  }
    31  
    32  /*GetHealthz swagger:route GET /healthz getHealthz
    33  
    34  Get health of Cilium node
    35  
    36  Returns health and status information of the local node including
    37  load and uptime, as well as the status of related components including
    38  the Cilium daemon.
    39  
    40  
    41  */
    42  type GetHealthz struct {
    43  	Context *middleware.Context
    44  	Handler GetHealthzHandler
    45  }
    46  
    47  func (o *GetHealthz) 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 = NewGetHealthzParams()
    53  
    54  	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
    55  		o.Context.Respond(rw, r, route.Produces, route, err)
    56  		return
    57  	}
    58  
    59  	res := o.Handler.Handle(Params) // actually handle the request
    60  
    61  	o.Context.Respond(rw, r, route.Produces, route, res)
    62  
    63  }