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