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