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 | // NewDcimSitesListParams creates a new DcimSitesListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewDcimSitesListParams() *DcimSitesListParams { |
| 39 | var () |
| 40 | return &DcimSitesListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewDcimSitesListParamsWithTimeout creates a new DcimSitesListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewDcimSitesListParamsWithTimeout(timeout time.Duration) *DcimSitesListParams { |
| 49 | var () |
| 50 | return &DcimSitesListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewDcimSitesListParamsWithContext creates a new DcimSitesListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewDcimSitesListParamsWithContext(ctx context.Context) *DcimSitesListParams { |
| 59 | var () |
| 60 | return &DcimSitesListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewDcimSitesListParamsWithHTTPClient creates a new DcimSitesListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewDcimSitesListParamsWithHTTPClient(client *http.Client) *DcimSitesListParams { |
| 69 | var () |
| 70 | return &DcimSitesListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*DcimSitesListParams contains all the parameters to send to the API endpoint |
| 76 | for the dcim sites list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type DcimSitesListParams struct { |
| 79 | |
| 80 | /*Asn*/ |
| 81 | Asn *float64 |
| 82 | /*ContactEmail*/ |
| 83 | ContactEmail *string |
| 84 | /*ContactName*/ |
| 85 | ContactName *string |
| 86 | /*ContactPhone*/ |
| 87 | ContactPhone *string |
| 88 | /*Facility*/ |
| 89 | Facility *string |
| 90 | /*IDIn |
| 91 | Multiple values may be separated by commas. |
| 92 | |
| 93 | */ |
| 94 | IDIn *string |
| 95 | /*Limit |
| 96 | Number of results to return per page. |
| 97 | |
| 98 | */ |
| 99 | Limit *int64 |
| 100 | /*Name*/ |
| 101 | Name *string |
| 102 | /*Offset |
| 103 | The initial index from which to return the results. |
| 104 | |
| 105 | */ |
| 106 | Offset *int64 |
| 107 | /*Q*/ |
| 108 | Q *string |
| 109 | /*Region*/ |
| 110 | Region *string |
| 111 | /*RegionID*/ |
| 112 | RegionID *string |
| 113 | /*Slug*/ |
| 114 | Slug *string |
| 115 | /*Status*/ |
| 116 | Status *string |
| 117 | /*Tenant*/ |
| 118 | Tenant *string |
| 119 | /*TenantID*/ |
| 120 | TenantID *string |
| 121 | |
| 122 | timeout time.Duration |
| 123 | Context context.Context |
| 124 | HTTPClient *http.Client |
| 125 | } |
| 126 | |
| 127 | // WithTimeout adds the timeout to the dcim sites list params |
| 128 | func (o *DcimSitesListParams) WithTimeout(timeout time.Duration) *DcimSitesListParams { |
| 129 | o.SetTimeout(timeout) |
| 130 | return o |
| 131 | } |
| 132 | |
| 133 | // SetTimeout adds the timeout to the dcim sites list params |
| 134 | func (o *DcimSitesListParams) SetTimeout(timeout time.Duration) { |
| 135 | o.timeout = timeout |
| 136 | } |
| 137 | |
| 138 | // WithContext adds the context to the dcim sites list params |
| 139 | func (o *DcimSitesListParams) WithContext(ctx context.Context) *DcimSitesListParams { |
| 140 | o.SetContext(ctx) |
| 141 | return o |
| 142 | } |
| 143 | |
| 144 | // SetContext adds the context to the dcim sites list params |
| 145 | func (o *DcimSitesListParams) SetContext(ctx context.Context) { |
| 146 | o.Context = ctx |
| 147 | } |
| 148 | |
| 149 | // WithHTTPClient adds the HTTPClient to the dcim sites list params |
| 150 | func (o *DcimSitesListParams) WithHTTPClient(client *http.Client) *DcimSitesListParams { |
| 151 | o.SetHTTPClient(client) |
| 152 | return o |
| 153 | } |
| 154 | |
| 155 | // SetHTTPClient adds the HTTPClient to the dcim sites list params |
| 156 | func (o *DcimSitesListParams) SetHTTPClient(client *http.Client) { |
| 157 | o.HTTPClient = client |
| 158 | } |
| 159 | |
| 160 | // WithAsn adds the asn to the dcim sites list params |
| 161 | func (o *DcimSitesListParams) WithAsn(asn *float64) *DcimSitesListParams { |
| 162 | o.SetAsn(asn) |
| 163 | return o |
| 164 | } |
| 165 | |
| 166 | // SetAsn adds the asn to the dcim sites list params |
| 167 | func (o *DcimSitesListParams) SetAsn(asn *float64) { |
| 168 | o.Asn = asn |
| 169 | } |
| 170 | |
| 171 | // WithContactEmail adds the contactEmail to the dcim sites list params |
| 172 | func (o *DcimSitesListParams) WithContactEmail(contactEmail *string) *DcimSitesListParams { |
| 173 | o.SetContactEmail(contactEmail) |
| 174 | return o |
| 175 | } |
| 176 | |
| 177 | // SetContactEmail adds the contactEmail to the dcim sites list params |
| 178 | func (o *DcimSitesListParams) SetContactEmail(contactEmail *string) { |
| 179 | o.ContactEmail = contactEmail |
| 180 | } |
| 181 | |
| 182 | // WithContactName adds the contactName to the dcim sites list params |
| 183 | func (o *DcimSitesListParams) WithContactName(contactName *string) *DcimSitesListParams { |
| 184 | o.SetContactName(contactName) |
| 185 | return o |
| 186 | } |
| 187 | |
| 188 | // SetContactName adds the contactName to the dcim sites list params |
| 189 | func (o *DcimSitesListParams) SetContactName(contactName *string) { |
| 190 | o.ContactName = contactName |
| 191 | } |
| 192 | |
| 193 | // WithContactPhone adds the contactPhone to the dcim sites list params |
| 194 | func (o *DcimSitesListParams) WithContactPhone(contactPhone *string) *DcimSitesListParams { |
| 195 | o.SetContactPhone(contactPhone) |
| 196 | return o |
| 197 | } |
| 198 | |
| 199 | // SetContactPhone adds the contactPhone to the dcim sites list params |
| 200 | func (o *DcimSitesListParams) SetContactPhone(contactPhone *string) { |
| 201 | o.ContactPhone = contactPhone |
| 202 | } |
| 203 | |
| 204 | // WithFacility adds the facility to the dcim sites list params |
| 205 | func (o *DcimSitesListParams) WithFacility(facility *string) *DcimSitesListParams { |
| 206 | o.SetFacility(facility) |
| 207 | return o |
| 208 | } |
| 209 | |
| 210 | // SetFacility adds the facility to the dcim sites list params |
| 211 | func (o *DcimSitesListParams) SetFacility(facility *string) { |
| 212 | o.Facility = facility |
| 213 | } |
| 214 | |
| 215 | // WithIDIn adds the iDIn to the dcim sites list params |
| 216 | func (o *DcimSitesListParams) WithIDIn(iDIn *string) *DcimSitesListParams { |
| 217 | o.SetIDIn(iDIn) |
| 218 | return o |
| 219 | } |
| 220 | |
| 221 | // SetIDIn adds the idIn to the dcim sites list params |
| 222 | func (o *DcimSitesListParams) SetIDIn(iDIn *string) { |
| 223 | o.IDIn = iDIn |
| 224 | } |
| 225 | |
| 226 | // WithLimit adds the limit to the dcim sites list params |
| 227 | func (o *DcimSitesListParams) WithLimit(limit *int64) *DcimSitesListParams { |
| 228 | o.SetLimit(limit) |
| 229 | return o |
| 230 | } |
| 231 | |
| 232 | // SetLimit adds the limit to the dcim sites list params |
| 233 | func (o *DcimSitesListParams) SetLimit(limit *int64) { |
| 234 | o.Limit = limit |
| 235 | } |
| 236 | |
| 237 | // WithName adds the name to the dcim sites list params |
| 238 | func (o *DcimSitesListParams) WithName(name *string) *DcimSitesListParams { |
| 239 | o.SetName(name) |
| 240 | return o |
| 241 | } |
| 242 | |
| 243 | // SetName adds the name to the dcim sites list params |
| 244 | func (o *DcimSitesListParams) SetName(name *string) { |
| 245 | o.Name = name |
| 246 | } |
| 247 | |
| 248 | // WithOffset adds the offset to the dcim sites list params |
| 249 | func (o *DcimSitesListParams) WithOffset(offset *int64) *DcimSitesListParams { |
| 250 | o.SetOffset(offset) |
| 251 | return o |
| 252 | } |
| 253 | |
| 254 | // SetOffset adds the offset to the dcim sites list params |
| 255 | func (o *DcimSitesListParams) SetOffset(offset *int64) { |
| 256 | o.Offset = offset |
| 257 | } |
| 258 | |
| 259 | // WithQ adds the q to the dcim sites list params |
| 260 | func (o *DcimSitesListParams) WithQ(q *string) *DcimSitesListParams { |
| 261 | o.SetQ(q) |
| 262 | return o |
| 263 | } |
| 264 | |
| 265 | // SetQ adds the q to the dcim sites list params |
| 266 | func (o *DcimSitesListParams) SetQ(q *string) { |
| 267 | o.Q = q |
| 268 | } |
| 269 | |
| 270 | // WithRegion adds the region to the dcim sites list params |
| 271 | func (o *DcimSitesListParams) WithRegion(region *string) *DcimSitesListParams { |
| 272 | o.SetRegion(region) |
| 273 | return o |
| 274 | } |
| 275 | |
| 276 | // SetRegion adds the region to the dcim sites list params |
| 277 | func (o *DcimSitesListParams) SetRegion(region *string) { |
| 278 | o.Region = region |
| 279 | } |
| 280 | |
| 281 | // WithRegionID adds the regionID to the dcim sites list params |
| 282 | func (o *DcimSitesListParams) WithRegionID(regionID *string) *DcimSitesListParams { |
| 283 | o.SetRegionID(regionID) |
| 284 | return o |
| 285 | } |
| 286 | |
| 287 | // SetRegionID adds the regionId to the dcim sites list params |
| 288 | func (o *DcimSitesListParams) SetRegionID(regionID *string) { |
| 289 | o.RegionID = regionID |
| 290 | } |
| 291 | |
| 292 | // WithSlug adds the slug to the dcim sites list params |
| 293 | func (o *DcimSitesListParams) WithSlug(slug *string) *DcimSitesListParams { |
| 294 | o.SetSlug(slug) |
| 295 | return o |
| 296 | } |
| 297 | |
| 298 | // SetSlug adds the slug to the dcim sites list params |
| 299 | func (o *DcimSitesListParams) SetSlug(slug *string) { |
| 300 | o.Slug = slug |
| 301 | } |
| 302 | |
| 303 | // WithStatus adds the status to the dcim sites list params |
| 304 | func (o *DcimSitesListParams) WithStatus(status *string) *DcimSitesListParams { |
| 305 | o.SetStatus(status) |
| 306 | return o |
| 307 | } |
| 308 | |
| 309 | // SetStatus adds the status to the dcim sites list params |
| 310 | func (o *DcimSitesListParams) SetStatus(status *string) { |
| 311 | o.Status = status |
| 312 | } |
| 313 | |
| 314 | // WithTenant adds the tenant to the dcim sites list params |
| 315 | func (o *DcimSitesListParams) WithTenant(tenant *string) *DcimSitesListParams { |
| 316 | o.SetTenant(tenant) |
| 317 | return o |
| 318 | } |
| 319 | |
| 320 | // SetTenant adds the tenant to the dcim sites list params |
| 321 | func (o *DcimSitesListParams) SetTenant(tenant *string) { |
| 322 | o.Tenant = tenant |
| 323 | } |
| 324 | |
| 325 | // WithTenantID adds the tenantID to the dcim sites list params |
| 326 | func (o *DcimSitesListParams) WithTenantID(tenantID *string) *DcimSitesListParams { |
| 327 | o.SetTenantID(tenantID) |
| 328 | return o |
| 329 | } |
| 330 | |
| 331 | // SetTenantID adds the tenantId to the dcim sites list params |
| 332 | func (o *DcimSitesListParams) SetTenantID(tenantID *string) { |
| 333 | o.TenantID = tenantID |
| 334 | } |
| 335 | |
| 336 | // WriteToRequest writes these params to a swagger request |
| 337 | func (o *DcimSitesListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 338 | |
| 339 | if err := r.SetTimeout(o.timeout); err != nil { |
| 340 | return err |
| 341 | } |
| 342 | var res []error |
| 343 | |
| 344 | if o.Asn != nil { |
| 345 | |
| 346 | // query param asn |
| 347 | var qrAsn float64 |
| 348 | if o.Asn != nil { |
| 349 | qrAsn = *o.Asn |
| 350 | } |
| 351 | qAsn := swag.FormatFloat64(qrAsn) |
| 352 | if qAsn != "" { |
| 353 | if err := r.SetQueryParam("asn", qAsn); err != nil { |
| 354 | return err |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | } |
| 359 | |
| 360 | if o.ContactEmail != nil { |
| 361 | |
| 362 | // query param contact_email |
| 363 | var qrContactEmail string |
| 364 | if o.ContactEmail != nil { |
| 365 | qrContactEmail = *o.ContactEmail |
| 366 | } |
| 367 | qContactEmail := qrContactEmail |
| 368 | if qContactEmail != "" { |
| 369 | if err := r.SetQueryParam("contact_email", qContactEmail); err != nil { |
| 370 | return err |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | } |
| 375 | |
| 376 | if o.ContactName != nil { |
| 377 | |
| 378 | // query param contact_name |
| 379 | var qrContactName string |
| 380 | if o.ContactName != nil { |
| 381 | qrContactName = *o.ContactName |
| 382 | } |
| 383 | qContactName := qrContactName |
| 384 | if qContactName != "" { |
| 385 | if err := r.SetQueryParam("contact_name", qContactName); err != nil { |
| 386 | return err |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | } |
| 391 | |
| 392 | if o.ContactPhone != nil { |
| 393 | |
| 394 | // query param contact_phone |
| 395 | var qrContactPhone string |
| 396 | if o.ContactPhone != nil { |
| 397 | qrContactPhone = *o.ContactPhone |
| 398 | } |
| 399 | qContactPhone := qrContactPhone |
| 400 | if qContactPhone != "" { |
| 401 | if err := r.SetQueryParam("contact_phone", qContactPhone); err != nil { |
| 402 | return err |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | } |
| 407 | |
| 408 | if o.Facility != nil { |
| 409 | |
| 410 | // query param facility |
| 411 | var qrFacility string |
| 412 | if o.Facility != nil { |
| 413 | qrFacility = *o.Facility |
| 414 | } |
| 415 | qFacility := qrFacility |
| 416 | if qFacility != "" { |
| 417 | if err := r.SetQueryParam("facility", qFacility); err != nil { |
| 418 | return err |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | } |
| 423 | |
| 424 | if o.IDIn != nil { |
| 425 | |
| 426 | // query param id__in |
| 427 | var qrIDIn string |
| 428 | if o.IDIn != nil { |
| 429 | qrIDIn = *o.IDIn |
| 430 | } |
| 431 | qIDIn := qrIDIn |
| 432 | if qIDIn != "" { |
| 433 | if err := r.SetQueryParam("id__in", qIDIn); err != nil { |
| 434 | return err |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | } |
| 439 | |
| 440 | if o.Limit != nil { |
| 441 | |
| 442 | // query param limit |
| 443 | var qrLimit int64 |
| 444 | if o.Limit != nil { |
| 445 | qrLimit = *o.Limit |
| 446 | } |
| 447 | qLimit := swag.FormatInt64(qrLimit) |
| 448 | if qLimit != "" { |
| 449 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 450 | return err |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | } |
| 455 | |
| 456 | if o.Name != nil { |
| 457 | |
| 458 | // query param name |
| 459 | var qrName string |
| 460 | if o.Name != nil { |
| 461 | qrName = *o.Name |
| 462 | } |
| 463 | qName := qrName |
| 464 | if qName != "" { |
| 465 | if err := r.SetQueryParam("name", qName); err != nil { |
| 466 | return err |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | } |
| 471 | |
| 472 | if o.Offset != nil { |
| 473 | |
| 474 | // query param offset |
| 475 | var qrOffset int64 |
| 476 | if o.Offset != nil { |
| 477 | qrOffset = *o.Offset |
| 478 | } |
| 479 | qOffset := swag.FormatInt64(qrOffset) |
| 480 | if qOffset != "" { |
| 481 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 482 | return err |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | } |
| 487 | |
| 488 | if o.Q != nil { |
| 489 | |
| 490 | // query param q |
| 491 | var qrQ string |
| 492 | if o.Q != nil { |
| 493 | qrQ = *o.Q |
| 494 | } |
| 495 | qQ := qrQ |
| 496 | if qQ != "" { |
| 497 | if err := r.SetQueryParam("q", qQ); err != nil { |
| 498 | return err |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | } |
| 503 | |
| 504 | if o.Region != nil { |
| 505 | |
| 506 | // query param region |
| 507 | var qrRegion string |
| 508 | if o.Region != nil { |
| 509 | qrRegion = *o.Region |
| 510 | } |
| 511 | qRegion := qrRegion |
| 512 | if qRegion != "" { |
| 513 | if err := r.SetQueryParam("region", qRegion); err != nil { |
| 514 | return err |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | } |
| 519 | |
| 520 | if o.RegionID != nil { |
| 521 | |
| 522 | // query param region_id |
| 523 | var qrRegionID string |
| 524 | if o.RegionID != nil { |
| 525 | qrRegionID = *o.RegionID |
| 526 | } |
| 527 | qRegionID := qrRegionID |
| 528 | if qRegionID != "" { |
| 529 | if err := r.SetQueryParam("region_id", qRegionID); err != nil { |
| 530 | return err |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | } |
| 535 | |
| 536 | if o.Slug != nil { |
| 537 | |
| 538 | // query param slug |
| 539 | var qrSlug string |
| 540 | if o.Slug != nil { |
| 541 | qrSlug = *o.Slug |
| 542 | } |
| 543 | qSlug := qrSlug |
| 544 | if qSlug != "" { |
| 545 | if err := r.SetQueryParam("slug", qSlug); err != nil { |
| 546 | return err |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | } |
| 551 | |
| 552 | if o.Status != nil { |
| 553 | |
| 554 | // query param status |
| 555 | var qrStatus string |
| 556 | if o.Status != nil { |
| 557 | qrStatus = *o.Status |
| 558 | } |
| 559 | qStatus := qrStatus |
| 560 | if qStatus != "" { |
| 561 | if err := r.SetQueryParam("status", qStatus); err != nil { |
| 562 | return err |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | } |
| 567 | |
| 568 | if o.Tenant != nil { |
| 569 | |
| 570 | // query param tenant |
| 571 | var qrTenant string |
| 572 | if o.Tenant != nil { |
| 573 | qrTenant = *o.Tenant |
| 574 | } |
| 575 | qTenant := qrTenant |
| 576 | if qTenant != "" { |
| 577 | if err := r.SetQueryParam("tenant", qTenant); err != nil { |
| 578 | return err |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | } |
| 583 | |
| 584 | if o.TenantID != nil { |
| 585 | |
| 586 | // query param tenant_id |
| 587 | var qrTenantID string |
| 588 | if o.TenantID != nil { |
| 589 | qrTenantID = *o.TenantID |
| 590 | } |
| 591 | qTenantID := qrTenantID |
| 592 | if qTenantID != "" { |
| 593 | if err := r.SetQueryParam("tenant_id", qTenantID); err != nil { |
| 594 | return err |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | } |
| 599 | |
| 600 | if len(res) > 0 { |
| 601 | return errors.CompositeValidationError(res...) |
| 602 | } |
| 603 | return nil |
| 604 | } |