github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/policy/get_fqdn_cache_id_parameters.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 swagger generate command
     7  
     8  import (
     9  	"net/http"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/runtime"
    13  	"github.com/go-openapi/runtime/middleware"
    14  
    15  	strfmt "github.com/go-openapi/strfmt"
    16  )
    17  
    18  // NewGetFqdnCacheIDParams creates a new GetFqdnCacheIDParams object
    19  // no default values defined in spec.
    20  func NewGetFqdnCacheIDParams() GetFqdnCacheIDParams {
    21  
    22  	return GetFqdnCacheIDParams{}
    23  }
    24  
    25  // GetFqdnCacheIDParams contains all the bound params for the get fqdn cache ID operation
    26  // typically these are obtained from a http.Request
    27  //
    28  // swagger:parameters GetFqdnCacheID
    29  type GetFqdnCacheIDParams struct {
    30  
    31  	// HTTP Request Object
    32  	HTTPRequest *http.Request `json:"-"`
    33  
    34  	/*A CIDR range of IPs
    35  	  In: query
    36  	*/
    37  	Cidr *string
    38  	/*String describing an endpoint with the format ``[prefix:]id``. If no prefix
    39  	is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints
    40  	will be addressable by all endpoint ID prefixes with the exception of the
    41  	local Cilium UUID which is assigned to all endpoints.
    42  
    43  	Supported endpoint id prefixes:
    44  	  - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595
    45  	  - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343
    46  	  - container-id: Container runtime ID, e.g. container-id:22222
    47  	  - container-name: Container name, e.g. container-name:foobar
    48  	  - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar
    49  	  - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444
    50  
    51  	  Required: true
    52  	  In: path
    53  	*/
    54  	ID string
    55  	/*A toFQDNs compatible matchPattern expression
    56  	  In: query
    57  	*/
    58  	Matchpattern *string
    59  }
    60  
    61  // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
    62  // for simple values it will use straight method calls.
    63  //
    64  // To ensure default values, the struct must have been initialized with NewGetFqdnCacheIDParams() beforehand.
    65  func (o *GetFqdnCacheIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
    66  	var res []error
    67  
    68  	o.HTTPRequest = r
    69  
    70  	qs := runtime.Values(r.URL.Query())
    71  
    72  	qCidr, qhkCidr, _ := qs.GetOK("cidr")
    73  	if err := o.bindCidr(qCidr, qhkCidr, route.Formats); err != nil {
    74  		res = append(res, err)
    75  	}
    76  
    77  	rID, rhkID, _ := route.Params.GetOK("id")
    78  	if err := o.bindID(rID, rhkID, route.Formats); err != nil {
    79  		res = append(res, err)
    80  	}
    81  
    82  	qMatchpattern, qhkMatchpattern, _ := qs.GetOK("matchpattern")
    83  	if err := o.bindMatchpattern(qMatchpattern, qhkMatchpattern, route.Formats); err != nil {
    84  		res = append(res, err)
    85  	}
    86  
    87  	if len(res) > 0 {
    88  		return errors.CompositeValidationError(res...)
    89  	}
    90  	return nil
    91  }
    92  
    93  // bindCidr binds and validates parameter Cidr from query.
    94  func (o *GetFqdnCacheIDParams) bindCidr(rawData []string, hasKey bool, formats strfmt.Registry) error {
    95  	var raw string
    96  	if len(rawData) > 0 {
    97  		raw = rawData[len(rawData)-1]
    98  	}
    99  
   100  	// Required: false
   101  	// AllowEmptyValue: false
   102  	if raw == "" { // empty values pass all other validations
   103  		return nil
   104  	}
   105  
   106  	o.Cidr = &raw
   107  
   108  	return nil
   109  }
   110  
   111  // bindID binds and validates parameter ID from path.
   112  func (o *GetFqdnCacheIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
   113  	var raw string
   114  	if len(rawData) > 0 {
   115  		raw = rawData[len(rawData)-1]
   116  	}
   117  
   118  	// Required: true
   119  	// Parameter is provided by construction from the route
   120  
   121  	o.ID = raw
   122  
   123  	return nil
   124  }
   125  
   126  // bindMatchpattern binds and validates parameter Matchpattern from query.
   127  func (o *GetFqdnCacheIDParams) bindMatchpattern(rawData []string, hasKey bool, formats strfmt.Registry) error {
   128  	var raw string
   129  	if len(rawData) > 0 {
   130  		raw = rawData[len(rawData)-1]
   131  	}
   132  
   133  	// Required: false
   134  	// AllowEmptyValue: false
   135  	if raw == "" { // empty values pass all other validations
   136  		return nil
   137  	}
   138  
   139  	o.Matchpattern = &raw
   140  
   141  	return nil
   142  }