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 dcim |
| 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 | // NewDcimRackReservationsListParams creates a new DcimRackReservationsListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewDcimRackReservationsListParams() *DcimRackReservationsListParams { |
| 39 | var () |
| 40 | return &DcimRackReservationsListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewDcimRackReservationsListParamsWithTimeout creates a new DcimRackReservationsListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewDcimRackReservationsListParamsWithTimeout(timeout time.Duration) *DcimRackReservationsListParams { |
| 49 | var () |
| 50 | return &DcimRackReservationsListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewDcimRackReservationsListParamsWithContext creates a new DcimRackReservationsListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewDcimRackReservationsListParamsWithContext(ctx context.Context) *DcimRackReservationsListParams { |
| 59 | var () |
| 60 | return &DcimRackReservationsListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewDcimRackReservationsListParamsWithHTTPClient creates a new DcimRackReservationsListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewDcimRackReservationsListParamsWithHTTPClient(client *http.Client) *DcimRackReservationsListParams { |
| 69 | var () |
| 70 | return &DcimRackReservationsListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*DcimRackReservationsListParams contains all the parameters to send to the API endpoint |
| 76 | for the dcim rack reservations list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type DcimRackReservationsListParams struct { |
| 79 | |
| 80 | /*Created*/ |
| 81 | Created *string |
| 82 | /*Group*/ |
| 83 | Group *string |
| 84 | /*GroupID*/ |
| 85 | GroupID *string |
| 86 | /*IDIn |
| 87 | Multiple values may be separated by commas. |
| 88 | |
| 89 | */ |
| 90 | IDIn *string |
| 91 | /*Limit |
| 92 | Number of results to return per page. |
| 93 | |
| 94 | */ |
| 95 | Limit *int64 |
| 96 | /*Offset |
| 97 | The initial index from which to return the results. |
| 98 | |
| 99 | */ |
| 100 | Offset *int64 |
| 101 | /*Q*/ |
| 102 | Q *string |
| 103 | /*RackID*/ |
| 104 | RackID *string |
| 105 | /*Site*/ |
| 106 | Site *string |
| 107 | /*SiteID*/ |
| 108 | SiteID *string |
| 109 | /*Tenant*/ |
| 110 | Tenant *string |
| 111 | /*TenantID*/ |
| 112 | TenantID *string |
| 113 | /*User*/ |
| 114 | User *string |
| 115 | /*UserID*/ |
| 116 | UserID *string |
| 117 | |
| 118 | timeout time.Duration |
| 119 | Context context.Context |
| 120 | HTTPClient *http.Client |
| 121 | } |
| 122 | |
| 123 | // WithTimeout adds the timeout to the dcim rack reservations list params |
| 124 | func (o *DcimRackReservationsListParams) WithTimeout(timeout time.Duration) *DcimRackReservationsListParams { |
| 125 | o.SetTimeout(timeout) |
| 126 | return o |
| 127 | } |
| 128 | |
| 129 | // SetTimeout adds the timeout to the dcim rack reservations list params |
| 130 | func (o *DcimRackReservationsListParams) SetTimeout(timeout time.Duration) { |
| 131 | o.timeout = timeout |
| 132 | } |
| 133 | |
| 134 | // WithContext adds the context to the dcim rack reservations list params |
| 135 | func (o *DcimRackReservationsListParams) WithContext(ctx context.Context) *DcimRackReservationsListParams { |
| 136 | o.SetContext(ctx) |
| 137 | return o |
| 138 | } |
| 139 | |
| 140 | // SetContext adds the context to the dcim rack reservations list params |
| 141 | func (o *DcimRackReservationsListParams) SetContext(ctx context.Context) { |
| 142 | o.Context = ctx |
| 143 | } |
| 144 | |
| 145 | // WithHTTPClient adds the HTTPClient to the dcim rack reservations list params |
| 146 | func (o *DcimRackReservationsListParams) WithHTTPClient(client *http.Client) *DcimRackReservationsListParams { |
| 147 | o.SetHTTPClient(client) |
| 148 | return o |
| 149 | } |
| 150 | |
| 151 | // SetHTTPClient adds the HTTPClient to the dcim rack reservations list params |
| 152 | func (o *DcimRackReservationsListParams) SetHTTPClient(client *http.Client) { |
| 153 | o.HTTPClient = client |
| 154 | } |
| 155 | |
| 156 | // WithCreated adds the created to the dcim rack reservations list params |
| 157 | func (o *DcimRackReservationsListParams) WithCreated(created *string) *DcimRackReservationsListParams { |
| 158 | o.SetCreated(created) |
| 159 | return o |
| 160 | } |
| 161 | |
| 162 | // SetCreated adds the created to the dcim rack reservations list params |
| 163 | func (o *DcimRackReservationsListParams) SetCreated(created *string) { |
| 164 | o.Created = created |
| 165 | } |
| 166 | |
| 167 | // WithGroup adds the group to the dcim rack reservations list params |
| 168 | func (o *DcimRackReservationsListParams) WithGroup(group *string) *DcimRackReservationsListParams { |
| 169 | o.SetGroup(group) |
| 170 | return o |
| 171 | } |
| 172 | |
| 173 | // SetGroup adds the group to the dcim rack reservations list params |
| 174 | func (o *DcimRackReservationsListParams) SetGroup(group *string) { |
| 175 | o.Group = group |
| 176 | } |
| 177 | |
| 178 | // WithGroupID adds the groupID to the dcim rack reservations list params |
| 179 | func (o *DcimRackReservationsListParams) WithGroupID(groupID *string) *DcimRackReservationsListParams { |
| 180 | o.SetGroupID(groupID) |
| 181 | return o |
| 182 | } |
| 183 | |
| 184 | // SetGroupID adds the groupId to the dcim rack reservations list params |
| 185 | func (o *DcimRackReservationsListParams) SetGroupID(groupID *string) { |
| 186 | o.GroupID = groupID |
| 187 | } |
| 188 | |
| 189 | // WithIDIn adds the iDIn to the dcim rack reservations list params |
| 190 | func (o *DcimRackReservationsListParams) WithIDIn(iDIn *string) *DcimRackReservationsListParams { |
| 191 | o.SetIDIn(iDIn) |
| 192 | return o |
| 193 | } |
| 194 | |
| 195 | // SetIDIn adds the idIn to the dcim rack reservations list params |
| 196 | func (o *DcimRackReservationsListParams) SetIDIn(iDIn *string) { |
| 197 | o.IDIn = iDIn |
| 198 | } |
| 199 | |
| 200 | // WithLimit adds the limit to the dcim rack reservations list params |
| 201 | func (o *DcimRackReservationsListParams) WithLimit(limit *int64) *DcimRackReservationsListParams { |
| 202 | o.SetLimit(limit) |
| 203 | return o |
| 204 | } |
| 205 | |
| 206 | // SetLimit adds the limit to the dcim rack reservations list params |
| 207 | func (o *DcimRackReservationsListParams) SetLimit(limit *int64) { |
| 208 | o.Limit = limit |
| 209 | } |
| 210 | |
| 211 | // WithOffset adds the offset to the dcim rack reservations list params |
| 212 | func (o *DcimRackReservationsListParams) WithOffset(offset *int64) *DcimRackReservationsListParams { |
| 213 | o.SetOffset(offset) |
| 214 | return o |
| 215 | } |
| 216 | |
| 217 | // SetOffset adds the offset to the dcim rack reservations list params |
| 218 | func (o *DcimRackReservationsListParams) SetOffset(offset *int64) { |
| 219 | o.Offset = offset |
| 220 | } |
| 221 | |
| 222 | // WithQ adds the q to the dcim rack reservations list params |
| 223 | func (o *DcimRackReservationsListParams) WithQ(q *string) *DcimRackReservationsListParams { |
| 224 | o.SetQ(q) |
| 225 | return o |
| 226 | } |
| 227 | |
| 228 | // SetQ adds the q to the dcim rack reservations list params |
| 229 | func (o *DcimRackReservationsListParams) SetQ(q *string) { |
| 230 | o.Q = q |
| 231 | } |
| 232 | |
| 233 | // WithRackID adds the rackID to the dcim rack reservations list params |
| 234 | func (o *DcimRackReservationsListParams) WithRackID(rackID *string) *DcimRackReservationsListParams { |
| 235 | o.SetRackID(rackID) |
| 236 | return o |
| 237 | } |
| 238 | |
| 239 | // SetRackID adds the rackId to the dcim rack reservations list params |
| 240 | func (o *DcimRackReservationsListParams) SetRackID(rackID *string) { |
| 241 | o.RackID = rackID |
| 242 | } |
| 243 | |
| 244 | // WithSite adds the site to the dcim rack reservations list params |
| 245 | func (o *DcimRackReservationsListParams) WithSite(site *string) *DcimRackReservationsListParams { |
| 246 | o.SetSite(site) |
| 247 | return o |
| 248 | } |
| 249 | |
| 250 | // SetSite adds the site to the dcim rack reservations list params |
| 251 | func (o *DcimRackReservationsListParams) SetSite(site *string) { |
| 252 | o.Site = site |
| 253 | } |
| 254 | |
| 255 | // WithSiteID adds the siteID to the dcim rack reservations list params |
| 256 | func (o *DcimRackReservationsListParams) WithSiteID(siteID *string) *DcimRackReservationsListParams { |
| 257 | o.SetSiteID(siteID) |
| 258 | return o |
| 259 | } |
| 260 | |
| 261 | // SetSiteID adds the siteId to the dcim rack reservations list params |
| 262 | func (o *DcimRackReservationsListParams) SetSiteID(siteID *string) { |
| 263 | o.SiteID = siteID |
| 264 | } |
| 265 | |
| 266 | // WithTenant adds the tenant to the dcim rack reservations list params |
| 267 | func (o *DcimRackReservationsListParams) WithTenant(tenant *string) *DcimRackReservationsListParams { |
| 268 | o.SetTenant(tenant) |
| 269 | return o |
| 270 | } |
| 271 | |
| 272 | // SetTenant adds the tenant to the dcim rack reservations list params |
| 273 | func (o *DcimRackReservationsListParams) SetTenant(tenant *string) { |
| 274 | o.Tenant = tenant |
| 275 | } |
| 276 | |
| 277 | // WithTenantID adds the tenantID to the dcim rack reservations list params |
| 278 | func (o *DcimRackReservationsListParams) WithTenantID(tenantID *string) *DcimRackReservationsListParams { |
| 279 | o.SetTenantID(tenantID) |
| 280 | return o |
| 281 | } |
| 282 | |
| 283 | // SetTenantID adds the tenantId to the dcim rack reservations list params |
| 284 | func (o *DcimRackReservationsListParams) SetTenantID(tenantID *string) { |
| 285 | o.TenantID = tenantID |
| 286 | } |
| 287 | |
| 288 | // WithUser adds the user to the dcim rack reservations list params |
| 289 | func (o *DcimRackReservationsListParams) WithUser(user *string) *DcimRackReservationsListParams { |
| 290 | o.SetUser(user) |
| 291 | return o |
| 292 | } |
| 293 | |
| 294 | // SetUser adds the user to the dcim rack reservations list params |
| 295 | func (o *DcimRackReservationsListParams) SetUser(user *string) { |
| 296 | o.User = user |
| 297 | } |
| 298 | |
| 299 | // WithUserID adds the userID to the dcim rack reservations list params |
| 300 | func (o *DcimRackReservationsListParams) WithUserID(userID *string) *DcimRackReservationsListParams { |
| 301 | o.SetUserID(userID) |
| 302 | return o |
| 303 | } |
| 304 | |
| 305 | // SetUserID adds the userId to the dcim rack reservations list params |
| 306 | func (o *DcimRackReservationsListParams) SetUserID(userID *string) { |
| 307 | o.UserID = userID |
| 308 | } |
| 309 | |
| 310 | // WriteToRequest writes these params to a swagger request |
| 311 | func (o *DcimRackReservationsListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 312 | |
| 313 | if err := r.SetTimeout(o.timeout); err != nil { |
| 314 | return err |
| 315 | } |
| 316 | var res []error |
| 317 | |
| 318 | if o.Created != nil { |
| 319 | |
| 320 | // query param created |
| 321 | var qrCreated string |
| 322 | if o.Created != nil { |
| 323 | qrCreated = *o.Created |
| 324 | } |
| 325 | qCreated := qrCreated |
| 326 | if qCreated != "" { |
| 327 | if err := r.SetQueryParam("created", qCreated); err != nil { |
| 328 | return err |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | } |
| 333 | |
| 334 | if o.Group != nil { |
| 335 | |
| 336 | // query param group |
| 337 | var qrGroup string |
| 338 | if o.Group != nil { |
| 339 | qrGroup = *o.Group |
| 340 | } |
| 341 | qGroup := qrGroup |
| 342 | if qGroup != "" { |
| 343 | if err := r.SetQueryParam("group", qGroup); err != nil { |
| 344 | return err |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | } |
| 349 | |
| 350 | if o.GroupID != nil { |
| 351 | |
| 352 | // query param group_id |
| 353 | var qrGroupID string |
| 354 | if o.GroupID != nil { |
| 355 | qrGroupID = *o.GroupID |
| 356 | } |
| 357 | qGroupID := qrGroupID |
| 358 | if qGroupID != "" { |
| 359 | if err := r.SetQueryParam("group_id", qGroupID); err != nil { |
| 360 | return err |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | } |
| 365 | |
| 366 | if o.IDIn != nil { |
| 367 | |
| 368 | // query param id__in |
| 369 | var qrIDIn string |
| 370 | if o.IDIn != nil { |
| 371 | qrIDIn = *o.IDIn |
| 372 | } |
| 373 | qIDIn := qrIDIn |
| 374 | if qIDIn != "" { |
| 375 | if err := r.SetQueryParam("id__in", qIDIn); err != nil { |
| 376 | return err |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | } |
| 381 | |
| 382 | if o.Limit != nil { |
| 383 | |
| 384 | // query param limit |
| 385 | var qrLimit int64 |
| 386 | if o.Limit != nil { |
| 387 | qrLimit = *o.Limit |
| 388 | } |
| 389 | qLimit := swag.FormatInt64(qrLimit) |
| 390 | if qLimit != "" { |
| 391 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 392 | return err |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | } |
| 397 | |
| 398 | if o.Offset != nil { |
| 399 | |
| 400 | // query param offset |
| 401 | var qrOffset int64 |
| 402 | if o.Offset != nil { |
| 403 | qrOffset = *o.Offset |
| 404 | } |
| 405 | qOffset := swag.FormatInt64(qrOffset) |
| 406 | if qOffset != "" { |
| 407 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 408 | return err |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | } |
| 413 | |
| 414 | if o.Q != nil { |
| 415 | |
| 416 | // query param q |
| 417 | var qrQ string |
| 418 | if o.Q != nil { |
| 419 | qrQ = *o.Q |
| 420 | } |
| 421 | qQ := qrQ |
| 422 | if qQ != "" { |
| 423 | if err := r.SetQueryParam("q", qQ); err != nil { |
| 424 | return err |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | } |
| 429 | |
| 430 | if o.RackID != nil { |
| 431 | |
| 432 | // query param rack_id |
| 433 | var qrRackID string |
| 434 | if o.RackID != nil { |
| 435 | qrRackID = *o.RackID |
| 436 | } |
| 437 | qRackID := qrRackID |
| 438 | if qRackID != "" { |
| 439 | if err := r.SetQueryParam("rack_id", qRackID); err != nil { |
| 440 | return err |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | } |
| 445 | |
| 446 | if o.Site != nil { |
| 447 | |
| 448 | // query param site |
| 449 | var qrSite string |
| 450 | if o.Site != nil { |
| 451 | qrSite = *o.Site |
| 452 | } |
| 453 | qSite := qrSite |
| 454 | if qSite != "" { |
| 455 | if err := r.SetQueryParam("site", qSite); err != nil { |
| 456 | return err |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | } |
| 461 | |
| 462 | if o.SiteID != nil { |
| 463 | |
| 464 | // query param site_id |
| 465 | var qrSiteID string |
| 466 | if o.SiteID != nil { |
| 467 | qrSiteID = *o.SiteID |
| 468 | } |
| 469 | qSiteID := qrSiteID |
| 470 | if qSiteID != "" { |
| 471 | if err := r.SetQueryParam("site_id", qSiteID); err != nil { |
| 472 | return err |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | } |
| 477 | |
| 478 | if o.Tenant != nil { |
| 479 | |
| 480 | // query param tenant |
| 481 | var qrTenant string |
| 482 | if o.Tenant != nil { |
| 483 | qrTenant = *o.Tenant |
| 484 | } |
| 485 | qTenant := qrTenant |
| 486 | if qTenant != "" { |
| 487 | if err := r.SetQueryParam("tenant", qTenant); err != nil { |
| 488 | return err |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | } |
| 493 | |
| 494 | if o.TenantID != nil { |
| 495 | |
| 496 | // query param tenant_id |
| 497 | var qrTenantID string |
| 498 | if o.TenantID != nil { |
| 499 | qrTenantID = *o.TenantID |
| 500 | } |
| 501 | qTenantID := qrTenantID |
| 502 | if qTenantID != "" { |
| 503 | if err := r.SetQueryParam("tenant_id", qTenantID); err != nil { |
| 504 | return err |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | } |
| 509 | |
| 510 | if o.User != nil { |
| 511 | |
| 512 | // query param user |
| 513 | var qrUser string |
| 514 | if o.User != nil { |
| 515 | qrUser = *o.User |
| 516 | } |
| 517 | qUser := qrUser |
| 518 | if qUser != "" { |
| 519 | if err := r.SetQueryParam("user", qUser); err != nil { |
| 520 | return err |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | } |
| 525 | |
| 526 | if o.UserID != nil { |
| 527 | |
| 528 | // query param user_id |
| 529 | var qrUserID string |
| 530 | if o.UserID != nil { |
| 531 | qrUserID = *o.UserID |
| 532 | } |
| 533 | qUserID := qrUserID |
| 534 | if qUserID != "" { |
| 535 | if err := r.SetQueryParam("user_id", qUserID); err != nil { |
| 536 | return err |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | } |
| 541 | |
| 542 | if len(res) > 0 { |
| 543 | return errors.CompositeValidationError(res...) |
| 544 | } |
| 545 | return nil |
| 546 | } |