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