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 | // NewDcimInventoryItemsListParams creates a new DcimInventoryItemsListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewDcimInventoryItemsListParams() *DcimInventoryItemsListParams { |
| 39 | var () |
| 40 | return &DcimInventoryItemsListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewDcimInventoryItemsListParamsWithTimeout creates a new DcimInventoryItemsListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewDcimInventoryItemsListParamsWithTimeout(timeout time.Duration) *DcimInventoryItemsListParams { |
| 49 | var () |
| 50 | return &DcimInventoryItemsListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewDcimInventoryItemsListParamsWithContext creates a new DcimInventoryItemsListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewDcimInventoryItemsListParamsWithContext(ctx context.Context) *DcimInventoryItemsListParams { |
| 59 | var () |
| 60 | return &DcimInventoryItemsListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewDcimInventoryItemsListParamsWithHTTPClient creates a new DcimInventoryItemsListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewDcimInventoryItemsListParamsWithHTTPClient(client *http.Client) *DcimInventoryItemsListParams { |
| 69 | var () |
| 70 | return &DcimInventoryItemsListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*DcimInventoryItemsListParams contains all the parameters to send to the API endpoint |
| 76 | for the dcim inventory items list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type DcimInventoryItemsListParams struct { |
| 79 | |
| 80 | /*AssetTag*/ |
| 81 | AssetTag *string |
| 82 | /*Device*/ |
| 83 | Device *string |
| 84 | /*DeviceID*/ |
| 85 | DeviceID *string |
| 86 | /*Discovered*/ |
| 87 | Discovered *string |
| 88 | /*Limit |
| 89 | Number of results to return per page. |
| 90 | |
| 91 | */ |
| 92 | Limit *int64 |
| 93 | /*Manufacturer*/ |
| 94 | Manufacturer *string |
| 95 | /*ManufacturerID*/ |
| 96 | ManufacturerID *string |
| 97 | /*Name*/ |
| 98 | Name *string |
| 99 | /*Offset |
| 100 | The initial index from which to return the results. |
| 101 | |
| 102 | */ |
| 103 | Offset *int64 |
| 104 | /*ParentID*/ |
| 105 | ParentID *string |
| 106 | /*PartID*/ |
| 107 | PartID *string |
| 108 | /*Q*/ |
| 109 | Q *string |
| 110 | /*Serial*/ |
| 111 | Serial *string |
| 112 | |
| 113 | timeout time.Duration |
| 114 | Context context.Context |
| 115 | HTTPClient *http.Client |
| 116 | } |
| 117 | |
| 118 | // WithTimeout adds the timeout to the dcim inventory items list params |
| 119 | func (o *DcimInventoryItemsListParams) WithTimeout(timeout time.Duration) *DcimInventoryItemsListParams { |
| 120 | o.SetTimeout(timeout) |
| 121 | return o |
| 122 | } |
| 123 | |
| 124 | // SetTimeout adds the timeout to the dcim inventory items list params |
| 125 | func (o *DcimInventoryItemsListParams) SetTimeout(timeout time.Duration) { |
| 126 | o.timeout = timeout |
| 127 | } |
| 128 | |
| 129 | // WithContext adds the context to the dcim inventory items list params |
| 130 | func (o *DcimInventoryItemsListParams) WithContext(ctx context.Context) *DcimInventoryItemsListParams { |
| 131 | o.SetContext(ctx) |
| 132 | return o |
| 133 | } |
| 134 | |
| 135 | // SetContext adds the context to the dcim inventory items list params |
| 136 | func (o *DcimInventoryItemsListParams) SetContext(ctx context.Context) { |
| 137 | o.Context = ctx |
| 138 | } |
| 139 | |
| 140 | // WithHTTPClient adds the HTTPClient to the dcim inventory items list params |
| 141 | func (o *DcimInventoryItemsListParams) WithHTTPClient(client *http.Client) *DcimInventoryItemsListParams { |
| 142 | o.SetHTTPClient(client) |
| 143 | return o |
| 144 | } |
| 145 | |
| 146 | // SetHTTPClient adds the HTTPClient to the dcim inventory items list params |
| 147 | func (o *DcimInventoryItemsListParams) SetHTTPClient(client *http.Client) { |
| 148 | o.HTTPClient = client |
| 149 | } |
| 150 | |
| 151 | // WithAssetTag adds the assetTag to the dcim inventory items list params |
| 152 | func (o *DcimInventoryItemsListParams) WithAssetTag(assetTag *string) *DcimInventoryItemsListParams { |
| 153 | o.SetAssetTag(assetTag) |
| 154 | return o |
| 155 | } |
| 156 | |
| 157 | // SetAssetTag adds the assetTag to the dcim inventory items list params |
| 158 | func (o *DcimInventoryItemsListParams) SetAssetTag(assetTag *string) { |
| 159 | o.AssetTag = assetTag |
| 160 | } |
| 161 | |
| 162 | // WithDevice adds the device to the dcim inventory items list params |
| 163 | func (o *DcimInventoryItemsListParams) WithDevice(device *string) *DcimInventoryItemsListParams { |
| 164 | o.SetDevice(device) |
| 165 | return o |
| 166 | } |
| 167 | |
| 168 | // SetDevice adds the device to the dcim inventory items list params |
| 169 | func (o *DcimInventoryItemsListParams) SetDevice(device *string) { |
| 170 | o.Device = device |
| 171 | } |
| 172 | |
| 173 | // WithDeviceID adds the deviceID to the dcim inventory items list params |
| 174 | func (o *DcimInventoryItemsListParams) WithDeviceID(deviceID *string) *DcimInventoryItemsListParams { |
| 175 | o.SetDeviceID(deviceID) |
| 176 | return o |
| 177 | } |
| 178 | |
| 179 | // SetDeviceID adds the deviceId to the dcim inventory items list params |
| 180 | func (o *DcimInventoryItemsListParams) SetDeviceID(deviceID *string) { |
| 181 | o.DeviceID = deviceID |
| 182 | } |
| 183 | |
| 184 | // WithDiscovered adds the discovered to the dcim inventory items list params |
| 185 | func (o *DcimInventoryItemsListParams) WithDiscovered(discovered *string) *DcimInventoryItemsListParams { |
| 186 | o.SetDiscovered(discovered) |
| 187 | return o |
| 188 | } |
| 189 | |
| 190 | // SetDiscovered adds the discovered to the dcim inventory items list params |
| 191 | func (o *DcimInventoryItemsListParams) SetDiscovered(discovered *string) { |
| 192 | o.Discovered = discovered |
| 193 | } |
| 194 | |
| 195 | // WithLimit adds the limit to the dcim inventory items list params |
| 196 | func (o *DcimInventoryItemsListParams) WithLimit(limit *int64) *DcimInventoryItemsListParams { |
| 197 | o.SetLimit(limit) |
| 198 | return o |
| 199 | } |
| 200 | |
| 201 | // SetLimit adds the limit to the dcim inventory items list params |
| 202 | func (o *DcimInventoryItemsListParams) SetLimit(limit *int64) { |
| 203 | o.Limit = limit |
| 204 | } |
| 205 | |
| 206 | // WithManufacturer adds the manufacturer to the dcim inventory items list params |
| 207 | func (o *DcimInventoryItemsListParams) WithManufacturer(manufacturer *string) *DcimInventoryItemsListParams { |
| 208 | o.SetManufacturer(manufacturer) |
| 209 | return o |
| 210 | } |
| 211 | |
| 212 | // SetManufacturer adds the manufacturer to the dcim inventory items list params |
| 213 | func (o *DcimInventoryItemsListParams) SetManufacturer(manufacturer *string) { |
| 214 | o.Manufacturer = manufacturer |
| 215 | } |
| 216 | |
| 217 | // WithManufacturerID adds the manufacturerID to the dcim inventory items list params |
| 218 | func (o *DcimInventoryItemsListParams) WithManufacturerID(manufacturerID *string) *DcimInventoryItemsListParams { |
| 219 | o.SetManufacturerID(manufacturerID) |
| 220 | return o |
| 221 | } |
| 222 | |
| 223 | // SetManufacturerID adds the manufacturerId to the dcim inventory items list params |
| 224 | func (o *DcimInventoryItemsListParams) SetManufacturerID(manufacturerID *string) { |
| 225 | o.ManufacturerID = manufacturerID |
| 226 | } |
| 227 | |
| 228 | // WithName adds the name to the dcim inventory items list params |
| 229 | func (o *DcimInventoryItemsListParams) WithName(name *string) *DcimInventoryItemsListParams { |
| 230 | o.SetName(name) |
| 231 | return o |
| 232 | } |
| 233 | |
| 234 | // SetName adds the name to the dcim inventory items list params |
| 235 | func (o *DcimInventoryItemsListParams) SetName(name *string) { |
| 236 | o.Name = name |
| 237 | } |
| 238 | |
| 239 | // WithOffset adds the offset to the dcim inventory items list params |
| 240 | func (o *DcimInventoryItemsListParams) WithOffset(offset *int64) *DcimInventoryItemsListParams { |
| 241 | o.SetOffset(offset) |
| 242 | return o |
| 243 | } |
| 244 | |
| 245 | // SetOffset adds the offset to the dcim inventory items list params |
| 246 | func (o *DcimInventoryItemsListParams) SetOffset(offset *int64) { |
| 247 | o.Offset = offset |
| 248 | } |
| 249 | |
| 250 | // WithParentID adds the parentID to the dcim inventory items list params |
| 251 | func (o *DcimInventoryItemsListParams) WithParentID(parentID *string) *DcimInventoryItemsListParams { |
| 252 | o.SetParentID(parentID) |
| 253 | return o |
| 254 | } |
| 255 | |
| 256 | // SetParentID adds the parentId to the dcim inventory items list params |
| 257 | func (o *DcimInventoryItemsListParams) SetParentID(parentID *string) { |
| 258 | o.ParentID = parentID |
| 259 | } |
| 260 | |
| 261 | // WithPartID adds the partID to the dcim inventory items list params |
| 262 | func (o *DcimInventoryItemsListParams) WithPartID(partID *string) *DcimInventoryItemsListParams { |
| 263 | o.SetPartID(partID) |
| 264 | return o |
| 265 | } |
| 266 | |
| 267 | // SetPartID adds the partId to the dcim inventory items list params |
| 268 | func (o *DcimInventoryItemsListParams) SetPartID(partID *string) { |
| 269 | o.PartID = partID |
| 270 | } |
| 271 | |
| 272 | // WithQ adds the q to the dcim inventory items list params |
| 273 | func (o *DcimInventoryItemsListParams) WithQ(q *string) *DcimInventoryItemsListParams { |
| 274 | o.SetQ(q) |
| 275 | return o |
| 276 | } |
| 277 | |
| 278 | // SetQ adds the q to the dcim inventory items list params |
| 279 | func (o *DcimInventoryItemsListParams) SetQ(q *string) { |
| 280 | o.Q = q |
| 281 | } |
| 282 | |
| 283 | // WithSerial adds the serial to the dcim inventory items list params |
| 284 | func (o *DcimInventoryItemsListParams) WithSerial(serial *string) *DcimInventoryItemsListParams { |
| 285 | o.SetSerial(serial) |
| 286 | return o |
| 287 | } |
| 288 | |
| 289 | // SetSerial adds the serial to the dcim inventory items list params |
| 290 | func (o *DcimInventoryItemsListParams) SetSerial(serial *string) { |
| 291 | o.Serial = serial |
| 292 | } |
| 293 | |
| 294 | // WriteToRequest writes these params to a swagger request |
| 295 | func (o *DcimInventoryItemsListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 296 | |
| 297 | if err := r.SetTimeout(o.timeout); err != nil { |
| 298 | return err |
| 299 | } |
| 300 | var res []error |
| 301 | |
| 302 | if o.AssetTag != nil { |
| 303 | |
| 304 | // query param asset_tag |
| 305 | var qrAssetTag string |
| 306 | if o.AssetTag != nil { |
| 307 | qrAssetTag = *o.AssetTag |
| 308 | } |
| 309 | qAssetTag := qrAssetTag |
| 310 | if qAssetTag != "" { |
| 311 | if err := r.SetQueryParam("asset_tag", qAssetTag); err != nil { |
| 312 | return err |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | } |
| 317 | |
| 318 | if o.Device != nil { |
| 319 | |
| 320 | // query param device |
| 321 | var qrDevice string |
| 322 | if o.Device != nil { |
| 323 | qrDevice = *o.Device |
| 324 | } |
| 325 | qDevice := qrDevice |
| 326 | if qDevice != "" { |
| 327 | if err := r.SetQueryParam("device", qDevice); err != nil { |
| 328 | return err |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | } |
| 333 | |
| 334 | if o.DeviceID != nil { |
| 335 | |
| 336 | // query param device_id |
| 337 | var qrDeviceID string |
| 338 | if o.DeviceID != nil { |
| 339 | qrDeviceID = *o.DeviceID |
| 340 | } |
| 341 | qDeviceID := qrDeviceID |
| 342 | if qDeviceID != "" { |
| 343 | if err := r.SetQueryParam("device_id", qDeviceID); err != nil { |
| 344 | return err |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | } |
| 349 | |
| 350 | if o.Discovered != nil { |
| 351 | |
| 352 | // query param discovered |
| 353 | var qrDiscovered string |
| 354 | if o.Discovered != nil { |
| 355 | qrDiscovered = *o.Discovered |
| 356 | } |
| 357 | qDiscovered := qrDiscovered |
| 358 | if qDiscovered != "" { |
| 359 | if err := r.SetQueryParam("discovered", qDiscovered); err != nil { |
| 360 | return err |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | } |
| 365 | |
| 366 | if o.Limit != nil { |
| 367 | |
| 368 | // query param limit |
| 369 | var qrLimit int64 |
| 370 | if o.Limit != nil { |
| 371 | qrLimit = *o.Limit |
| 372 | } |
| 373 | qLimit := swag.FormatInt64(qrLimit) |
| 374 | if qLimit != "" { |
| 375 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 376 | return err |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | } |
| 381 | |
| 382 | if o.Manufacturer != nil { |
| 383 | |
| 384 | // query param manufacturer |
| 385 | var qrManufacturer string |
| 386 | if o.Manufacturer != nil { |
| 387 | qrManufacturer = *o.Manufacturer |
| 388 | } |
| 389 | qManufacturer := qrManufacturer |
| 390 | if qManufacturer != "" { |
| 391 | if err := r.SetQueryParam("manufacturer", qManufacturer); err != nil { |
| 392 | return err |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | } |
| 397 | |
| 398 | if o.ManufacturerID != nil { |
| 399 | |
| 400 | // query param manufacturer_id |
| 401 | var qrManufacturerID string |
| 402 | if o.ManufacturerID != nil { |
| 403 | qrManufacturerID = *o.ManufacturerID |
| 404 | } |
| 405 | qManufacturerID := qrManufacturerID |
| 406 | if qManufacturerID != "" { |
| 407 | if err := r.SetQueryParam("manufacturer_id", qManufacturerID); err != nil { |
| 408 | return err |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | } |
| 413 | |
| 414 | if o.Name != nil { |
| 415 | |
| 416 | // query param name |
| 417 | var qrName string |
| 418 | if o.Name != nil { |
| 419 | qrName = *o.Name |
| 420 | } |
| 421 | qName := qrName |
| 422 | if qName != "" { |
| 423 | if err := r.SetQueryParam("name", qName); err != nil { |
| 424 | return err |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | } |
| 429 | |
| 430 | if o.Offset != nil { |
| 431 | |
| 432 | // query param offset |
| 433 | var qrOffset int64 |
| 434 | if o.Offset != nil { |
| 435 | qrOffset = *o.Offset |
| 436 | } |
| 437 | qOffset := swag.FormatInt64(qrOffset) |
| 438 | if qOffset != "" { |
| 439 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 440 | return err |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | } |
| 445 | |
| 446 | if o.ParentID != nil { |
| 447 | |
| 448 | // query param parent_id |
| 449 | var qrParentID string |
| 450 | if o.ParentID != nil { |
| 451 | qrParentID = *o.ParentID |
| 452 | } |
| 453 | qParentID := qrParentID |
| 454 | if qParentID != "" { |
| 455 | if err := r.SetQueryParam("parent_id", qParentID); err != nil { |
| 456 | return err |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | } |
| 461 | |
| 462 | if o.PartID != nil { |
| 463 | |
| 464 | // query param part_id |
| 465 | var qrPartID string |
| 466 | if o.PartID != nil { |
| 467 | qrPartID = *o.PartID |
| 468 | } |
| 469 | qPartID := qrPartID |
| 470 | if qPartID != "" { |
| 471 | if err := r.SetQueryParam("part_id", qPartID); err != nil { |
| 472 | return err |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | } |
| 477 | |
| 478 | if o.Q != nil { |
| 479 | |
| 480 | // query param q |
| 481 | var qrQ string |
| 482 | if o.Q != nil { |
| 483 | qrQ = *o.Q |
| 484 | } |
| 485 | qQ := qrQ |
| 486 | if qQ != "" { |
| 487 | if err := r.SetQueryParam("q", qQ); err != nil { |
| 488 | return err |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | } |
| 493 | |
| 494 | if o.Serial != nil { |
| 495 | |
| 496 | // query param serial |
| 497 | var qrSerial string |
| 498 | if o.Serial != nil { |
| 499 | qrSerial = *o.Serial |
| 500 | } |
| 501 | qSerial := qrSerial |
| 502 | if qSerial != "" { |
| 503 | if err := r.SetQueryParam("serial", qSerial); err != nil { |
| 504 | return err |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | } |
| 509 | |
| 510 | if len(res) > 0 { |
| 511 | return errors.CompositeValidationError(res...) |
| 512 | } |
| 513 | return nil |
| 514 | } |