github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/preheat/list_tasks_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package preheat 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 // NewListTasksParams creates a new ListTasksParams 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 NewListTasksParams() *ListTasksParams { 27 return &ListTasksParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewListTasksParamsWithTimeout creates a new ListTasksParams object 33 // with the ability to set a timeout on a request. 34 func NewListTasksParamsWithTimeout(timeout time.Duration) *ListTasksParams { 35 return &ListTasksParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewListTasksParamsWithContext creates a new ListTasksParams object 41 // with the ability to set a context for a request. 42 func NewListTasksParamsWithContext(ctx context.Context) *ListTasksParams { 43 return &ListTasksParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewListTasksParamsWithHTTPClient creates a new ListTasksParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewListTasksParamsWithHTTPClient(client *http.Client) *ListTasksParams { 51 return &ListTasksParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 ListTasksParams contains all the parameters to send to the API endpoint 58 59 for the list tasks operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type ListTasksParams struct { 64 65 /* XRequestID. 66 67 An unique ID for the request 68 */ 69 XRequestID *string 70 71 /* ExecutionID. 72 73 Execution ID 74 */ 75 ExecutionID int64 76 77 /* Page. 78 79 The page number 80 81 Format: int64 82 Default: 1 83 */ 84 Page *int64 85 86 /* PageSize. 87 88 The size of per page 89 90 Format: int64 91 Default: 10 92 */ 93 PageSize *int64 94 95 /* PreheatPolicyName. 96 97 Preheat Policy Name 98 */ 99 PreheatPolicyName string 100 101 /* ProjectName. 102 103 The name of the project 104 */ 105 ProjectName string 106 107 /* Q. 108 109 Query string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max] 110 */ 111 Q *string 112 113 /* Sort. 114 115 Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending order and field2 in descending order with "sort=field1,-field2" 116 */ 117 Sort *string 118 119 timeout time.Duration 120 Context context.Context 121 HTTPClient *http.Client 122 } 123 124 // WithDefaults hydrates default values in the list tasks params (not the query body). 125 // 126 // All values with no default are reset to their zero value. 127 func (o *ListTasksParams) WithDefaults() *ListTasksParams { 128 o.SetDefaults() 129 return o 130 } 131 132 // SetDefaults hydrates default values in the list tasks params (not the query body). 133 // 134 // All values with no default are reset to their zero value. 135 func (o *ListTasksParams) SetDefaults() { 136 var ( 137 pageDefault = int64(1) 138 139 pageSizeDefault = int64(10) 140 ) 141 142 val := ListTasksParams{ 143 Page: &pageDefault, 144 PageSize: &pageSizeDefault, 145 } 146 147 val.timeout = o.timeout 148 val.Context = o.Context 149 val.HTTPClient = o.HTTPClient 150 *o = val 151 } 152 153 // WithTimeout adds the timeout to the list tasks params 154 func (o *ListTasksParams) WithTimeout(timeout time.Duration) *ListTasksParams { 155 o.SetTimeout(timeout) 156 return o 157 } 158 159 // SetTimeout adds the timeout to the list tasks params 160 func (o *ListTasksParams) SetTimeout(timeout time.Duration) { 161 o.timeout = timeout 162 } 163 164 // WithContext adds the context to the list tasks params 165 func (o *ListTasksParams) WithContext(ctx context.Context) *ListTasksParams { 166 o.SetContext(ctx) 167 return o 168 } 169 170 // SetContext adds the context to the list tasks params 171 func (o *ListTasksParams) SetContext(ctx context.Context) { 172 o.Context = ctx 173 } 174 175 // WithHTTPClient adds the HTTPClient to the list tasks params 176 func (o *ListTasksParams) WithHTTPClient(client *http.Client) *ListTasksParams { 177 o.SetHTTPClient(client) 178 return o 179 } 180 181 // SetHTTPClient adds the HTTPClient to the list tasks params 182 func (o *ListTasksParams) SetHTTPClient(client *http.Client) { 183 o.HTTPClient = client 184 } 185 186 // WithXRequestID adds the xRequestID to the list tasks params 187 func (o *ListTasksParams) WithXRequestID(xRequestID *string) *ListTasksParams { 188 o.SetXRequestID(xRequestID) 189 return o 190 } 191 192 // SetXRequestID adds the xRequestId to the list tasks params 193 func (o *ListTasksParams) SetXRequestID(xRequestID *string) { 194 o.XRequestID = xRequestID 195 } 196 197 // WithExecutionID adds the executionID to the list tasks params 198 func (o *ListTasksParams) WithExecutionID(executionID int64) *ListTasksParams { 199 o.SetExecutionID(executionID) 200 return o 201 } 202 203 // SetExecutionID adds the executionId to the list tasks params 204 func (o *ListTasksParams) SetExecutionID(executionID int64) { 205 o.ExecutionID = executionID 206 } 207 208 // WithPage adds the page to the list tasks params 209 func (o *ListTasksParams) WithPage(page *int64) *ListTasksParams { 210 o.SetPage(page) 211 return o 212 } 213 214 // SetPage adds the page to the list tasks params 215 func (o *ListTasksParams) SetPage(page *int64) { 216 o.Page = page 217 } 218 219 // WithPageSize adds the pageSize to the list tasks params 220 func (o *ListTasksParams) WithPageSize(pageSize *int64) *ListTasksParams { 221 o.SetPageSize(pageSize) 222 return o 223 } 224 225 // SetPageSize adds the pageSize to the list tasks params 226 func (o *ListTasksParams) SetPageSize(pageSize *int64) { 227 o.PageSize = pageSize 228 } 229 230 // WithPreheatPolicyName adds the preheatPolicyName to the list tasks params 231 func (o *ListTasksParams) WithPreheatPolicyName(preheatPolicyName string) *ListTasksParams { 232 o.SetPreheatPolicyName(preheatPolicyName) 233 return o 234 } 235 236 // SetPreheatPolicyName adds the preheatPolicyName to the list tasks params 237 func (o *ListTasksParams) SetPreheatPolicyName(preheatPolicyName string) { 238 o.PreheatPolicyName = preheatPolicyName 239 } 240 241 // WithProjectName adds the projectName to the list tasks params 242 func (o *ListTasksParams) WithProjectName(projectName string) *ListTasksParams { 243 o.SetProjectName(projectName) 244 return o 245 } 246 247 // SetProjectName adds the projectName to the list tasks params 248 func (o *ListTasksParams) SetProjectName(projectName string) { 249 o.ProjectName = projectName 250 } 251 252 // WithQ adds the q to the list tasks params 253 func (o *ListTasksParams) WithQ(q *string) *ListTasksParams { 254 o.SetQ(q) 255 return o 256 } 257 258 // SetQ adds the q to the list tasks params 259 func (o *ListTasksParams) SetQ(q *string) { 260 o.Q = q 261 } 262 263 // WithSort adds the sort to the list tasks params 264 func (o *ListTasksParams) WithSort(sort *string) *ListTasksParams { 265 o.SetSort(sort) 266 return o 267 } 268 269 // SetSort adds the sort to the list tasks params 270 func (o *ListTasksParams) SetSort(sort *string) { 271 o.Sort = sort 272 } 273 274 // WriteToRequest writes these params to a swagger request 275 func (o *ListTasksParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 276 277 if err := r.SetTimeout(o.timeout); err != nil { 278 return err 279 } 280 var res []error 281 282 if o.XRequestID != nil { 283 284 // header param X-Request-Id 285 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 286 return err 287 } 288 } 289 290 // path param execution_id 291 if err := r.SetPathParam("execution_id", swag.FormatInt64(o.ExecutionID)); err != nil { 292 return err 293 } 294 295 if o.Page != nil { 296 297 // query param page 298 var qrPage int64 299 300 if o.Page != nil { 301 qrPage = *o.Page 302 } 303 qPage := swag.FormatInt64(qrPage) 304 if qPage != "" { 305 306 if err := r.SetQueryParam("page", qPage); err != nil { 307 return err 308 } 309 } 310 } 311 312 if o.PageSize != nil { 313 314 // query param page_size 315 var qrPageSize int64 316 317 if o.PageSize != nil { 318 qrPageSize = *o.PageSize 319 } 320 qPageSize := swag.FormatInt64(qrPageSize) 321 if qPageSize != "" { 322 323 if err := r.SetQueryParam("page_size", qPageSize); err != nil { 324 return err 325 } 326 } 327 } 328 329 // path param preheat_policy_name 330 if err := r.SetPathParam("preheat_policy_name", o.PreheatPolicyName); err != nil { 331 return err 332 } 333 334 // path param project_name 335 if err := r.SetPathParam("project_name", o.ProjectName); err != nil { 336 return err 337 } 338 339 if o.Q != nil { 340 341 // query param q 342 var qrQ string 343 344 if o.Q != nil { 345 qrQ = *o.Q 346 } 347 qQ := qrQ 348 if qQ != "" { 349 350 if err := r.SetQueryParam("q", qQ); err != nil { 351 return err 352 } 353 } 354 } 355 356 if o.Sort != nil { 357 358 // query param sort 359 var qrSort string 360 361 if o.Sort != nil { 362 qrSort = *o.Sort 363 } 364 qSort := qrSort 365 if qSort != "" { 366 367 if err := r.SetQueryParam("sort", qSort); err != nil { 368 return err 369 } 370 } 371 } 372 373 if len(res) > 0 { 374 return errors.CompositeValidationError(res...) 375 } 376 return nil 377 }