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 secrets |
| 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 | // NewSecretsSecretRolesListParams creates a new SecretsSecretRolesListParams object |
| 37 | // with the default values initialized. |
| 38 | func NewSecretsSecretRolesListParams() *SecretsSecretRolesListParams { |
| 39 | var () |
| 40 | return &SecretsSecretRolesListParams{ |
| 41 | |
| 42 | timeout: cr.DefaultTimeout, |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // NewSecretsSecretRolesListParamsWithTimeout creates a new SecretsSecretRolesListParams object |
| 47 | // with the default values initialized, and the ability to set a timeout on a request |
| 48 | func NewSecretsSecretRolesListParamsWithTimeout(timeout time.Duration) *SecretsSecretRolesListParams { |
| 49 | var () |
| 50 | return &SecretsSecretRolesListParams{ |
| 51 | |
| 52 | timeout: timeout, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // NewSecretsSecretRolesListParamsWithContext creates a new SecretsSecretRolesListParams object |
| 57 | // with the default values initialized, and the ability to set a context for a request |
| 58 | func NewSecretsSecretRolesListParamsWithContext(ctx context.Context) *SecretsSecretRolesListParams { |
| 59 | var () |
| 60 | return &SecretsSecretRolesListParams{ |
| 61 | |
| 62 | Context: ctx, |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | // NewSecretsSecretRolesListParamsWithHTTPClient creates a new SecretsSecretRolesListParams object |
| 67 | // with the default values initialized, and the ability to set a custom HTTPClient for a request |
| 68 | func NewSecretsSecretRolesListParamsWithHTTPClient(client *http.Client) *SecretsSecretRolesListParams { |
| 69 | var () |
| 70 | return &SecretsSecretRolesListParams{ |
| 71 | HTTPClient: client, |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /*SecretsSecretRolesListParams contains all the parameters to send to the API endpoint |
| 76 | for the secrets secret roles list operation typically these are written to a http.Request |
| 77 | */ |
| 78 | type SecretsSecretRolesListParams struct { |
| 79 | |
| 80 | /*Limit |
| 81 | Number of results to return per page. |
| 82 | |
| 83 | */ |
| 84 | Limit *int64 |
| 85 | /*Name*/ |
| 86 | Name *string |
| 87 | /*Offset |
| 88 | The initial index from which to return the results. |
| 89 | |
| 90 | */ |
| 91 | Offset *int64 |
| 92 | /*Slug*/ |
| 93 | Slug *string |
| 94 | |
| 95 | timeout time.Duration |
| 96 | Context context.Context |
| 97 | HTTPClient *http.Client |
| 98 | } |
| 99 | |
| 100 | // WithTimeout adds the timeout to the secrets secret roles list params |
| 101 | func (o *SecretsSecretRolesListParams) WithTimeout(timeout time.Duration) *SecretsSecretRolesListParams { |
| 102 | o.SetTimeout(timeout) |
| 103 | return o |
| 104 | } |
| 105 | |
| 106 | // SetTimeout adds the timeout to the secrets secret roles list params |
| 107 | func (o *SecretsSecretRolesListParams) SetTimeout(timeout time.Duration) { |
| 108 | o.timeout = timeout |
| 109 | } |
| 110 | |
| 111 | // WithContext adds the context to the secrets secret roles list params |
| 112 | func (o *SecretsSecretRolesListParams) WithContext(ctx context.Context) *SecretsSecretRolesListParams { |
| 113 | o.SetContext(ctx) |
| 114 | return o |
| 115 | } |
| 116 | |
| 117 | // SetContext adds the context to the secrets secret roles list params |
| 118 | func (o *SecretsSecretRolesListParams) SetContext(ctx context.Context) { |
| 119 | o.Context = ctx |
| 120 | } |
| 121 | |
| 122 | // WithHTTPClient adds the HTTPClient to the secrets secret roles list params |
| 123 | func (o *SecretsSecretRolesListParams) WithHTTPClient(client *http.Client) *SecretsSecretRolesListParams { |
| 124 | o.SetHTTPClient(client) |
| 125 | return o |
| 126 | } |
| 127 | |
| 128 | // SetHTTPClient adds the HTTPClient to the secrets secret roles list params |
| 129 | func (o *SecretsSecretRolesListParams) SetHTTPClient(client *http.Client) { |
| 130 | o.HTTPClient = client |
| 131 | } |
| 132 | |
| 133 | // WithLimit adds the limit to the secrets secret roles list params |
| 134 | func (o *SecretsSecretRolesListParams) WithLimit(limit *int64) *SecretsSecretRolesListParams { |
| 135 | o.SetLimit(limit) |
| 136 | return o |
| 137 | } |
| 138 | |
| 139 | // SetLimit adds the limit to the secrets secret roles list params |
| 140 | func (o *SecretsSecretRolesListParams) SetLimit(limit *int64) { |
| 141 | o.Limit = limit |
| 142 | } |
| 143 | |
| 144 | // WithName adds the name to the secrets secret roles list params |
| 145 | func (o *SecretsSecretRolesListParams) WithName(name *string) *SecretsSecretRolesListParams { |
| 146 | o.SetName(name) |
| 147 | return o |
| 148 | } |
| 149 | |
| 150 | // SetName adds the name to the secrets secret roles list params |
| 151 | func (o *SecretsSecretRolesListParams) SetName(name *string) { |
| 152 | o.Name = name |
| 153 | } |
| 154 | |
| 155 | // WithOffset adds the offset to the secrets secret roles list params |
| 156 | func (o *SecretsSecretRolesListParams) WithOffset(offset *int64) *SecretsSecretRolesListParams { |
| 157 | o.SetOffset(offset) |
| 158 | return o |
| 159 | } |
| 160 | |
| 161 | // SetOffset adds the offset to the secrets secret roles list params |
| 162 | func (o *SecretsSecretRolesListParams) SetOffset(offset *int64) { |
| 163 | o.Offset = offset |
| 164 | } |
| 165 | |
| 166 | // WithSlug adds the slug to the secrets secret roles list params |
| 167 | func (o *SecretsSecretRolesListParams) WithSlug(slug *string) *SecretsSecretRolesListParams { |
| 168 | o.SetSlug(slug) |
| 169 | return o |
| 170 | } |
| 171 | |
| 172 | // SetSlug adds the slug to the secrets secret roles list params |
| 173 | func (o *SecretsSecretRolesListParams) SetSlug(slug *string) { |
| 174 | o.Slug = slug |
| 175 | } |
| 176 | |
| 177 | // WriteToRequest writes these params to a swagger request |
| 178 | func (o *SecretsSecretRolesListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { |
| 179 | |
| 180 | if err := r.SetTimeout(o.timeout); err != nil { |
| 181 | return err |
| 182 | } |
| 183 | var res []error |
| 184 | |
| 185 | if o.Limit != nil { |
| 186 | |
| 187 | // query param limit |
| 188 | var qrLimit int64 |
| 189 | if o.Limit != nil { |
| 190 | qrLimit = *o.Limit |
| 191 | } |
| 192 | qLimit := swag.FormatInt64(qrLimit) |
| 193 | if qLimit != "" { |
| 194 | if err := r.SetQueryParam("limit", qLimit); err != nil { |
| 195 | return err |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | } |
| 200 | |
| 201 | if o.Name != nil { |
| 202 | |
| 203 | // query param name |
| 204 | var qrName string |
| 205 | if o.Name != nil { |
| 206 | qrName = *o.Name |
| 207 | } |
| 208 | qName := qrName |
| 209 | if qName != "" { |
| 210 | if err := r.SetQueryParam("name", qName); err != nil { |
| 211 | return err |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | } |
| 216 | |
| 217 | if o.Offset != nil { |
| 218 | |
| 219 | // query param offset |
| 220 | var qrOffset int64 |
| 221 | if o.Offset != nil { |
| 222 | qrOffset = *o.Offset |
| 223 | } |
| 224 | qOffset := swag.FormatInt64(qrOffset) |
| 225 | if qOffset != "" { |
| 226 | if err := r.SetQueryParam("offset", qOffset); err != nil { |
| 227 | return err |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | } |
| 232 | |
| 233 | if o.Slug != nil { |
| 234 | |
| 235 | // query param slug |
| 236 | var qrSlug string |
| 237 | if o.Slug != nil { |
| 238 | qrSlug = *o.Slug |
| 239 | } |
| 240 | qSlug := qrSlug |
| 241 | if qSlug != "" { |
| 242 | if err := r.SetQueryParam("slug", qSlug); err != nil { |
| 243 | return err |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | } |
| 248 | |
| 249 | if len(res) > 0 { |
| 250 | return errors.CompositeValidationError(res...) |
| 251 | } |
| 252 | return nil |
| 253 | } |