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 | // NewDcimInterfaceTemplatesListParams creates a new DcimInterfaceTemplatesListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewDcimInterfaceTemplatesListParams() *DcimInterfaceTemplatesListParams { |
| 39 | var () |
| 40 | return &DcimInterfaceTemplatesListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewDcimInterfaceTemplatesListParamsWithTimeout creates a new DcimInterfaceTemplatesListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewDcimInterfaceTemplatesListParamsWithTimeout(timeout time.Duration) *DcimInterfaceTemplatesListParams { |
| 49 | var () |
| 50 | return &DcimInterfaceTemplatesListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewDcimInterfaceTemplatesListParamsWithContext creates a new DcimInterfaceTemplatesListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewDcimInterfaceTemplatesListParamsWithContext(ctx context.Context) *DcimInterfaceTemplatesListParams { |
| 59 | var () |
| 60 | return &DcimInterfaceTemplatesListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewDcimInterfaceTemplatesListParamsWithHTTPClient creates a new DcimInterfaceTemplatesListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewDcimInterfaceTemplatesListParamsWithHTTPClient(client *http.Client) *DcimInterfaceTemplatesListParams { |
| 69 | var () |
| 70 | return &DcimInterfaceTemplatesListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*DcimInterfaceTemplatesListParams contains all the parameters to send to the API endpoint |
| 76 | for the dcim interface templates list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type DcimInterfaceTemplatesListParams struct { |
| 79 | |
| 80 | /*DevicetypeID*/ |
| 81 | DevicetypeID *string |
| 82 | /*FormFactor*/ |
| 83 | FormFactor *string |
| 84 | /*Limit |
| 85 | Number of results to return per page. |
| 86 | |
| 87 | */ |
| 88 | Limit *int64 |
| 89 | /*MgmtOnly*/ |
| 90 | MgmtOnly *string |
| 91 | /*Name*/ |
| 92 | Name *string |
| 93 | /*Offset |
| 94 | The initial index from which to return the results. |
| 95 | |
| 96 | */ |
| 97 | Offset *int64 |
| 98 | |
| 99 | timeout time.Duration |
| 100 | Context context.Context |
| 101 | HTTPClient *http.Client |
| 102 | } |
| 103 | |
| 104 | // WithTimeout adds the timeout to the dcim interface templates list params |
| 105 | func (o *DcimInterfaceTemplatesListParams) WithTimeout(timeout time.Duration) *DcimInterfaceTemplatesListParams { |
| 106 | o.SetTimeout(timeout) |
| 107 | return o |
| 108 | } |
| 109 | |
| 110 | // SetTimeout adds the timeout to the dcim interface templates list params |
| 111 | func (o *DcimInterfaceTemplatesListParams) SetTimeout(timeout time.Duration) { |
| 112 | o.timeout = timeout |
| 113 | } |
| 114 | |
| 115 | // WithContext adds the context to the dcim interface templates list params |
| 116 | func (o *DcimInterfaceTemplatesListParams) WithContext(ctx context.Context) *DcimInterfaceTemplatesListParams { |
| 117 | o.SetContext(ctx) |
| 118 | return o |
| 119 | } |
| 120 | |
| 121 | // SetContext adds the context to the dcim interface templates list params |
| 122 | func (o *DcimInterfaceTemplatesListParams) SetContext(ctx context.Context) { |
| 123 | o.Context = ctx |
| 124 | } |
| 125 | |
| 126 | // WithHTTPClient adds the HTTPClient to the dcim interface templates list params |
| 127 | func (o *DcimInterfaceTemplatesListParams) WithHTTPClient(client *http.Client) *DcimInterfaceTemplatesListParams { |
| 128 | o.SetHTTPClient(client) |
| 129 | return o |
| 130 | } |
| 131 | |
| 132 | // SetHTTPClient adds the HTTPClient to the dcim interface templates list params |
| 133 | func (o *DcimInterfaceTemplatesListParams) SetHTTPClient(client *http.Client) { |
| 134 | o.HTTPClient = client |
| 135 | } |
| 136 | |
| 137 | // WithDevicetypeID adds the devicetypeID to the dcim interface templates list params |
| 138 | func (o *DcimInterfaceTemplatesListParams) WithDevicetypeID(devicetypeID *string) *DcimInterfaceTemplatesListParams { |
| 139 | o.SetDevicetypeID(devicetypeID) |
| 140 | return o |
| 141 | } |
| 142 | |
| 143 | // SetDevicetypeID adds the devicetypeId to the dcim interface templates list params |
| 144 | func (o *DcimInterfaceTemplatesListParams) SetDevicetypeID(devicetypeID *string) { |
| 145 | o.DevicetypeID = devicetypeID |
| 146 | } |
| 147 | |
| 148 | // WithFormFactor adds the formFactor to the dcim interface templates list params |
| 149 | func (o *DcimInterfaceTemplatesListParams) WithFormFactor(formFactor *string) *DcimInterfaceTemplatesListParams { |
| 150 | o.SetFormFactor(formFactor) |
| 151 | return o |
| 152 | } |
| 153 | |
| 154 | // SetFormFactor adds the formFactor to the dcim interface templates list params |
| 155 | func (o *DcimInterfaceTemplatesListParams) SetFormFactor(formFactor *string) { |
| 156 | o.FormFactor = formFactor |
| 157 | } |
| 158 | |
| 159 | // WithLimit adds the limit to the dcim interface templates list params |
| 160 | func (o *DcimInterfaceTemplatesListParams) WithLimit(limit *int64) *DcimInterfaceTemplatesListParams { |
| 161 | o.SetLimit(limit) |
| 162 | return o |
| 163 | } |
| 164 | |
| 165 | // SetLimit adds the limit to the dcim interface templates list params |
| 166 | func (o *DcimInterfaceTemplatesListParams) SetLimit(limit *int64) { |
| 167 | o.Limit = limit |
| 168 | } |
| 169 | |
| 170 | // WithMgmtOnly adds the mgmtOnly to the dcim interface templates list params |
| 171 | func (o *DcimInterfaceTemplatesListParams) WithMgmtOnly(mgmtOnly *string) *DcimInterfaceTemplatesListParams { |
| 172 | o.SetMgmtOnly(mgmtOnly) |
| 173 | return o |
| 174 | } |
| 175 | |
| 176 | // SetMgmtOnly adds the mgmtOnly to the dcim interface templates list params |
| 177 | func (o *DcimInterfaceTemplatesListParams) SetMgmtOnly(mgmtOnly *string) { |
| 178 | o.MgmtOnly = mgmtOnly |
| 179 | } |
| 180 | |
| 181 | // WithName adds the name to the dcim interface templates list params |
| 182 | func (o *DcimInterfaceTemplatesListParams) WithName(name *string) *DcimInterfaceTemplatesListParams { |
| 183 | o.SetName(name) |
| 184 | return o |
| 185 | } |
| 186 | |
| 187 | // SetName adds the name to the dcim interface templates list params |
| 188 | func (o *DcimInterfaceTemplatesListParams) SetName(name *string) { |
| 189 | o.Name = name |
| 190 | } |
| 191 | |
| 192 | // WithOffset adds the offset to the dcim interface templates list params |
| 193 | func (o *DcimInterfaceTemplatesListParams) WithOffset(offset *int64) *DcimInterfaceTemplatesListParams { |
| 194 | o.SetOffset(offset) |
| 195 | return o |
| 196 | } |
| 197 | |
| 198 | // SetOffset adds the offset to the dcim interface templates list params |
| 199 | func (o *DcimInterfaceTemplatesListParams) SetOffset(offset *int64) { |
| 200 | o.Offset = offset |
| 201 | } |
| 202 | |
| 203 | // WriteToRequest writes these params to a swagger request |
| 204 | func (o *DcimInterfaceTemplatesListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 205 | |
| 206 | if err := r.SetTimeout(o.timeout); err != nil { |
| 207 | return err |
| 208 | } |
| 209 | var res []error |
| 210 | |
| 211 | if o.DevicetypeID != nil { |
| 212 | |
| 213 | // query param devicetype_id |
| 214 | var qrDevicetypeID string |
| 215 | if o.DevicetypeID != nil { |
| 216 | qrDevicetypeID = *o.DevicetypeID |
| 217 | } |
| 218 | qDevicetypeID := qrDevicetypeID |
| 219 | if qDevicetypeID != "" { |
| 220 | if err := r.SetQueryParam("devicetype_id", qDevicetypeID); err != nil { |
| 221 | return err |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | } |
| 226 | |
| 227 | if o.FormFactor != nil { |
| 228 | |
| 229 | // query param form_factor |
| 230 | var qrFormFactor string |
| 231 | if o.FormFactor != nil { |
| 232 | qrFormFactor = *o.FormFactor |
| 233 | } |
| 234 | qFormFactor := qrFormFactor |
| 235 | if qFormFactor != "" { |
| 236 | if err := r.SetQueryParam("form_factor", qFormFactor); err != nil { |
| 237 | return err |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | } |
| 242 | |
| 243 | if o.Limit != nil { |
| 244 | |
| 245 | // query param limit |
| 246 | var qrLimit int64 |
| 247 | if o.Limit != nil { |
| 248 | qrLimit = *o.Limit |
| 249 | } |
| 250 | qLimit := swag.FormatInt64(qrLimit) |
| 251 | if qLimit != "" { |
| 252 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 253 | return err |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | } |
| 258 | |
| 259 | if o.MgmtOnly != nil { |
| 260 | |
| 261 | // query param mgmt_only |
| 262 | var qrMgmtOnly string |
| 263 | if o.MgmtOnly != nil { |
| 264 | qrMgmtOnly = *o.MgmtOnly |
| 265 | } |
| 266 | qMgmtOnly := qrMgmtOnly |
| 267 | if qMgmtOnly != "" { |
| 268 | if err := r.SetQueryParam("mgmt_only", qMgmtOnly); err != nil { |
| 269 | return err |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | } |
| 274 | |
| 275 | if o.Name != nil { |
| 276 | |
| 277 | // query param name |
| 278 | var qrName string |
| 279 | if o.Name != nil { |
| 280 | qrName = *o.Name |
| 281 | } |
| 282 | qName := qrName |
| 283 | if qName != "" { |
| 284 | if err := r.SetQueryParam("name", qName); err != nil { |
| 285 | return err |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | } |
| 290 | |
| 291 | if o.Offset != nil { |
| 292 | |
| 293 | // query param offset |
| 294 | var qrOffset int64 |
| 295 | if o.Offset != nil { |
| 296 | qrOffset = *o.Offset |
| 297 | } |
| 298 | qOffset := swag.FormatInt64(qrOffset) |
| 299 | if qOffset != "" { |
| 300 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 301 | return err |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | } |
| 306 | |
| 307 | if len(res) > 0 { |
| 308 | return errors.CompositeValidationError(res...) |
| 309 | } |
| 310 | return nil |
| 311 | } |