github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/member/update_project_member_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package member 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 "github.com/go-openapi/swag" 18 19 "github.com/goharbor/go-client/pkg/sdk/v2.0/models" 20 ) 21 22 // NewUpdateProjectMemberParams creates a new UpdateProjectMemberParams object, 23 // with the default timeout for this client. 24 // 25 // Default values are not hydrated, since defaults are normally applied by the API server side. 26 // 27 // To enforce default values in parameter, use SetDefaults or WithDefaults. 28 func NewUpdateProjectMemberParams() *UpdateProjectMemberParams { 29 return &UpdateProjectMemberParams{ 30 timeout: cr.DefaultTimeout, 31 } 32 } 33 34 // NewUpdateProjectMemberParamsWithTimeout creates a new UpdateProjectMemberParams object 35 // with the ability to set a timeout on a request. 36 func NewUpdateProjectMemberParamsWithTimeout(timeout time.Duration) *UpdateProjectMemberParams { 37 return &UpdateProjectMemberParams{ 38 timeout: timeout, 39 } 40 } 41 42 // NewUpdateProjectMemberParamsWithContext creates a new UpdateProjectMemberParams object 43 // with the ability to set a context for a request. 44 func NewUpdateProjectMemberParamsWithContext(ctx context.Context) *UpdateProjectMemberParams { 45 return &UpdateProjectMemberParams{ 46 Context: ctx, 47 } 48 } 49 50 // NewUpdateProjectMemberParamsWithHTTPClient creates a new UpdateProjectMemberParams object 51 // with the ability to set a custom HTTPClient for a request. 52 func NewUpdateProjectMemberParamsWithHTTPClient(client *http.Client) *UpdateProjectMemberParams { 53 return &UpdateProjectMemberParams{ 54 HTTPClient: client, 55 } 56 } 57 58 /* 59 UpdateProjectMemberParams contains all the parameters to send to the API endpoint 60 61 for the update project member operation. 62 63 Typically these are written to a http.Request. 64 */ 65 type UpdateProjectMemberParams struct { 66 67 /* XIsResourceName. 68 69 The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. 70 */ 71 XIsResourceName *bool 72 73 /* XRequestID. 74 75 An unique ID for the request 76 */ 77 XRequestID *string 78 79 /* Mid. 80 81 Member ID. 82 83 Format: int64 84 */ 85 Mid int64 86 87 /* ProjectNameOrID. 88 89 The name or id of the project 90 */ 91 ProjectNameOrID string 92 93 // Role. 94 Role *models.RoleRequest 95 96 timeout time.Duration 97 Context context.Context 98 HTTPClient *http.Client 99 } 100 101 // WithDefaults hydrates default values in the update project member params (not the query body). 102 // 103 // All values with no default are reset to their zero value. 104 func (o *UpdateProjectMemberParams) WithDefaults() *UpdateProjectMemberParams { 105 o.SetDefaults() 106 return o 107 } 108 109 // SetDefaults hydrates default values in the update project member params (not the query body). 110 // 111 // All values with no default are reset to their zero value. 112 func (o *UpdateProjectMemberParams) SetDefaults() { 113 var ( 114 xIsResourceNameDefault = bool(false) 115 ) 116 117 val := UpdateProjectMemberParams{ 118 XIsResourceName: &xIsResourceNameDefault, 119 } 120 121 val.timeout = o.timeout 122 val.Context = o.Context 123 val.HTTPClient = o.HTTPClient 124 *o = val 125 } 126 127 // WithTimeout adds the timeout to the update project member params 128 func (o *UpdateProjectMemberParams) WithTimeout(timeout time.Duration) *UpdateProjectMemberParams { 129 o.SetTimeout(timeout) 130 return o 131 } 132 133 // SetTimeout adds the timeout to the update project member params 134 func (o *UpdateProjectMemberParams) SetTimeout(timeout time.Duration) { 135 o.timeout = timeout 136 } 137 138 // WithContext adds the context to the update project member params 139 func (o *UpdateProjectMemberParams) WithContext(ctx context.Context) *UpdateProjectMemberParams { 140 o.SetContext(ctx) 141 return o 142 } 143 144 // SetContext adds the context to the update project member params 145 func (o *UpdateProjectMemberParams) SetContext(ctx context.Context) { 146 o.Context = ctx 147 } 148 149 // WithHTTPClient adds the HTTPClient to the update project member params 150 func (o *UpdateProjectMemberParams) WithHTTPClient(client *http.Client) *UpdateProjectMemberParams { 151 o.SetHTTPClient(client) 152 return o 153 } 154 155 // SetHTTPClient adds the HTTPClient to the update project member params 156 func (o *UpdateProjectMemberParams) SetHTTPClient(client *http.Client) { 157 o.HTTPClient = client 158 } 159 160 // WithXIsResourceName adds the xIsResourceName to the update project member params 161 func (o *UpdateProjectMemberParams) WithXIsResourceName(xIsResourceName *bool) *UpdateProjectMemberParams { 162 o.SetXIsResourceName(xIsResourceName) 163 return o 164 } 165 166 // SetXIsResourceName adds the xIsResourceName to the update project member params 167 func (o *UpdateProjectMemberParams) SetXIsResourceName(xIsResourceName *bool) { 168 o.XIsResourceName = xIsResourceName 169 } 170 171 // WithXRequestID adds the xRequestID to the update project member params 172 func (o *UpdateProjectMemberParams) WithXRequestID(xRequestID *string) *UpdateProjectMemberParams { 173 o.SetXRequestID(xRequestID) 174 return o 175 } 176 177 // SetXRequestID adds the xRequestId to the update project member params 178 func (o *UpdateProjectMemberParams) SetXRequestID(xRequestID *string) { 179 o.XRequestID = xRequestID 180 } 181 182 // WithMid adds the mid to the update project member params 183 func (o *UpdateProjectMemberParams) WithMid(mid int64) *UpdateProjectMemberParams { 184 o.SetMid(mid) 185 return o 186 } 187 188 // SetMid adds the mid to the update project member params 189 func (o *UpdateProjectMemberParams) SetMid(mid int64) { 190 o.Mid = mid 191 } 192 193 // WithProjectNameOrID adds the projectNameOrID to the update project member params 194 func (o *UpdateProjectMemberParams) WithProjectNameOrID(projectNameOrID string) *UpdateProjectMemberParams { 195 o.SetProjectNameOrID(projectNameOrID) 196 return o 197 } 198 199 // SetProjectNameOrID adds the projectNameOrId to the update project member params 200 func (o *UpdateProjectMemberParams) SetProjectNameOrID(projectNameOrID string) { 201 o.ProjectNameOrID = projectNameOrID 202 } 203 204 // WithRole adds the role to the update project member params 205 func (o *UpdateProjectMemberParams) WithRole(role *models.RoleRequest) *UpdateProjectMemberParams { 206 o.SetRole(role) 207 return o 208 } 209 210 // SetRole adds the role to the update project member params 211 func (o *UpdateProjectMemberParams) SetRole(role *models.RoleRequest) { 212 o.Role = role 213 } 214 215 // WriteToRequest writes these params to a swagger request 216 func (o *UpdateProjectMemberParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 217 218 if err := r.SetTimeout(o.timeout); err != nil { 219 return err 220 } 221 var res []error 222 223 if o.XIsResourceName != nil { 224 225 // header param X-Is-Resource-Name 226 if err := r.SetHeaderParam("X-Is-Resource-Name", swag.FormatBool(*o.XIsResourceName)); err != nil { 227 return err 228 } 229 } 230 231 if o.XRequestID != nil { 232 233 // header param X-Request-Id 234 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 235 return err 236 } 237 } 238 239 // path param mid 240 if err := r.SetPathParam("mid", swag.FormatInt64(o.Mid)); err != nil { 241 return err 242 } 243 244 // path param project_name_or_id 245 if err := r.SetPathParam("project_name_or_id", o.ProjectNameOrID); err != nil { 246 return err 247 } 248 if o.Role != nil { 249 if err := r.SetBodyParam(o.Role); err != nil { 250 return err 251 } 252 } 253 254 if len(res) > 0 { 255 return errors.CompositeValidationError(res...) 256 } 257 return nil 258 }