github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/policy/get_fqdn_cache.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 policy
     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  // GetFqdnCacheHandlerFunc turns a function with the right signature into a get fqdn cache handler
    18  type GetFqdnCacheHandlerFunc func(GetFqdnCacheParams) middleware.Responder
    19  
    20  // Handle executing the request and returning a response
    21  func (fn GetFqdnCacheHandlerFunc) Handle(params GetFqdnCacheParams) middleware.Responder {
    22  	return fn(params)
    23  }
    24  
    25  // GetFqdnCacheHandler interface for that can handle valid get fqdn cache params
    26  type GetFqdnCacheHandler interface {
    27  	Handle(GetFqdnCacheParams) middleware.Responder
    28  }
    29  
    30  // NewGetFqdnCache creates a new http.Handler for the get fqdn cache operation
    31  func NewGetFqdnCache(ctx *middleware.Context, handler GetFqdnCacheHandler) *GetFqdnCache {
    32  	return &GetFqdnCache{Context: ctx, Handler: handler}
    33  }
    34  
    35  /*
    36  	GetFqdnCache swagger:route GET /fqdn/cache policy getFqdnCache
    37  
    38  Retrieves the list of DNS lookups intercepted from all endpoints.
    39  
    40  Retrieves the list of DNS lookups intercepted from endpoints,
    41  optionally filtered by DNS name, CIDR IP range or source.
    42  */
    43  type GetFqdnCache struct {
    44  	Context *middleware.Context
    45  	Handler GetFqdnCacheHandler
    46  }
    47  
    48  func (o *GetFqdnCache) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
    49  	route, rCtx, _ := o.Context.RouteInfo(r)
    50  	if rCtx != nil {
    51  		*r = *rCtx
    52  	}
    53  	var Params = NewGetFqdnCacheParams()
    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  	o.Context.Respond(rw, r, route.Produces, route, res)
    61  
    62  }