github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/edit_user_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package users 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 "net/http" 11 "time" 12 13 "github.com/go-openapi/errors" 14 "github.com/go-openapi/runtime" 15 cr "github.com/go-openapi/runtime/client" 16 "github.com/go-openapi/strfmt" 17 18 "github.com/ActiveState/cli/pkg/platform/api/mono/mono_models" 19 ) 20 21 // NewEditUserParams creates a new EditUserParams object, 22 // with the default timeout for this client. 23 // 24 // Default values are not hydrated, since defaults are normally applied by the API server side. 25 // 26 // To enforce default values in parameter, use SetDefaults or WithDefaults. 27 func NewEditUserParams() *EditUserParams { 28 return &EditUserParams{ 29 timeout: cr.DefaultTimeout, 30 } 31 } 32 33 // NewEditUserParamsWithTimeout creates a new EditUserParams object 34 // with the ability to set a timeout on a request. 35 func NewEditUserParamsWithTimeout(timeout time.Duration) *EditUserParams { 36 return &EditUserParams{ 37 timeout: timeout, 38 } 39 } 40 41 // NewEditUserParamsWithContext creates a new EditUserParams object 42 // with the ability to set a context for a request. 43 func NewEditUserParamsWithContext(ctx context.Context) *EditUserParams { 44 return &EditUserParams{ 45 Context: ctx, 46 } 47 } 48 49 // NewEditUserParamsWithHTTPClient creates a new EditUserParams object 50 // with the ability to set a custom HTTPClient for a request. 51 func NewEditUserParamsWithHTTPClient(client *http.Client) *EditUserParams { 52 return &EditUserParams{ 53 HTTPClient: client, 54 } 55 } 56 57 /* EditUserParams contains all the parameters to send to the API endpoint 58 for the edit user operation. 59 60 Typically these are written to a http.Request. 61 */ 62 type EditUserParams struct { 63 64 // User. 65 User *mono_models.UserEditable 66 67 /* Username. 68 69 username of desired User 70 */ 71 Username string 72 73 timeout time.Duration 74 Context context.Context 75 HTTPClient *http.Client 76 } 77 78 // WithDefaults hydrates default values in the edit user params (not the query body). 79 // 80 // All values with no default are reset to their zero value. 81 func (o *EditUserParams) WithDefaults() *EditUserParams { 82 o.SetDefaults() 83 return o 84 } 85 86 // SetDefaults hydrates default values in the edit user params (not the query body). 87 // 88 // All values with no default are reset to their zero value. 89 func (o *EditUserParams) SetDefaults() { 90 // no default values defined for this parameter 91 } 92 93 // WithTimeout adds the timeout to the edit user params 94 func (o *EditUserParams) WithTimeout(timeout time.Duration) *EditUserParams { 95 o.SetTimeout(timeout) 96 return o 97 } 98 99 // SetTimeout adds the timeout to the edit user params 100 func (o *EditUserParams) SetTimeout(timeout time.Duration) { 101 o.timeout = timeout 102 } 103 104 // WithContext adds the context to the edit user params 105 func (o *EditUserParams) WithContext(ctx context.Context) *EditUserParams { 106 o.SetContext(ctx) 107 return o 108 } 109 110 // SetContext adds the context to the edit user params 111 func (o *EditUserParams) SetContext(ctx context.Context) { 112 o.Context = ctx 113 } 114 115 // WithHTTPClient adds the HTTPClient to the edit user params 116 func (o *EditUserParams) WithHTTPClient(client *http.Client) *EditUserParams { 117 o.SetHTTPClient(client) 118 return o 119 } 120 121 // SetHTTPClient adds the HTTPClient to the edit user params 122 func (o *EditUserParams) SetHTTPClient(client *http.Client) { 123 o.HTTPClient = client 124 } 125 126 // WithUser adds the user to the edit user params 127 func (o *EditUserParams) WithUser(user *mono_models.UserEditable) *EditUserParams { 128 o.SetUser(user) 129 return o 130 } 131 132 // SetUser adds the user to the edit user params 133 func (o *EditUserParams) SetUser(user *mono_models.UserEditable) { 134 o.User = user 135 } 136 137 // WithUsername adds the username to the edit user params 138 func (o *EditUserParams) WithUsername(username string) *EditUserParams { 139 o.SetUsername(username) 140 return o 141 } 142 143 // SetUsername adds the username to the edit user params 144 func (o *EditUserParams) SetUsername(username string) { 145 o.Username = username 146 } 147 148 // WriteToRequest writes these params to a swagger request 149 func (o *EditUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 150 151 if err := r.SetTimeout(o.timeout); err != nil { 152 return err 153 } 154 var res []error 155 if o.User != nil { 156 if err := r.SetBodyParam(o.User); err != nil { 157 return err 158 } 159 } 160 161 // path param username 162 if err := r.SetPathParam("username", o.Username); err != nil { 163 return err 164 } 165 166 if len(res) > 0 { 167 return errors.CompositeValidationError(res...) 168 } 169 return nil 170 }