github.com/cilium/cilium@v1.16.2/api/v1/client/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 "context" 13 "net/http" 14 "time" 15 16 "github.com/go-openapi/errors" 17 "github.com/go-openapi/runtime" 18 cr "github.com/go-openapi/runtime/client" 19 "github.com/go-openapi/strfmt" 20 ) 21 22 // NewGetFqdnCacheIDParams creates a new GetFqdnCacheIDParams object, 23 // with the default timeout for this client. 24 // 25 // Default values are not hydrated, since defaults are normally applied by the API server side. 26 // 27 // To enforce default values in parameter, use SetDefaults or WithDefaults. 28 func NewGetFqdnCacheIDParams() *GetFqdnCacheIDParams { 29 return &GetFqdnCacheIDParams{ 30 timeout: cr.DefaultTimeout, 31 } 32 } 33 34 // NewGetFqdnCacheIDParamsWithTimeout creates a new GetFqdnCacheIDParams object 35 // with the ability to set a timeout on a request. 36 func NewGetFqdnCacheIDParamsWithTimeout(timeout time.Duration) *GetFqdnCacheIDParams { 37 return &GetFqdnCacheIDParams{ 38 timeout: timeout, 39 } 40 } 41 42 // NewGetFqdnCacheIDParamsWithContext creates a new GetFqdnCacheIDParams object 43 // with the ability to set a context for a request. 44 func NewGetFqdnCacheIDParamsWithContext(ctx context.Context) *GetFqdnCacheIDParams { 45 return &GetFqdnCacheIDParams{ 46 Context: ctx, 47 } 48 } 49 50 // NewGetFqdnCacheIDParamsWithHTTPClient creates a new GetFqdnCacheIDParams object 51 // with the ability to set a custom HTTPClient for a request. 52 func NewGetFqdnCacheIDParamsWithHTTPClient(client *http.Client) *GetFqdnCacheIDParams { 53 return &GetFqdnCacheIDParams{ 54 HTTPClient: client, 55 } 56 } 57 58 /* 59 GetFqdnCacheIDParams contains all the parameters to send to the API endpoint 60 61 for the get fqdn cache ID operation. 62 63 Typically these are written to a http.Request. 64 */ 65 type GetFqdnCacheIDParams struct { 66 67 /* Cidr. 68 69 A CIDR range of IPs 70 */ 71 Cidr *string 72 73 /* ID. 74 75 String describing an endpoint with the format ``[prefix:]id``. If no prefix 76 is specified, a prefix of ``cilium-local:`` is assumed. Not all endpoints 77 will be addressable by all endpoint ID prefixes with the exception of the 78 local Cilium UUID which is assigned to all endpoints. 79 80 Supported endpoint id prefixes: 81 - cilium-local: Local Cilium endpoint UUID, e.g. cilium-local:3389595 82 - cilium-global: Global Cilium endpoint UUID, e.g. cilium-global:cluster1:nodeX:452343 83 - cni-attachment-id: CNI attachment ID, e.g. cni-attachment-id:22222:eth0 84 - container-id: Container runtime ID, e.g. container-id:22222 (deprecated, may not be unique) 85 - container-name: Container name, e.g. container-name:foobar (deprecated, may not be unique) 86 - pod-name: pod name for this container if K8s is enabled, e.g. pod-name:default:foobar (deprecated, may not be unique) 87 - cep-name: cep name for this container if K8s is enabled, e.g. pod-name:default:foobar-net1 88 - docker-endpoint: Docker libnetwork endpoint ID, e.g. docker-endpoint:4444 89 90 */ 91 ID string 92 93 /* Matchpattern. 94 95 A toFQDNs compatible matchPattern expression 96 */ 97 Matchpattern *string 98 99 /* Source. 100 101 Source from which FQDN entries come from 102 */ 103 Source *string 104 105 timeout time.Duration 106 Context context.Context 107 HTTPClient *http.Client 108 } 109 110 // WithDefaults hydrates default values in the get fqdn cache ID params (not the query body). 111 // 112 // All values with no default are reset to their zero value. 113 func (o *GetFqdnCacheIDParams) WithDefaults() *GetFqdnCacheIDParams { 114 o.SetDefaults() 115 return o 116 } 117 118 // SetDefaults hydrates default values in the get fqdn cache ID params (not the query body). 119 // 120 // All values with no default are reset to their zero value. 121 func (o *GetFqdnCacheIDParams) SetDefaults() { 122 // no default values defined for this parameter 123 } 124 125 // WithTimeout adds the timeout to the get fqdn cache ID params 126 func (o *GetFqdnCacheIDParams) WithTimeout(timeout time.Duration) *GetFqdnCacheIDParams { 127 o.SetTimeout(timeout) 128 return o 129 } 130 131 // SetTimeout adds the timeout to the get fqdn cache ID params 132 func (o *GetFqdnCacheIDParams) SetTimeout(timeout time.Duration) { 133 o.timeout = timeout 134 } 135 136 // WithContext adds the context to the get fqdn cache ID params 137 func (o *GetFqdnCacheIDParams) WithContext(ctx context.Context) *GetFqdnCacheIDParams { 138 o.SetContext(ctx) 139 return o 140 } 141 142 // SetContext adds the context to the get fqdn cache ID params 143 func (o *GetFqdnCacheIDParams) SetContext(ctx context.Context) { 144 o.Context = ctx 145 } 146 147 // WithHTTPClient adds the HTTPClient to the get fqdn cache ID params 148 func (o *GetFqdnCacheIDParams) WithHTTPClient(client *http.Client) *GetFqdnCacheIDParams { 149 o.SetHTTPClient(client) 150 return o 151 } 152 153 // SetHTTPClient adds the HTTPClient to the get fqdn cache ID params 154 func (o *GetFqdnCacheIDParams) SetHTTPClient(client *http.Client) { 155 o.HTTPClient = client 156 } 157 158 // WithCidr adds the cidr to the get fqdn cache ID params 159 func (o *GetFqdnCacheIDParams) WithCidr(cidr *string) *GetFqdnCacheIDParams { 160 o.SetCidr(cidr) 161 return o 162 } 163 164 // SetCidr adds the cidr to the get fqdn cache ID params 165 func (o *GetFqdnCacheIDParams) SetCidr(cidr *string) { 166 o.Cidr = cidr 167 } 168 169 // WithID adds the id to the get fqdn cache ID params 170 func (o *GetFqdnCacheIDParams) WithID(id string) *GetFqdnCacheIDParams { 171 o.SetID(id) 172 return o 173 } 174 175 // SetID adds the id to the get fqdn cache ID params 176 func (o *GetFqdnCacheIDParams) SetID(id string) { 177 o.ID = id 178 } 179 180 // WithMatchpattern adds the matchpattern to the get fqdn cache ID params 181 func (o *GetFqdnCacheIDParams) WithMatchpattern(matchpattern *string) *GetFqdnCacheIDParams { 182 o.SetMatchpattern(matchpattern) 183 return o 184 } 185 186 // SetMatchpattern adds the matchpattern to the get fqdn cache ID params 187 func (o *GetFqdnCacheIDParams) SetMatchpattern(matchpattern *string) { 188 o.Matchpattern = matchpattern 189 } 190 191 // WithSource adds the source to the get fqdn cache ID params 192 func (o *GetFqdnCacheIDParams) WithSource(source *string) *GetFqdnCacheIDParams { 193 o.SetSource(source) 194 return o 195 } 196 197 // SetSource adds the source to the get fqdn cache ID params 198 func (o *GetFqdnCacheIDParams) SetSource(source *string) { 199 o.Source = source 200 } 201 202 // WriteToRequest writes these params to a swagger request 203 func (o *GetFqdnCacheIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 204 205 if err := r.SetTimeout(o.timeout); err != nil { 206 return err 207 } 208 var res []error 209 210 if o.Cidr != nil { 211 212 // query param cidr 213 var qrCidr string 214 215 if o.Cidr != nil { 216 qrCidr = *o.Cidr 217 } 218 qCidr := qrCidr 219 if qCidr != "" { 220 221 if err := r.SetQueryParam("cidr", qCidr); err != nil { 222 return err 223 } 224 } 225 } 226 227 // path param id 228 if err := r.SetPathParam("id", o.ID); err != nil { 229 return err 230 } 231 232 if o.Matchpattern != nil { 233 234 // query param matchpattern 235 var qrMatchpattern string 236 237 if o.Matchpattern != nil { 238 qrMatchpattern = *o.Matchpattern 239 } 240 qMatchpattern := qrMatchpattern 241 if qMatchpattern != "" { 242 243 if err := r.SetQueryParam("matchpattern", qMatchpattern); err != nil { 244 return err 245 } 246 } 247 } 248 249 if o.Source != nil { 250 251 // query param source 252 var qrSource string 253 254 if o.Source != nil { 255 qrSource = *o.Source 256 } 257 qSource := qrSource 258 if qSource != "" { 259 260 if err := r.SetQueryParam("source", qSource); err != nil { 261 return err 262 } 263 } 264 } 265 266 if len(res) > 0 { 267 return errors.CompositeValidationError(res...) 268 } 269 return nil 270 }