github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/policy/delete_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  // DeleteFqdnCacheHandlerFunc turns a function with the right signature into a delete fqdn cache handler
    18  type DeleteFqdnCacheHandlerFunc func(DeleteFqdnCacheParams) middleware.Responder
    19  
    20  // Handle executing the request and returning a response
    21  func (fn DeleteFqdnCacheHandlerFunc) Handle(params DeleteFqdnCacheParams) middleware.Responder {
    22  	return fn(params)
    23  }
    24  
    25  // DeleteFqdnCacheHandler interface for that can handle valid delete fqdn cache params
    26  type DeleteFqdnCacheHandler interface {
    27  	Handle(DeleteFqdnCacheParams) middleware.Responder
    28  }
    29  
    30  // NewDeleteFqdnCache creates a new http.Handler for the delete fqdn cache operation
    31  func NewDeleteFqdnCache(ctx *middleware.Context, handler DeleteFqdnCacheHandler) *DeleteFqdnCache {
    32  	return &DeleteFqdnCache{Context: ctx, Handler: handler}
    33  }
    34  
    35  /*
    36  	DeleteFqdnCache swagger:route DELETE /fqdn/cache policy deleteFqdnCache
    37  
    38  Deletes matching DNS lookups from the policy-generation cache.
    39  
    40  Deletes matching DNS lookups from the cache, optionally restricted by
    41  DNS name. The removed IP data will no longer be used in generated
    42  policies.
    43  */
    44  type DeleteFqdnCache struct {
    45  	Context *middleware.Context
    46  	Handler DeleteFqdnCacheHandler
    47  }
    48  
    49  func (o *DeleteFqdnCache) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
    50  	route, rCtx, _ := o.Context.RouteInfo(r)
    51  	if rCtx != nil {
    52  		*r = *rCtx
    53  	}
    54  	var Params = NewDeleteFqdnCacheParams()
    55  	if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
    56  		o.Context.Respond(rw, r, route.Produces, route, err)
    57  		return
    58  	}
    59  
    60  	res := o.Handler.Handle(Params) // actually handle the request
    61  	o.Context.Respond(rw, r, route.Produces, route, res)
    62  
    63  }