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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package policy
     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  // DeleteFqdnCacheHandlerFunc turns a function with the right signature into a delete fqdn cache handler
    15  type DeleteFqdnCacheHandlerFunc func(DeleteFqdnCacheParams) middleware.Responder
    16  
    17  // Handle executing the request and returning a response
    18  func (fn DeleteFqdnCacheHandlerFunc) Handle(params DeleteFqdnCacheParams) middleware.Responder {
    19  	return fn(params)
    20  }
    21  
    22  // DeleteFqdnCacheHandler interface for that can handle valid delete fqdn cache params
    23  type DeleteFqdnCacheHandler interface {
    24  	Handle(DeleteFqdnCacheParams) middleware.Responder
    25  }
    26  
    27  // NewDeleteFqdnCache creates a new http.Handler for the delete fqdn cache operation
    28  func NewDeleteFqdnCache(ctx *middleware.Context, handler DeleteFqdnCacheHandler) *DeleteFqdnCache {
    29  	return &DeleteFqdnCache{Context: ctx, Handler: handler}
    30  }
    31  
    32  /*DeleteFqdnCache swagger:route DELETE /fqdn/cache policy deleteFqdnCache
    33  
    34  Deletes matching DNS lookups from the policy-generation cache.
    35  
    36  Deletes matching DNS lookups from the cache, optionally restricted by
    37  DNS name. The removed IP data will no longer be used in generated
    38  policies.
    39  
    40  
    41  */
    42  type DeleteFqdnCache struct {
    43  	Context *middleware.Context
    44  	Handler DeleteFqdnCacheHandler
    45  }
    46  
    47  func (o *DeleteFqdnCache) 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 = NewDeleteFqdnCacheParams()
    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  }