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