github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/policy/get_fqdn_cache_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 // NewGetFqdnCacheParams creates a new GetFqdnCacheParams object 19 // no default values defined in spec. 20 func NewGetFqdnCacheParams() GetFqdnCacheParams { 21 22 return GetFqdnCacheParams{} 23 } 24 25 // GetFqdnCacheParams contains all the bound params for the get fqdn cache operation 26 // typically these are obtained from a http.Request 27 // 28 // swagger:parameters GetFqdnCache 29 type GetFqdnCacheParams 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 /*A toFQDNs compatible matchPattern expression 39 In: query 40 */ 41 Matchpattern *string 42 } 43 44 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 45 // for simple values it will use straight method calls. 46 // 47 // To ensure default values, the struct must have been initialized with NewGetFqdnCacheParams() beforehand. 48 func (o *GetFqdnCacheParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 49 var res []error 50 51 o.HTTPRequest = r 52 53 qs := runtime.Values(r.URL.Query()) 54 55 qCidr, qhkCidr, _ := qs.GetOK("cidr") 56 if err := o.bindCidr(qCidr, qhkCidr, route.Formats); err != nil { 57 res = append(res, err) 58 } 59 60 qMatchpattern, qhkMatchpattern, _ := qs.GetOK("matchpattern") 61 if err := o.bindMatchpattern(qMatchpattern, qhkMatchpattern, route.Formats); err != nil { 62 res = append(res, err) 63 } 64 65 if len(res) > 0 { 66 return errors.CompositeValidationError(res...) 67 } 68 return nil 69 } 70 71 // bindCidr binds and validates parameter Cidr from query. 72 func (o *GetFqdnCacheParams) bindCidr(rawData []string, hasKey bool, formats strfmt.Registry) error { 73 var raw string 74 if len(rawData) > 0 { 75 raw = rawData[len(rawData)-1] 76 } 77 78 // Required: false 79 // AllowEmptyValue: false 80 if raw == "" { // empty values pass all other validations 81 return nil 82 } 83 84 o.Cidr = &raw 85 86 return nil 87 } 88 89 // bindMatchpattern binds and validates parameter Matchpattern from query. 90 func (o *GetFqdnCacheParams) bindMatchpattern(rawData []string, hasKey bool, formats strfmt.Registry) error { 91 var raw string 92 if len(rawData) > 0 { 93 raw = rawData[len(rawData)-1] 94 } 95 96 // Required: false 97 // AllowEmptyValue: false 98 if raw == "" { // empty values pass all other validations 99 return nil 100 } 101 102 o.Matchpattern = &raw 103 104 return nil 105 }