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 ipam |
| 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 | // NewIPAMServicesListParams creates a new IPAMServicesListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewIPAMServicesListParams() *IPAMServicesListParams { |
| 39 | var () |
| 40 | return &IPAMServicesListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewIPAMServicesListParamsWithTimeout creates a new IPAMServicesListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewIPAMServicesListParamsWithTimeout(timeout time.Duration) *IPAMServicesListParams { |
| 49 | var () |
| 50 | return &IPAMServicesListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewIPAMServicesListParamsWithContext creates a new IPAMServicesListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewIPAMServicesListParamsWithContext(ctx context.Context) *IPAMServicesListParams { |
| 59 | var () |
| 60 | return &IPAMServicesListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewIPAMServicesListParamsWithHTTPClient creates a new IPAMServicesListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewIPAMServicesListParamsWithHTTPClient(client *http.Client) *IPAMServicesListParams { |
| 69 | var () |
| 70 | return &IPAMServicesListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*IPAMServicesListParams contains all the parameters to send to the API endpoint |
| 76 | for the ipam services list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type IPAMServicesListParams struct { |
| 79 | |
| 80 | /*Device*/ |
| 81 | Device *string |
| 82 | /*DeviceID*/ |
| 83 | DeviceID *string |
| 84 | /*Limit |
| 85 | Number of results to return per page. |
| 86 | |
| 87 | */ |
| 88 | Limit *int64 |
| 89 | /*Name*/ |
| 90 | Name *string |
| 91 | /*Offset |
| 92 | The initial index from which to return the results. |
| 93 | |
| 94 | */ |
| 95 | Offset *int64 |
| 96 | /*Port*/ |
| 97 | Port *float64 |
| 98 | /*Protocol*/ |
| 99 | Protocol *string |
| 100 | /*VirtualMachine*/ |
| 101 | VirtualMachine *string |
| 102 | /*VirtualMachineID*/ |
| 103 | VirtualMachineID *string |
| 104 | |
| 105 | timeout time.Duration |
| 106 | Context context.Context |
| 107 | HTTPClient *http.Client |
| 108 | } |
| 109 | |
| 110 | // WithTimeout adds the timeout to the ipam services list params |
| 111 | func (o *IPAMServicesListParams) WithTimeout(timeout time.Duration) *IPAMServicesListParams { |
| 112 | o.SetTimeout(timeout) |
| 113 | return o |
| 114 | } |
| 115 | |
| 116 | // SetTimeout adds the timeout to the ipam services list params |
| 117 | func (o *IPAMServicesListParams) SetTimeout(timeout time.Duration) { |
| 118 | o.timeout = timeout |
| 119 | } |
| 120 | |
| 121 | // WithContext adds the context to the ipam services list params |
| 122 | func (o *IPAMServicesListParams) WithContext(ctx context.Context) *IPAMServicesListParams { |
| 123 | o.SetContext(ctx) |
| 124 | return o |
| 125 | } |
| 126 | |
| 127 | // SetContext adds the context to the ipam services list params |
| 128 | func (o *IPAMServicesListParams) SetContext(ctx context.Context) { |
| 129 | o.Context = ctx |
| 130 | } |
| 131 | |
| 132 | // WithHTTPClient adds the HTTPClient to the ipam services list params |
| 133 | func (o *IPAMServicesListParams) WithHTTPClient(client *http.Client) *IPAMServicesListParams { |
| 134 | o.SetHTTPClient(client) |
| 135 | return o |
| 136 | } |
| 137 | |
| 138 | // SetHTTPClient adds the HTTPClient to the ipam services list params |
| 139 | func (o *IPAMServicesListParams) SetHTTPClient(client *http.Client) { |
| 140 | o.HTTPClient = client |
| 141 | } |
| 142 | |
| 143 | // WithDevice adds the device to the ipam services list params |
| 144 | func (o *IPAMServicesListParams) WithDevice(device *string) *IPAMServicesListParams { |
| 145 | o.SetDevice(device) |
| 146 | return o |
| 147 | } |
| 148 | |
| 149 | // SetDevice adds the device to the ipam services list params |
| 150 | func (o *IPAMServicesListParams) SetDevice(device *string) { |
| 151 | o.Device = device |
| 152 | } |
| 153 | |
| 154 | // WithDeviceID adds the deviceID to the ipam services list params |
| 155 | func (o *IPAMServicesListParams) WithDeviceID(deviceID *string) *IPAMServicesListParams { |
| 156 | o.SetDeviceID(deviceID) |
| 157 | return o |
| 158 | } |
| 159 | |
| 160 | // SetDeviceID adds the deviceId to the ipam services list params |
| 161 | func (o *IPAMServicesListParams) SetDeviceID(deviceID *string) { |
| 162 | o.DeviceID = deviceID |
| 163 | } |
| 164 | |
| 165 | // WithLimit adds the limit to the ipam services list params |
| 166 | func (o *IPAMServicesListParams) WithLimit(limit *int64) *IPAMServicesListParams { |
| 167 | o.SetLimit(limit) |
| 168 | return o |
| 169 | } |
| 170 | |
| 171 | // SetLimit adds the limit to the ipam services list params |
| 172 | func (o *IPAMServicesListParams) SetLimit(limit *int64) { |
| 173 | o.Limit = limit |
| 174 | } |
| 175 | |
| 176 | // WithName adds the name to the ipam services list params |
| 177 | func (o *IPAMServicesListParams) WithName(name *string) *IPAMServicesListParams { |
| 178 | o.SetName(name) |
| 179 | return o |
| 180 | } |
| 181 | |
| 182 | // SetName adds the name to the ipam services list params |
| 183 | func (o *IPAMServicesListParams) SetName(name *string) { |
| 184 | o.Name = name |
| 185 | } |
| 186 | |
| 187 | // WithOffset adds the offset to the ipam services list params |
| 188 | func (o *IPAMServicesListParams) WithOffset(offset *int64) *IPAMServicesListParams { |
| 189 | o.SetOffset(offset) |
| 190 | return o |
| 191 | } |
| 192 | |
| 193 | // SetOffset adds the offset to the ipam services list params |
| 194 | func (o *IPAMServicesListParams) SetOffset(offset *int64) { |
| 195 | o.Offset = offset |
| 196 | } |
| 197 | |
| 198 | // WithPort adds the port to the ipam services list params |
| 199 | func (o *IPAMServicesListParams) WithPort(port *float64) *IPAMServicesListParams { |
| 200 | o.SetPort(port) |
| 201 | return o |
| 202 | } |
| 203 | |
| 204 | // SetPort adds the port to the ipam services list params |
| 205 | func (o *IPAMServicesListParams) SetPort(port *float64) { |
| 206 | o.Port = port |
| 207 | } |
| 208 | |
| 209 | // WithProtocol adds the protocol to the ipam services list params |
| 210 | func (o *IPAMServicesListParams) WithProtocol(protocol *string) *IPAMServicesListParams { |
| 211 | o.SetProtocol(protocol) |
| 212 | return o |
| 213 | } |
| 214 | |
| 215 | // SetProtocol adds the protocol to the ipam services list params |
| 216 | func (o *IPAMServicesListParams) SetProtocol(protocol *string) { |
| 217 | o.Protocol = protocol |
| 218 | } |
| 219 | |
| 220 | // WithVirtualMachine adds the virtualMachine to the ipam services list params |
| 221 | func (o *IPAMServicesListParams) WithVirtualMachine(virtualMachine *string) *IPAMServicesListParams { |
| 222 | o.SetVirtualMachine(virtualMachine) |
| 223 | return o |
| 224 | } |
| 225 | |
| 226 | // SetVirtualMachine adds the virtualMachine to the ipam services list params |
| 227 | func (o *IPAMServicesListParams) SetVirtualMachine(virtualMachine *string) { |
| 228 | o.VirtualMachine = virtualMachine |
| 229 | } |
| 230 | |
| 231 | // WithVirtualMachineID adds the virtualMachineID to the ipam services list params |
| 232 | func (o *IPAMServicesListParams) WithVirtualMachineID(virtualMachineID *string) *IPAMServicesListParams { |
| 233 | o.SetVirtualMachineID(virtualMachineID) |
| 234 | return o |
| 235 | } |
| 236 | |
| 237 | // SetVirtualMachineID adds the virtualMachineId to the ipam services list params |
| 238 | func (o *IPAMServicesListParams) SetVirtualMachineID(virtualMachineID *string) { |
| 239 | o.VirtualMachineID = virtualMachineID |
| 240 | } |
| 241 | |
| 242 | // WriteToRequest writes these params to a swagger request |
| 243 | func (o *IPAMServicesListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 244 | |
| 245 | if err := r.SetTimeout(o.timeout); err != nil { |
| 246 | return err |
| 247 | } |
| 248 | var res []error |
| 249 | |
| 250 | if o.Device != nil { |
| 251 | |
| 252 | // query param device |
| 253 | var qrDevice string |
| 254 | if o.Device != nil { |
| 255 | qrDevice = *o.Device |
| 256 | } |
| 257 | qDevice := qrDevice |
| 258 | if qDevice != "" { |
| 259 | if err := r.SetQueryParam("device", qDevice); err != nil { |
| 260 | return err |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | } |
| 265 | |
| 266 | if o.DeviceID != nil { |
| 267 | |
| 268 | // query param device_id |
| 269 | var qrDeviceID string |
| 270 | if o.DeviceID != nil { |
| 271 | qrDeviceID = *o.DeviceID |
| 272 | } |
| 273 | qDeviceID := qrDeviceID |
| 274 | if qDeviceID != "" { |
| 275 | if err := r.SetQueryParam("device_id", qDeviceID); err != nil { |
| 276 | return err |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | } |
| 281 | |
| 282 | if o.Limit != nil { |
| 283 | |
| 284 | // query param limit |
| 285 | var qrLimit int64 |
| 286 | if o.Limit != nil { |
| 287 | qrLimit = *o.Limit |
| 288 | } |
| 289 | qLimit := swag.FormatInt64(qrLimit) |
| 290 | if qLimit != "" { |
| 291 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 292 | return err |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | } |
| 297 | |
| 298 | if o.Name != nil { |
| 299 | |
| 300 | // query param name |
| 301 | var qrName string |
| 302 | if o.Name != nil { |
| 303 | qrName = *o.Name |
| 304 | } |
| 305 | qName := qrName |
| 306 | if qName != "" { |
| 307 | if err := r.SetQueryParam("name", qName); err != nil { |
| 308 | return err |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | } |
| 313 | |
| 314 | if o.Offset != nil { |
| 315 | |
| 316 | // query param offset |
| 317 | var qrOffset int64 |
| 318 | if o.Offset != nil { |
| 319 | qrOffset = *o.Offset |
| 320 | } |
| 321 | qOffset := swag.FormatInt64(qrOffset) |
| 322 | if qOffset != "" { |
| 323 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 324 | return err |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | } |
| 329 | |
| 330 | if o.Port != nil { |
| 331 | |
| 332 | // query param port |
| 333 | var qrPort float64 |
| 334 | if o.Port != nil { |
| 335 | qrPort = *o.Port |
| 336 | } |
| 337 | qPort := swag.FormatFloat64(qrPort) |
| 338 | if qPort != "" { |
| 339 | if err := r.SetQueryParam("port", qPort); err != nil { |
| 340 | return err |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | } |
| 345 | |
| 346 | if o.Protocol != nil { |
| 347 | |
| 348 | // query param protocol |
| 349 | var qrProtocol string |
| 350 | if o.Protocol != nil { |
| 351 | qrProtocol = *o.Protocol |
| 352 | } |
| 353 | qProtocol := qrProtocol |
| 354 | if qProtocol != "" { |
| 355 | if err := r.SetQueryParam("protocol", qProtocol); err != nil { |
| 356 | return err |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | } |
| 361 | |
| 362 | if o.VirtualMachine != nil { |
| 363 | |
| 364 | // query param virtual_machine |
| 365 | var qrVirtualMachine string |
| 366 | if o.VirtualMachine != nil { |
| 367 | qrVirtualMachine = *o.VirtualMachine |
| 368 | } |
| 369 | qVirtualMachine := qrVirtualMachine |
| 370 | if qVirtualMachine != "" { |
| 371 | if err := r.SetQueryParam("virtual_machine", qVirtualMachine); err != nil { |
| 372 | return err |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | } |
| 377 | |
| 378 | if o.VirtualMachineID != nil { |
| 379 | |
| 380 | // query param virtual_machine_id |
| 381 | var qrVirtualMachineID string |
| 382 | if o.VirtualMachineID != nil { |
| 383 | qrVirtualMachineID = *o.VirtualMachineID |
| 384 | } |
| 385 | qVirtualMachineID := qrVirtualMachineID |
| 386 | if qVirtualMachineID != "" { |
| 387 | if err := r.SetQueryParam("virtual_machine_id", qVirtualMachineID); err != nil { |
| 388 | return err |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | } |
| 393 | |
| 394 | if len(res) > 0 { |
| 395 | return errors.CompositeValidationError(res...) |
| 396 | } |
| 397 | return nil |
| 398 | } |