github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/securityhub/list_vulnerabilities_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package securityhub 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 // NewListVulnerabilitiesParams creates a new ListVulnerabilitiesParams 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 NewListVulnerabilitiesParams() *ListVulnerabilitiesParams { 27 return &ListVulnerabilitiesParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewListVulnerabilitiesParamsWithTimeout creates a new ListVulnerabilitiesParams object 33 // with the ability to set a timeout on a request. 34 func NewListVulnerabilitiesParamsWithTimeout(timeout time.Duration) *ListVulnerabilitiesParams { 35 return &ListVulnerabilitiesParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewListVulnerabilitiesParamsWithContext creates a new ListVulnerabilitiesParams object 41 // with the ability to set a context for a request. 42 func NewListVulnerabilitiesParamsWithContext(ctx context.Context) *ListVulnerabilitiesParams { 43 return &ListVulnerabilitiesParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewListVulnerabilitiesParamsWithHTTPClient creates a new ListVulnerabilitiesParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewListVulnerabilitiesParamsWithHTTPClient(client *http.Client) *ListVulnerabilitiesParams { 51 return &ListVulnerabilitiesParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 ListVulnerabilitiesParams contains all the parameters to send to the API endpoint 58 59 for the list vulnerabilities operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type ListVulnerabilitiesParams 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 /* Q. 90 91 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] 92 */ 93 Q *string 94 95 /* TuneCount. 96 97 Enable to ignore X-Total-Count when the total count > 1000, if the total count is less than 1000, the real total count is returned, else -1. 98 */ 99 TuneCount *bool 100 101 /* WithTag. 102 103 Specify whether the tag information is included inside vulnerability information 104 */ 105 WithTag *bool 106 107 timeout time.Duration 108 Context context.Context 109 HTTPClient *http.Client 110 } 111 112 // WithDefaults hydrates default values in the list vulnerabilities params (not the query body). 113 // 114 // All values with no default are reset to their zero value. 115 func (o *ListVulnerabilitiesParams) WithDefaults() *ListVulnerabilitiesParams { 116 o.SetDefaults() 117 return o 118 } 119 120 // SetDefaults hydrates default values in the list vulnerabilities params (not the query body). 121 // 122 // All values with no default are reset to their zero value. 123 func (o *ListVulnerabilitiesParams) SetDefaults() { 124 var ( 125 pageDefault = int64(1) 126 127 pageSizeDefault = int64(10) 128 129 tuneCountDefault = bool(false) 130 131 withTagDefault = bool(false) 132 ) 133 134 val := ListVulnerabilitiesParams{ 135 Page: &pageDefault, 136 PageSize: &pageSizeDefault, 137 TuneCount: &tuneCountDefault, 138 WithTag: &withTagDefault, 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 vulnerabilities params 148 func (o *ListVulnerabilitiesParams) WithTimeout(timeout time.Duration) *ListVulnerabilitiesParams { 149 o.SetTimeout(timeout) 150 return o 151 } 152 153 // SetTimeout adds the timeout to the list vulnerabilities params 154 func (o *ListVulnerabilitiesParams) SetTimeout(timeout time.Duration) { 155 o.timeout = timeout 156 } 157 158 // WithContext adds the context to the list vulnerabilities params 159 func (o *ListVulnerabilitiesParams) WithContext(ctx context.Context) *ListVulnerabilitiesParams { 160 o.SetContext(ctx) 161 return o 162 } 163 164 // SetContext adds the context to the list vulnerabilities params 165 func (o *ListVulnerabilitiesParams) SetContext(ctx context.Context) { 166 o.Context = ctx 167 } 168 169 // WithHTTPClient adds the HTTPClient to the list vulnerabilities params 170 func (o *ListVulnerabilitiesParams) WithHTTPClient(client *http.Client) *ListVulnerabilitiesParams { 171 o.SetHTTPClient(client) 172 return o 173 } 174 175 // SetHTTPClient adds the HTTPClient to the list vulnerabilities params 176 func (o *ListVulnerabilitiesParams) SetHTTPClient(client *http.Client) { 177 o.HTTPClient = client 178 } 179 180 // WithXRequestID adds the xRequestID to the list vulnerabilities params 181 func (o *ListVulnerabilitiesParams) WithXRequestID(xRequestID *string) *ListVulnerabilitiesParams { 182 o.SetXRequestID(xRequestID) 183 return o 184 } 185 186 // SetXRequestID adds the xRequestId to the list vulnerabilities params 187 func (o *ListVulnerabilitiesParams) SetXRequestID(xRequestID *string) { 188 o.XRequestID = xRequestID 189 } 190 191 // WithPage adds the page to the list vulnerabilities params 192 func (o *ListVulnerabilitiesParams) WithPage(page *int64) *ListVulnerabilitiesParams { 193 o.SetPage(page) 194 return o 195 } 196 197 // SetPage adds the page to the list vulnerabilities params 198 func (o *ListVulnerabilitiesParams) SetPage(page *int64) { 199 o.Page = page 200 } 201 202 // WithPageSize adds the pageSize to the list vulnerabilities params 203 func (o *ListVulnerabilitiesParams) WithPageSize(pageSize *int64) *ListVulnerabilitiesParams { 204 o.SetPageSize(pageSize) 205 return o 206 } 207 208 // SetPageSize adds the pageSize to the list vulnerabilities params 209 func (o *ListVulnerabilitiesParams) SetPageSize(pageSize *int64) { 210 o.PageSize = pageSize 211 } 212 213 // WithQ adds the q to the list vulnerabilities params 214 func (o *ListVulnerabilitiesParams) WithQ(q *string) *ListVulnerabilitiesParams { 215 o.SetQ(q) 216 return o 217 } 218 219 // SetQ adds the q to the list vulnerabilities params 220 func (o *ListVulnerabilitiesParams) SetQ(q *string) { 221 o.Q = q 222 } 223 224 // WithTuneCount adds the tuneCount to the list vulnerabilities params 225 func (o *ListVulnerabilitiesParams) WithTuneCount(tuneCount *bool) *ListVulnerabilitiesParams { 226 o.SetTuneCount(tuneCount) 227 return o 228 } 229 230 // SetTuneCount adds the tuneCount to the list vulnerabilities params 231 func (o *ListVulnerabilitiesParams) SetTuneCount(tuneCount *bool) { 232 o.TuneCount = tuneCount 233 } 234 235 // WithWithTag adds the withTag to the list vulnerabilities params 236 func (o *ListVulnerabilitiesParams) WithWithTag(withTag *bool) *ListVulnerabilitiesParams { 237 o.SetWithTag(withTag) 238 return o 239 } 240 241 // SetWithTag adds the withTag to the list vulnerabilities params 242 func (o *ListVulnerabilitiesParams) SetWithTag(withTag *bool) { 243 o.WithTag = withTag 244 } 245 246 // WriteToRequest writes these params to a swagger request 247 func (o *ListVulnerabilitiesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 248 249 if err := r.SetTimeout(o.timeout); err != nil { 250 return err 251 } 252 var res []error 253 254 if o.XRequestID != nil { 255 256 // header param X-Request-Id 257 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 258 return err 259 } 260 } 261 262 if o.Page != nil { 263 264 // query param page 265 var qrPage int64 266 267 if o.Page != nil { 268 qrPage = *o.Page 269 } 270 qPage := swag.FormatInt64(qrPage) 271 if qPage != "" { 272 273 if err := r.SetQueryParam("page", qPage); err != nil { 274 return err 275 } 276 } 277 } 278 279 if o.PageSize != nil { 280 281 // query param page_size 282 var qrPageSize int64 283 284 if o.PageSize != nil { 285 qrPageSize = *o.PageSize 286 } 287 qPageSize := swag.FormatInt64(qrPageSize) 288 if qPageSize != "" { 289 290 if err := r.SetQueryParam("page_size", qPageSize); err != nil { 291 return err 292 } 293 } 294 } 295 296 if o.Q != nil { 297 298 // query param q 299 var qrQ string 300 301 if o.Q != nil { 302 qrQ = *o.Q 303 } 304 qQ := qrQ 305 if qQ != "" { 306 307 if err := r.SetQueryParam("q", qQ); err != nil { 308 return err 309 } 310 } 311 } 312 313 if o.TuneCount != nil { 314 315 // query param tune_count 316 var qrTuneCount bool 317 318 if o.TuneCount != nil { 319 qrTuneCount = *o.TuneCount 320 } 321 qTuneCount := swag.FormatBool(qrTuneCount) 322 if qTuneCount != "" { 323 324 if err := r.SetQueryParam("tune_count", qTuneCount); err != nil { 325 return err 326 } 327 } 328 } 329 330 if o.WithTag != nil { 331 332 // query param with_tag 333 var qrWithTag bool 334 335 if o.WithTag != nil { 336 qrWithTag = *o.WithTag 337 } 338 qWithTag := swag.FormatBool(qrWithTag) 339 if qWithTag != "" { 340 341 if err := r.SetQueryParam("with_tag", qWithTag); err != nil { 342 return err 343 } 344 } 345 } 346 347 if len(res) > 0 { 348 return errors.CompositeValidationError(res...) 349 } 350 return nil 351 }