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 | // NewDcimDeviceBaysListParams creates a new DcimDeviceBaysListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewDcimDeviceBaysListParams() *DcimDeviceBaysListParams { |
| 39 | var () |
| 40 | return &DcimDeviceBaysListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewDcimDeviceBaysListParamsWithTimeout creates a new DcimDeviceBaysListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewDcimDeviceBaysListParamsWithTimeout(timeout time.Duration) *DcimDeviceBaysListParams { |
| 49 | var () |
| 50 | return &DcimDeviceBaysListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewDcimDeviceBaysListParamsWithContext creates a new DcimDeviceBaysListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewDcimDeviceBaysListParamsWithContext(ctx context.Context) *DcimDeviceBaysListParams { |
| 59 | var () |
| 60 | return &DcimDeviceBaysListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewDcimDeviceBaysListParamsWithHTTPClient creates a new DcimDeviceBaysListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewDcimDeviceBaysListParamsWithHTTPClient(client *http.Client) *DcimDeviceBaysListParams { |
| 69 | var () |
| 70 | return &DcimDeviceBaysListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*DcimDeviceBaysListParams contains all the parameters to send to the API endpoint |
| 76 | for the dcim device bays list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type DcimDeviceBaysListParams 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 | |
| 97 | timeout time.Duration |
| 98 | Context context.Context |
| 99 | HTTPClient *http.Client |
| 100 | } |
| 101 | |
| 102 | // WithTimeout adds the timeout to the dcim device bays list params |
| 103 | func (o *DcimDeviceBaysListParams) WithTimeout(timeout time.Duration) *DcimDeviceBaysListParams { |
| 104 | o.SetTimeout(timeout) |
| 105 | return o |
| 106 | } |
| 107 | |
| 108 | // SetTimeout adds the timeout to the dcim device bays list params |
| 109 | func (o *DcimDeviceBaysListParams) SetTimeout(timeout time.Duration) { |
| 110 | o.timeout = timeout |
| 111 | } |
| 112 | |
| 113 | // WithContext adds the context to the dcim device bays list params |
| 114 | func (o *DcimDeviceBaysListParams) WithContext(ctx context.Context) *DcimDeviceBaysListParams { |
| 115 | o.SetContext(ctx) |
| 116 | return o |
| 117 | } |
| 118 | |
| 119 | // SetContext adds the context to the dcim device bays list params |
| 120 | func (o *DcimDeviceBaysListParams) SetContext(ctx context.Context) { |
| 121 | o.Context = ctx |
| 122 | } |
| 123 | |
| 124 | // WithHTTPClient adds the HTTPClient to the dcim device bays list params |
| 125 | func (o *DcimDeviceBaysListParams) WithHTTPClient(client *http.Client) *DcimDeviceBaysListParams { |
| 126 | o.SetHTTPClient(client) |
| 127 | return o |
| 128 | } |
| 129 | |
| 130 | // SetHTTPClient adds the HTTPClient to the dcim device bays list params |
| 131 | func (o *DcimDeviceBaysListParams) SetHTTPClient(client *http.Client) { |
| 132 | o.HTTPClient = client |
| 133 | } |
| 134 | |
| 135 | // WithDevice adds the device to the dcim device bays list params |
| 136 | func (o *DcimDeviceBaysListParams) WithDevice(device *string) *DcimDeviceBaysListParams { |
| 137 | o.SetDevice(device) |
| 138 | return o |
| 139 | } |
| 140 | |
| 141 | // SetDevice adds the device to the dcim device bays list params |
| 142 | func (o *DcimDeviceBaysListParams) SetDevice(device *string) { |
| 143 | o.Device = device |
| 144 | } |
| 145 | |
| 146 | // WithDeviceID adds the deviceID to the dcim device bays list params |
| 147 | func (o *DcimDeviceBaysListParams) WithDeviceID(deviceID *string) *DcimDeviceBaysListParams { |
| 148 | o.SetDeviceID(deviceID) |
| 149 | return o |
| 150 | } |
| 151 | |
| 152 | // SetDeviceID adds the deviceId to the dcim device bays list params |
| 153 | func (o *DcimDeviceBaysListParams) SetDeviceID(deviceID *string) { |
| 154 | o.DeviceID = deviceID |
| 155 | } |
| 156 | |
| 157 | // WithLimit adds the limit to the dcim device bays list params |
| 158 | func (o *DcimDeviceBaysListParams) WithLimit(limit *int64) *DcimDeviceBaysListParams { |
| 159 | o.SetLimit(limit) |
| 160 | return o |
| 161 | } |
| 162 | |
| 163 | // SetLimit adds the limit to the dcim device bays list params |
| 164 | func (o *DcimDeviceBaysListParams) SetLimit(limit *int64) { |
| 165 | o.Limit = limit |
| 166 | } |
| 167 | |
| 168 | // WithName adds the name to the dcim device bays list params |
| 169 | func (o *DcimDeviceBaysListParams) WithName(name *string) *DcimDeviceBaysListParams { |
| 170 | o.SetName(name) |
| 171 | return o |
| 172 | } |
| 173 | |
| 174 | // SetName adds the name to the dcim device bays list params |
| 175 | func (o *DcimDeviceBaysListParams) SetName(name *string) { |
| 176 | o.Name = name |
| 177 | } |
| 178 | |
| 179 | // WithOffset adds the offset to the dcim device bays list params |
| 180 | func (o *DcimDeviceBaysListParams) WithOffset(offset *int64) *DcimDeviceBaysListParams { |
| 181 | o.SetOffset(offset) |
| 182 | return o |
| 183 | } |
| 184 | |
| 185 | // SetOffset adds the offset to the dcim device bays list params |
| 186 | func (o *DcimDeviceBaysListParams) SetOffset(offset *int64) { |
| 187 | o.Offset = offset |
| 188 | } |
| 189 | |
| 190 | // WriteToRequest writes these params to a swagger request |
| 191 | func (o *DcimDeviceBaysListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 192 | |
| 193 | if err := r.SetTimeout(o.timeout); err != nil { |
| 194 | return err |
| 195 | } |
| 196 | var res []error |
| 197 | |
| 198 | if o.Device != nil { |
| 199 | |
| 200 | // query param device |
| 201 | var qrDevice string |
| 202 | if o.Device != nil { |
| 203 | qrDevice = *o.Device |
| 204 | } |
| 205 | qDevice := qrDevice |
| 206 | if qDevice != "" { |
| 207 | if err := r.SetQueryParam("device", qDevice); err != nil { |
| 208 | return err |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | } |
| 213 | |
| 214 | if o.DeviceID != nil { |
| 215 | |
| 216 | // query param device_id |
| 217 | var qrDeviceID string |
| 218 | if o.DeviceID != nil { |
| 219 | qrDeviceID = *o.DeviceID |
| 220 | } |
| 221 | qDeviceID := qrDeviceID |
| 222 | if qDeviceID != "" { |
| 223 | if err := r.SetQueryParam("device_id", qDeviceID); err != nil { |
| 224 | return err |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | } |
| 229 | |
| 230 | if o.Limit != nil { |
| 231 | |
| 232 | // query param limit |
| 233 | var qrLimit int64 |
| 234 | if o.Limit != nil { |
| 235 | qrLimit = *o.Limit |
| 236 | } |
| 237 | qLimit := swag.FormatInt64(qrLimit) |
| 238 | if qLimit != "" { |
| 239 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 240 | return err |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | } |
| 245 | |
| 246 | if o.Name != nil { |
| 247 | |
| 248 | // query param name |
| 249 | var qrName string |
| 250 | if o.Name != nil { |
| 251 | qrName = *o.Name |
| 252 | } |
| 253 | qName := qrName |
| 254 | if qName != "" { |
| 255 | if err := r.SetQueryParam("name", qName); err != nil { |
| 256 | return err |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | } |
| 261 | |
| 262 | if o.Offset != nil { |
| 263 | |
| 264 | // query param offset |
| 265 | var qrOffset int64 |
| 266 | if o.Offset != nil { |
| 267 | qrOffset = *o.Offset |
| 268 | } |
| 269 | qOffset := swag.FormatInt64(qrOffset) |
| 270 | if qOffset != "" { |
| 271 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 272 | return err |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | } |
| 277 | |
| 278 | if len(res) > 0 { |
| 279 | return errors.CompositeValidationError(res...) |
| 280 | } |
| 281 | return nil |
| 282 | } |