Serge Bazanski | cc25bdf | 2018-10-25 14:02:58 +0200 | [diff] [blame] | 1 | // Code generated by go-swagger; DO NOT EDIT. |
| 2 | |
| 3 | // Copyright 2018 The go-netbox Authors. |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | |
| 17 | package virtualization |
| 18 | |
| 19 | // This file was generated by the swagger tool. |
| 20 | // Editing this file might prove futile when you re-run the swagger generate command |
| 21 | |
| 22 | import ( |
| 23 | "net/http" |
| 24 | "time" |
| 25 | |
| 26 | "golang.org/x/net/context" |
| 27 | |
| 28 | "github.com/go-openapi/errors" |
| 29 | "github.com/go-openapi/runtime" |
| 30 | cr "github.com/go-openapi/runtime/client" |
| 31 | "github.com/go-openapi/swag" |
| 32 | |
| 33 | strfmt "github.com/go-openapi/strfmt" |
| 34 | ) |
| 35 | |
| 36 | // NewVirtualizationClustersListParams creates a new VirtualizationClustersListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewVirtualizationClustersListParams() *VirtualizationClustersListParams { |
| 39 | var () |
| 40 | return &VirtualizationClustersListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewVirtualizationClustersListParamsWithTimeout creates a new VirtualizationClustersListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewVirtualizationClustersListParamsWithTimeout(timeout time.Duration) *VirtualizationClustersListParams { |
| 49 | var () |
| 50 | return &VirtualizationClustersListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewVirtualizationClustersListParamsWithContext creates a new VirtualizationClustersListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewVirtualizationClustersListParamsWithContext(ctx context.Context) *VirtualizationClustersListParams { |
| 59 | var () |
| 60 | return &VirtualizationClustersListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewVirtualizationClustersListParamsWithHTTPClient creates a new VirtualizationClustersListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewVirtualizationClustersListParamsWithHTTPClient(client *http.Client) *VirtualizationClustersListParams { |
| 69 | var () |
| 70 | return &VirtualizationClustersListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*VirtualizationClustersListParams contains all the parameters to send to the API endpoint |
| 76 | for the virtualization clusters list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type VirtualizationClustersListParams struct { |
| 79 | |
| 80 | /*Group*/ |
| 81 | Group *string |
| 82 | /*GroupID*/ |
| 83 | GroupID *string |
| 84 | /*IDIn |
| 85 | Multiple values may be separated by commas. |
| 86 | |
| 87 | */ |
| 88 | IDIn *string |
| 89 | /*Limit |
| 90 | Number of results to return per page. |
| 91 | |
| 92 | */ |
| 93 | Limit *int64 |
| 94 | /*Name*/ |
| 95 | Name *string |
| 96 | /*Offset |
| 97 | The initial index from which to return the results. |
| 98 | |
| 99 | */ |
| 100 | Offset *int64 |
| 101 | /*Q*/ |
| 102 | Q *string |
| 103 | /*Site*/ |
| 104 | Site *string |
| 105 | /*SiteID*/ |
| 106 | SiteID *string |
| 107 | /*Type*/ |
| 108 | Type *string |
| 109 | /*TypeID*/ |
| 110 | TypeID *string |
| 111 | |
| 112 | timeout time.Duration |
| 113 | Context context.Context |
| 114 | HTTPClient *http.Client |
| 115 | } |
| 116 | |
| 117 | // WithTimeout adds the timeout to the virtualization clusters list params |
| 118 | func (o *VirtualizationClustersListParams) WithTimeout(timeout time.Duration) *VirtualizationClustersListParams { |
| 119 | o.SetTimeout(timeout) |
| 120 | return o |
| 121 | } |
| 122 | |
| 123 | // SetTimeout adds the timeout to the virtualization clusters list params |
| 124 | func (o *VirtualizationClustersListParams) SetTimeout(timeout time.Duration) { |
| 125 | o.timeout = timeout |
| 126 | } |
| 127 | |
| 128 | // WithContext adds the context to the virtualization clusters list params |
| 129 | func (o *VirtualizationClustersListParams) WithContext(ctx context.Context) *VirtualizationClustersListParams { |
| 130 | o.SetContext(ctx) |
| 131 | return o |
| 132 | } |
| 133 | |
| 134 | // SetContext adds the context to the virtualization clusters list params |
| 135 | func (o *VirtualizationClustersListParams) SetContext(ctx context.Context) { |
| 136 | o.Context = ctx |
| 137 | } |
| 138 | |
| 139 | // WithHTTPClient adds the HTTPClient to the virtualization clusters list params |
| 140 | func (o *VirtualizationClustersListParams) WithHTTPClient(client *http.Client) *VirtualizationClustersListParams { |
| 141 | o.SetHTTPClient(client) |
| 142 | return o |
| 143 | } |
| 144 | |
| 145 | // SetHTTPClient adds the HTTPClient to the virtualization clusters list params |
| 146 | func (o *VirtualizationClustersListParams) SetHTTPClient(client *http.Client) { |
| 147 | o.HTTPClient = client |
| 148 | } |
| 149 | |
| 150 | // WithGroup adds the group to the virtualization clusters list params |
| 151 | func (o *VirtualizationClustersListParams) WithGroup(group *string) *VirtualizationClustersListParams { |
| 152 | o.SetGroup(group) |
| 153 | return o |
| 154 | } |
| 155 | |
| 156 | // SetGroup adds the group to the virtualization clusters list params |
| 157 | func (o *VirtualizationClustersListParams) SetGroup(group *string) { |
| 158 | o.Group = group |
| 159 | } |
| 160 | |
| 161 | // WithGroupID adds the groupID to the virtualization clusters list params |
| 162 | func (o *VirtualizationClustersListParams) WithGroupID(groupID *string) *VirtualizationClustersListParams { |
| 163 | o.SetGroupID(groupID) |
| 164 | return o |
| 165 | } |
| 166 | |
| 167 | // SetGroupID adds the groupId to the virtualization clusters list params |
| 168 | func (o *VirtualizationClustersListParams) SetGroupID(groupID *string) { |
| 169 | o.GroupID = groupID |
| 170 | } |
| 171 | |
| 172 | // WithIDIn adds the iDIn to the virtualization clusters list params |
| 173 | func (o *VirtualizationClustersListParams) WithIDIn(iDIn *string) *VirtualizationClustersListParams { |
| 174 | o.SetIDIn(iDIn) |
| 175 | return o |
| 176 | } |
| 177 | |
| 178 | // SetIDIn adds the idIn to the virtualization clusters list params |
| 179 | func (o *VirtualizationClustersListParams) SetIDIn(iDIn *string) { |
| 180 | o.IDIn = iDIn |
| 181 | } |
| 182 | |
| 183 | // WithLimit adds the limit to the virtualization clusters list params |
| 184 | func (o *VirtualizationClustersListParams) WithLimit(limit *int64) *VirtualizationClustersListParams { |
| 185 | o.SetLimit(limit) |
| 186 | return o |
| 187 | } |
| 188 | |
| 189 | // SetLimit adds the limit to the virtualization clusters list params |
| 190 | func (o *VirtualizationClustersListParams) SetLimit(limit *int64) { |
| 191 | o.Limit = limit |
| 192 | } |
| 193 | |
| 194 | // WithName adds the name to the virtualization clusters list params |
| 195 | func (o *VirtualizationClustersListParams) WithName(name *string) *VirtualizationClustersListParams { |
| 196 | o.SetName(name) |
| 197 | return o |
| 198 | } |
| 199 | |
| 200 | // SetName adds the name to the virtualization clusters list params |
| 201 | func (o *VirtualizationClustersListParams) SetName(name *string) { |
| 202 | o.Name = name |
| 203 | } |
| 204 | |
| 205 | // WithOffset adds the offset to the virtualization clusters list params |
| 206 | func (o *VirtualizationClustersListParams) WithOffset(offset *int64) *VirtualizationClustersListParams { |
| 207 | o.SetOffset(offset) |
| 208 | return o |
| 209 | } |
| 210 | |
| 211 | // SetOffset adds the offset to the virtualization clusters list params |
| 212 | func (o *VirtualizationClustersListParams) SetOffset(offset *int64) { |
| 213 | o.Offset = offset |
| 214 | } |
| 215 | |
| 216 | // WithQ adds the q to the virtualization clusters list params |
| 217 | func (o *VirtualizationClustersListParams) WithQ(q *string) *VirtualizationClustersListParams { |
| 218 | o.SetQ(q) |
| 219 | return o |
| 220 | } |
| 221 | |
| 222 | // SetQ adds the q to the virtualization clusters list params |
| 223 | func (o *VirtualizationClustersListParams) SetQ(q *string) { |
| 224 | o.Q = q |
| 225 | } |
| 226 | |
| 227 | // WithSite adds the site to the virtualization clusters list params |
| 228 | func (o *VirtualizationClustersListParams) WithSite(site *string) *VirtualizationClustersListParams { |
| 229 | o.SetSite(site) |
| 230 | return o |
| 231 | } |
| 232 | |
| 233 | // SetSite adds the site to the virtualization clusters list params |
| 234 | func (o *VirtualizationClustersListParams) SetSite(site *string) { |
| 235 | o.Site = site |
| 236 | } |
| 237 | |
| 238 | // WithSiteID adds the siteID to the virtualization clusters list params |
| 239 | func (o *VirtualizationClustersListParams) WithSiteID(siteID *string) *VirtualizationClustersListParams { |
| 240 | o.SetSiteID(siteID) |
| 241 | return o |
| 242 | } |
| 243 | |
| 244 | // SetSiteID adds the siteId to the virtualization clusters list params |
| 245 | func (o *VirtualizationClustersListParams) SetSiteID(siteID *string) { |
| 246 | o.SiteID = siteID |
| 247 | } |
| 248 | |
| 249 | // WithType adds the typeVar to the virtualization clusters list params |
| 250 | func (o *VirtualizationClustersListParams) WithType(typeVar *string) *VirtualizationClustersListParams { |
| 251 | o.SetType(typeVar) |
| 252 | return o |
| 253 | } |
| 254 | |
| 255 | // SetType adds the type to the virtualization clusters list params |
| 256 | func (o *VirtualizationClustersListParams) SetType(typeVar *string) { |
| 257 | o.Type = typeVar |
| 258 | } |
| 259 | |
| 260 | // WithTypeID adds the typeID to the virtualization clusters list params |
| 261 | func (o *VirtualizationClustersListParams) WithTypeID(typeID *string) *VirtualizationClustersListParams { |
| 262 | o.SetTypeID(typeID) |
| 263 | return o |
| 264 | } |
| 265 | |
| 266 | // SetTypeID adds the typeId to the virtualization clusters list params |
| 267 | func (o *VirtualizationClustersListParams) SetTypeID(typeID *string) { |
| 268 | o.TypeID = typeID |
| 269 | } |
| 270 | |
| 271 | // WriteToRequest writes these params to a swagger request |
| 272 | func (o *VirtualizationClustersListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 273 | |
| 274 | if err := r.SetTimeout(o.timeout); err != nil { |
| 275 | return err |
| 276 | } |
| 277 | var res []error |
| 278 | |
| 279 | if o.Group != nil { |
| 280 | |
| 281 | // query param group |
| 282 | var qrGroup string |
| 283 | if o.Group != nil { |
| 284 | qrGroup = *o.Group |
| 285 | } |
| 286 | qGroup := qrGroup |
| 287 | if qGroup != "" { |
| 288 | if err := r.SetQueryParam("group", qGroup); err != nil { |
| 289 | return err |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | } |
| 294 | |
| 295 | if o.GroupID != nil { |
| 296 | |
| 297 | // query param group_id |
| 298 | var qrGroupID string |
| 299 | if o.GroupID != nil { |
| 300 | qrGroupID = *o.GroupID |
| 301 | } |
| 302 | qGroupID := qrGroupID |
| 303 | if qGroupID != "" { |
| 304 | if err := r.SetQueryParam("group_id", qGroupID); err != nil { |
| 305 | return err |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | } |
| 310 | |
| 311 | if o.IDIn != nil { |
| 312 | |
| 313 | // query param id__in |
| 314 | var qrIDIn string |
| 315 | if o.IDIn != nil { |
| 316 | qrIDIn = *o.IDIn |
| 317 | } |
| 318 | qIDIn := qrIDIn |
| 319 | if qIDIn != "" { |
| 320 | if err := r.SetQueryParam("id__in", qIDIn); err != nil { |
| 321 | return err |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | } |
| 326 | |
| 327 | if o.Limit != nil { |
| 328 | |
| 329 | // query param limit |
| 330 | var qrLimit int64 |
| 331 | if o.Limit != nil { |
| 332 | qrLimit = *o.Limit |
| 333 | } |
| 334 | qLimit := swag.FormatInt64(qrLimit) |
| 335 | if qLimit != "" { |
| 336 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 337 | return err |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | } |
| 342 | |
| 343 | if o.Name != nil { |
| 344 | |
| 345 | // query param name |
| 346 | var qrName string |
| 347 | if o.Name != nil { |
| 348 | qrName = *o.Name |
| 349 | } |
| 350 | qName := qrName |
| 351 | if qName != "" { |
| 352 | if err := r.SetQueryParam("name", qName); err != nil { |
| 353 | return err |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | } |
| 358 | |
| 359 | if o.Offset != nil { |
| 360 | |
| 361 | // query param offset |
| 362 | var qrOffset int64 |
| 363 | if o.Offset != nil { |
| 364 | qrOffset = *o.Offset |
| 365 | } |
| 366 | qOffset := swag.FormatInt64(qrOffset) |
| 367 | if qOffset != "" { |
| 368 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 369 | return err |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | } |
| 374 | |
| 375 | if o.Q != nil { |
| 376 | |
| 377 | // query param q |
| 378 | var qrQ string |
| 379 | if o.Q != nil { |
| 380 | qrQ = *o.Q |
| 381 | } |
| 382 | qQ := qrQ |
| 383 | if qQ != "" { |
| 384 | if err := r.SetQueryParam("q", qQ); err != nil { |
| 385 | return err |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | } |
| 390 | |
| 391 | if o.Site != nil { |
| 392 | |
| 393 | // query param site |
| 394 | var qrSite string |
| 395 | if o.Site != nil { |
| 396 | qrSite = *o.Site |
| 397 | } |
| 398 | qSite := qrSite |
| 399 | if qSite != "" { |
| 400 | if err := r.SetQueryParam("site", qSite); err != nil { |
| 401 | return err |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | } |
| 406 | |
| 407 | if o.SiteID != nil { |
| 408 | |
| 409 | // query param site_id |
| 410 | var qrSiteID string |
| 411 | if o.SiteID != nil { |
| 412 | qrSiteID = *o.SiteID |
| 413 | } |
| 414 | qSiteID := qrSiteID |
| 415 | if qSiteID != "" { |
| 416 | if err := r.SetQueryParam("site_id", qSiteID); err != nil { |
| 417 | return err |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | } |
| 422 | |
| 423 | if o.Type != nil { |
| 424 | |
| 425 | // query param type |
| 426 | var qrType string |
| 427 | if o.Type != nil { |
| 428 | qrType = *o.Type |
| 429 | } |
| 430 | qType := qrType |
| 431 | if qType != "" { |
| 432 | if err := r.SetQueryParam("type", qType); err != nil { |
| 433 | return err |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | } |
| 438 | |
| 439 | if o.TypeID != nil { |
| 440 | |
| 441 | // query param type_id |
| 442 | var qrTypeID string |
| 443 | if o.TypeID != nil { |
| 444 | qrTypeID = *o.TypeID |
| 445 | } |
| 446 | qTypeID := qrTypeID |
| 447 | if qTypeID != "" { |
| 448 | if err := r.SetQueryParam("type_id", qTypeID); err != nil { |
| 449 | return err |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | } |
| 454 | |
| 455 | if len(res) > 0 { |
| 456 | return errors.CompositeValidationError(res...) |
| 457 | } |
| 458 | return nil |
| 459 | } |