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