github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/user/get_current_user_permissions_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package user 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 20 // NewGetCurrentUserPermissionsParams creates a new GetCurrentUserPermissionsParams object, 21 // with the default timeout for this client. 22 // 23 // Default values are not hydrated, since defaults are normally applied by the API server side. 24 // 25 // To enforce default values in parameter, use SetDefaults or WithDefaults. 26 func NewGetCurrentUserPermissionsParams() *GetCurrentUserPermissionsParams { 27 return &GetCurrentUserPermissionsParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewGetCurrentUserPermissionsParamsWithTimeout creates a new GetCurrentUserPermissionsParams object 33 // with the ability to set a timeout on a request. 34 func NewGetCurrentUserPermissionsParamsWithTimeout(timeout time.Duration) *GetCurrentUserPermissionsParams { 35 return &GetCurrentUserPermissionsParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewGetCurrentUserPermissionsParamsWithContext creates a new GetCurrentUserPermissionsParams object 41 // with the ability to set a context for a request. 42 func NewGetCurrentUserPermissionsParamsWithContext(ctx context.Context) *GetCurrentUserPermissionsParams { 43 return &GetCurrentUserPermissionsParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewGetCurrentUserPermissionsParamsWithHTTPClient creates a new GetCurrentUserPermissionsParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewGetCurrentUserPermissionsParamsWithHTTPClient(client *http.Client) *GetCurrentUserPermissionsParams { 51 return &GetCurrentUserPermissionsParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 GetCurrentUserPermissionsParams contains all the parameters to send to the API endpoint 58 59 for the get current user permissions operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type GetCurrentUserPermissionsParams struct { 64 65 /* XRequestID. 66 67 An unique ID for the request 68 */ 69 XRequestID *string 70 71 /* Relative. 72 73 If true, the resources in the response are relative to the scope, 74 eg for resource '/project/1/repository' if relative is 'true' then the resource in response will be 'repository'. 75 76 */ 77 Relative *bool 78 79 /* Scope. 80 81 The scope for the permission 82 */ 83 Scope *string 84 85 timeout time.Duration 86 Context context.Context 87 HTTPClient *http.Client 88 } 89 90 // WithDefaults hydrates default values in the get current user permissions params (not the query body). 91 // 92 // All values with no default are reset to their zero value. 93 func (o *GetCurrentUserPermissionsParams) WithDefaults() *GetCurrentUserPermissionsParams { 94 o.SetDefaults() 95 return o 96 } 97 98 // SetDefaults hydrates default values in the get current user permissions params (not the query body). 99 // 100 // All values with no default are reset to their zero value. 101 func (o *GetCurrentUserPermissionsParams) SetDefaults() { 102 // no default values defined for this parameter 103 } 104 105 // WithTimeout adds the timeout to the get current user permissions params 106 func (o *GetCurrentUserPermissionsParams) WithTimeout(timeout time.Duration) *GetCurrentUserPermissionsParams { 107 o.SetTimeout(timeout) 108 return o 109 } 110 111 // SetTimeout adds the timeout to the get current user permissions params 112 func (o *GetCurrentUserPermissionsParams) SetTimeout(timeout time.Duration) { 113 o.timeout = timeout 114 } 115 116 // WithContext adds the context to the get current user permissions params 117 func (o *GetCurrentUserPermissionsParams) WithContext(ctx context.Context) *GetCurrentUserPermissionsParams { 118 o.SetContext(ctx) 119 return o 120 } 121 122 // SetContext adds the context to the get current user permissions params 123 func (o *GetCurrentUserPermissionsParams) SetContext(ctx context.Context) { 124 o.Context = ctx 125 } 126 127 // WithHTTPClient adds the HTTPClient to the get current user permissions params 128 func (o *GetCurrentUserPermissionsParams) WithHTTPClient(client *http.Client) *GetCurrentUserPermissionsParams { 129 o.SetHTTPClient(client) 130 return o 131 } 132 133 // SetHTTPClient adds the HTTPClient to the get current user permissions params 134 func (o *GetCurrentUserPermissionsParams) SetHTTPClient(client *http.Client) { 135 o.HTTPClient = client 136 } 137 138 // WithXRequestID adds the xRequestID to the get current user permissions params 139 func (o *GetCurrentUserPermissionsParams) WithXRequestID(xRequestID *string) *GetCurrentUserPermissionsParams { 140 o.SetXRequestID(xRequestID) 141 return o 142 } 143 144 // SetXRequestID adds the xRequestId to the get current user permissions params 145 func (o *GetCurrentUserPermissionsParams) SetXRequestID(xRequestID *string) { 146 o.XRequestID = xRequestID 147 } 148 149 // WithRelative adds the relative to the get current user permissions params 150 func (o *GetCurrentUserPermissionsParams) WithRelative(relative *bool) *GetCurrentUserPermissionsParams { 151 o.SetRelative(relative) 152 return o 153 } 154 155 // SetRelative adds the relative to the get current user permissions params 156 func (o *GetCurrentUserPermissionsParams) SetRelative(relative *bool) { 157 o.Relative = relative 158 } 159 160 // WithScope adds the scope to the get current user permissions params 161 func (o *GetCurrentUserPermissionsParams) WithScope(scope *string) *GetCurrentUserPermissionsParams { 162 o.SetScope(scope) 163 return o 164 } 165 166 // SetScope adds the scope to the get current user permissions params 167 func (o *GetCurrentUserPermissionsParams) SetScope(scope *string) { 168 o.Scope = scope 169 } 170 171 // WriteToRequest writes these params to a swagger request 172 func (o *GetCurrentUserPermissionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 173 174 if err := r.SetTimeout(o.timeout); err != nil { 175 return err 176 } 177 var res []error 178 179 if o.XRequestID != nil { 180 181 // header param X-Request-Id 182 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 183 return err 184 } 185 } 186 187 if o.Relative != nil { 188 189 // query param relative 190 var qrRelative bool 191 192 if o.Relative != nil { 193 qrRelative = *o.Relative 194 } 195 qRelative := swag.FormatBool(qrRelative) 196 if qRelative != "" { 197 198 if err := r.SetQueryParam("relative", qRelative); err != nil { 199 return err 200 } 201 } 202 } 203 204 if o.Scope != nil { 205 206 // query param scope 207 var qrScope string 208 209 if o.Scope != nil { 210 qrScope = *o.Scope 211 } 212 qScope := qrScope 213 if qScope != "" { 214 215 if err := r.SetQueryParam("scope", qScope); err != nil { 216 return err 217 } 218 } 219 } 220 221 if len(res) > 0 { 222 return errors.CompositeValidationError(res...) 223 } 224 return nil 225 }