github.com/digitalocean/go-netbox@v0.0.2/netbox/client/users/users_permissions_update_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright 2020 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 18 package users 19 20 // This file was generated by the swagger tool. 21 // Editing this file might prove futile when you re-run the swagger generate command 22 23 import ( 24 "context" 25 "net/http" 26 "time" 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/strfmt" 32 "github.com/go-openapi/swag" 33 34 "github.com/digitalocean/go-netbox/netbox/models" 35 ) 36 37 // NewUsersPermissionsUpdateParams creates a new UsersPermissionsUpdateParams object, 38 // with the default timeout for this client. 39 // 40 // Default values are not hydrated, since defaults are normally applied by the API server side. 41 // 42 // To enforce default values in parameter, use SetDefaults or WithDefaults. 43 func NewUsersPermissionsUpdateParams() *UsersPermissionsUpdateParams { 44 return &UsersPermissionsUpdateParams{ 45 timeout: cr.DefaultTimeout, 46 } 47 } 48 49 // NewUsersPermissionsUpdateParamsWithTimeout creates a new UsersPermissionsUpdateParams object 50 // with the ability to set a timeout on a request. 51 func NewUsersPermissionsUpdateParamsWithTimeout(timeout time.Duration) *UsersPermissionsUpdateParams { 52 return &UsersPermissionsUpdateParams{ 53 timeout: timeout, 54 } 55 } 56 57 // NewUsersPermissionsUpdateParamsWithContext creates a new UsersPermissionsUpdateParams object 58 // with the ability to set a context for a request. 59 func NewUsersPermissionsUpdateParamsWithContext(ctx context.Context) *UsersPermissionsUpdateParams { 60 return &UsersPermissionsUpdateParams{ 61 Context: ctx, 62 } 63 } 64 65 // NewUsersPermissionsUpdateParamsWithHTTPClient creates a new UsersPermissionsUpdateParams object 66 // with the ability to set a custom HTTPClient for a request. 67 func NewUsersPermissionsUpdateParamsWithHTTPClient(client *http.Client) *UsersPermissionsUpdateParams { 68 return &UsersPermissionsUpdateParams{ 69 HTTPClient: client, 70 } 71 } 72 73 /* UsersPermissionsUpdateParams contains all the parameters to send to the API endpoint 74 for the users permissions update operation. 75 76 Typically these are written to a http.Request. 77 */ 78 type UsersPermissionsUpdateParams struct { 79 80 // Data. 81 Data *models.WritableObjectPermission 82 83 /* ID. 84 85 A unique integer value identifying this permission. 86 */ 87 ID int64 88 89 timeout time.Duration 90 Context context.Context 91 HTTPClient *http.Client 92 } 93 94 // WithDefaults hydrates default values in the users permissions update params (not the query body). 95 // 96 // All values with no default are reset to their zero value. 97 func (o *UsersPermissionsUpdateParams) WithDefaults() *UsersPermissionsUpdateParams { 98 o.SetDefaults() 99 return o 100 } 101 102 // SetDefaults hydrates default values in the users permissions update params (not the query body). 103 // 104 // All values with no default are reset to their zero value. 105 func (o *UsersPermissionsUpdateParams) SetDefaults() { 106 // no default values defined for this parameter 107 } 108 109 // WithTimeout adds the timeout to the users permissions update params 110 func (o *UsersPermissionsUpdateParams) WithTimeout(timeout time.Duration) *UsersPermissionsUpdateParams { 111 o.SetTimeout(timeout) 112 return o 113 } 114 115 // SetTimeout adds the timeout to the users permissions update params 116 func (o *UsersPermissionsUpdateParams) SetTimeout(timeout time.Duration) { 117 o.timeout = timeout 118 } 119 120 // WithContext adds the context to the users permissions update params 121 func (o *UsersPermissionsUpdateParams) WithContext(ctx context.Context) *UsersPermissionsUpdateParams { 122 o.SetContext(ctx) 123 return o 124 } 125 126 // SetContext adds the context to the users permissions update params 127 func (o *UsersPermissionsUpdateParams) SetContext(ctx context.Context) { 128 o.Context = ctx 129 } 130 131 // WithHTTPClient adds the HTTPClient to the users permissions update params 132 func (o *UsersPermissionsUpdateParams) WithHTTPClient(client *http.Client) *UsersPermissionsUpdateParams { 133 o.SetHTTPClient(client) 134 return o 135 } 136 137 // SetHTTPClient adds the HTTPClient to the users permissions update params 138 func (o *UsersPermissionsUpdateParams) SetHTTPClient(client *http.Client) { 139 o.HTTPClient = client 140 } 141 142 // WithData adds the data to the users permissions update params 143 func (o *UsersPermissionsUpdateParams) WithData(data *models.WritableObjectPermission) *UsersPermissionsUpdateParams { 144 o.SetData(data) 145 return o 146 } 147 148 // SetData adds the data to the users permissions update params 149 func (o *UsersPermissionsUpdateParams) SetData(data *models.WritableObjectPermission) { 150 o.Data = data 151 } 152 153 // WithID adds the id to the users permissions update params 154 func (o *UsersPermissionsUpdateParams) WithID(id int64) *UsersPermissionsUpdateParams { 155 o.SetID(id) 156 return o 157 } 158 159 // SetID adds the id to the users permissions update params 160 func (o *UsersPermissionsUpdateParams) SetID(id int64) { 161 o.ID = id 162 } 163 164 // WriteToRequest writes these params to a swagger request 165 func (o *UsersPermissionsUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 166 167 if err := r.SetTimeout(o.timeout); err != nil { 168 return err 169 } 170 var res []error 171 if o.Data != nil { 172 if err := r.SetBodyParam(o.Data); err != nil { 173 return err 174 } 175 } 176 177 // path param id 178 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 179 return err 180 } 181 182 if len(res) > 0 { 183 return errors.CompositeValidationError(res...) 184 } 185 return nil 186 }