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