github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/artifact/get_artifact_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package artifact 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 // NewGetArtifactParams creates a new GetArtifactParams 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 NewGetArtifactParams() *GetArtifactParams { 27 return &GetArtifactParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewGetArtifactParamsWithTimeout creates a new GetArtifactParams object 33 // with the ability to set a timeout on a request. 34 func NewGetArtifactParamsWithTimeout(timeout time.Duration) *GetArtifactParams { 35 return &GetArtifactParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewGetArtifactParamsWithContext creates a new GetArtifactParams object 41 // with the ability to set a context for a request. 42 func NewGetArtifactParamsWithContext(ctx context.Context) *GetArtifactParams { 43 return &GetArtifactParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewGetArtifactParamsWithHTTPClient creates a new GetArtifactParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewGetArtifactParamsWithHTTPClient(client *http.Client) *GetArtifactParams { 51 return &GetArtifactParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 GetArtifactParams contains all the parameters to send to the API endpoint 58 59 for the get artifact operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type GetArtifactParams struct { 64 65 /* XAcceptVulnerabilities. 66 67 A comma-separated lists of MIME types for the scan report or scan summary. The first mime type will be used when the report found for it. 68 Currently the mime type supports 'application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0' and 'application/vnd.security.vulnerability.report; version=1.1' 69 70 Default: "application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0" 71 */ 72 XAcceptVulnerabilities *string 73 74 /* XRequestID. 75 76 An unique ID for the request 77 */ 78 XRequestID *string 79 80 /* Page. 81 82 The page number 83 84 Format: int64 85 Default: 1 86 */ 87 Page *int64 88 89 /* PageSize. 90 91 The size of per page 92 93 Format: int64 94 Default: 10 95 */ 96 PageSize *int64 97 98 /* ProjectName. 99 100 The name of the project 101 */ 102 ProjectName string 103 104 /* Reference. 105 106 The reference of the artifact, can be digest or tag 107 */ 108 Reference string 109 110 /* RepositoryName. 111 112 The name of the repository. If it contains slash, encode it twice over with URL encoding. e.g. a/b -> a%2Fb -> a%252Fb 113 */ 114 RepositoryName string 115 116 /* WithAccessory. 117 118 Specify whether the accessories are included of the returning artifacts. 119 */ 120 WithAccessory *bool 121 122 /* WithImmutableStatus. 123 124 Specify whether the immutable status is inclued inside the tags of the returning artifacts. 125 */ 126 WithImmutableStatus *bool 127 128 /* WithLabel. 129 130 Specify whether the labels are inclued inside the returning artifacts 131 */ 132 WithLabel *bool 133 134 /* WithScanOverview. 135 136 Specify whether the scan overview is inclued inside the returning artifacts 137 */ 138 WithScanOverview *bool 139 140 /* WithSignature. 141 142 Specify whether the signature is inclued inside the returning artifacts 143 */ 144 WithSignature *bool 145 146 /* WithTag. 147 148 Specify whether the tags are inclued inside the returning artifacts 149 150 Default: true 151 */ 152 WithTag *bool 153 154 timeout time.Duration 155 Context context.Context 156 HTTPClient *http.Client 157 } 158 159 // WithDefaults hydrates default values in the get artifact params (not the query body). 160 // 161 // All values with no default are reset to their zero value. 162 func (o *GetArtifactParams) WithDefaults() *GetArtifactParams { 163 o.SetDefaults() 164 return o 165 } 166 167 // SetDefaults hydrates default values in the get artifact params (not the query body). 168 // 169 // All values with no default are reset to their zero value. 170 func (o *GetArtifactParams) SetDefaults() { 171 var ( 172 xAcceptVulnerabilitiesDefault = string("application/vnd.security.vulnerability.report; version=1.1, application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0") 173 174 pageDefault = int64(1) 175 176 pageSizeDefault = int64(10) 177 178 withAccessoryDefault = bool(false) 179 180 withImmutableStatusDefault = bool(false) 181 182 withLabelDefault = bool(false) 183 184 withScanOverviewDefault = bool(false) 185 186 withSignatureDefault = bool(false) 187 188 withTagDefault = bool(true) 189 ) 190 191 val := GetArtifactParams{ 192 XAcceptVulnerabilities: &xAcceptVulnerabilitiesDefault, 193 Page: &pageDefault, 194 PageSize: &pageSizeDefault, 195 WithAccessory: &withAccessoryDefault, 196 WithImmutableStatus: &withImmutableStatusDefault, 197 WithLabel: &withLabelDefault, 198 WithScanOverview: &withScanOverviewDefault, 199 WithSignature: &withSignatureDefault, 200 WithTag: &withTagDefault, 201 } 202 203 val.timeout = o.timeout 204 val.Context = o.Context 205 val.HTTPClient = o.HTTPClient 206 *o = val 207 } 208 209 // WithTimeout adds the timeout to the get artifact params 210 func (o *GetArtifactParams) WithTimeout(timeout time.Duration) *GetArtifactParams { 211 o.SetTimeout(timeout) 212 return o 213 } 214 215 // SetTimeout adds the timeout to the get artifact params 216 func (o *GetArtifactParams) SetTimeout(timeout time.Duration) { 217 o.timeout = timeout 218 } 219 220 // WithContext adds the context to the get artifact params 221 func (o *GetArtifactParams) WithContext(ctx context.Context) *GetArtifactParams { 222 o.SetContext(ctx) 223 return o 224 } 225 226 // SetContext adds the context to the get artifact params 227 func (o *GetArtifactParams) SetContext(ctx context.Context) { 228 o.Context = ctx 229 } 230 231 // WithHTTPClient adds the HTTPClient to the get artifact params 232 func (o *GetArtifactParams) WithHTTPClient(client *http.Client) *GetArtifactParams { 233 o.SetHTTPClient(client) 234 return o 235 } 236 237 // SetHTTPClient adds the HTTPClient to the get artifact params 238 func (o *GetArtifactParams) SetHTTPClient(client *http.Client) { 239 o.HTTPClient = client 240 } 241 242 // WithXAcceptVulnerabilities adds the xAcceptVulnerabilities to the get artifact params 243 func (o *GetArtifactParams) WithXAcceptVulnerabilities(xAcceptVulnerabilities *string) *GetArtifactParams { 244 o.SetXAcceptVulnerabilities(xAcceptVulnerabilities) 245 return o 246 } 247 248 // SetXAcceptVulnerabilities adds the xAcceptVulnerabilities to the get artifact params 249 func (o *GetArtifactParams) SetXAcceptVulnerabilities(xAcceptVulnerabilities *string) { 250 o.XAcceptVulnerabilities = xAcceptVulnerabilities 251 } 252 253 // WithXRequestID adds the xRequestID to the get artifact params 254 func (o *GetArtifactParams) WithXRequestID(xRequestID *string) *GetArtifactParams { 255 o.SetXRequestID(xRequestID) 256 return o 257 } 258 259 // SetXRequestID adds the xRequestId to the get artifact params 260 func (o *GetArtifactParams) SetXRequestID(xRequestID *string) { 261 o.XRequestID = xRequestID 262 } 263 264 // WithPage adds the page to the get artifact params 265 func (o *GetArtifactParams) WithPage(page *int64) *GetArtifactParams { 266 o.SetPage(page) 267 return o 268 } 269 270 // SetPage adds the page to the get artifact params 271 func (o *GetArtifactParams) SetPage(page *int64) { 272 o.Page = page 273 } 274 275 // WithPageSize adds the pageSize to the get artifact params 276 func (o *GetArtifactParams) WithPageSize(pageSize *int64) *GetArtifactParams { 277 o.SetPageSize(pageSize) 278 return o 279 } 280 281 // SetPageSize adds the pageSize to the get artifact params 282 func (o *GetArtifactParams) SetPageSize(pageSize *int64) { 283 o.PageSize = pageSize 284 } 285 286 // WithProjectName adds the projectName to the get artifact params 287 func (o *GetArtifactParams) WithProjectName(projectName string) *GetArtifactParams { 288 o.SetProjectName(projectName) 289 return o 290 } 291 292 // SetProjectName adds the projectName to the get artifact params 293 func (o *GetArtifactParams) SetProjectName(projectName string) { 294 o.ProjectName = projectName 295 } 296 297 // WithReference adds the reference to the get artifact params 298 func (o *GetArtifactParams) WithReference(reference string) *GetArtifactParams { 299 o.SetReference(reference) 300 return o 301 } 302 303 // SetReference adds the reference to the get artifact params 304 func (o *GetArtifactParams) SetReference(reference string) { 305 o.Reference = reference 306 } 307 308 // WithRepositoryName adds the repositoryName to the get artifact params 309 func (o *GetArtifactParams) WithRepositoryName(repositoryName string) *GetArtifactParams { 310 o.SetRepositoryName(repositoryName) 311 return o 312 } 313 314 // SetRepositoryName adds the repositoryName to the get artifact params 315 func (o *GetArtifactParams) SetRepositoryName(repositoryName string) { 316 o.RepositoryName = repositoryName 317 } 318 319 // WithWithAccessory adds the withAccessory to the get artifact params 320 func (o *GetArtifactParams) WithWithAccessory(withAccessory *bool) *GetArtifactParams { 321 o.SetWithAccessory(withAccessory) 322 return o 323 } 324 325 // SetWithAccessory adds the withAccessory to the get artifact params 326 func (o *GetArtifactParams) SetWithAccessory(withAccessory *bool) { 327 o.WithAccessory = withAccessory 328 } 329 330 // WithWithImmutableStatus adds the withImmutableStatus to the get artifact params 331 func (o *GetArtifactParams) WithWithImmutableStatus(withImmutableStatus *bool) *GetArtifactParams { 332 o.SetWithImmutableStatus(withImmutableStatus) 333 return o 334 } 335 336 // SetWithImmutableStatus adds the withImmutableStatus to the get artifact params 337 func (o *GetArtifactParams) SetWithImmutableStatus(withImmutableStatus *bool) { 338 o.WithImmutableStatus = withImmutableStatus 339 } 340 341 // WithWithLabel adds the withLabel to the get artifact params 342 func (o *GetArtifactParams) WithWithLabel(withLabel *bool) *GetArtifactParams { 343 o.SetWithLabel(withLabel) 344 return o 345 } 346 347 // SetWithLabel adds the withLabel to the get artifact params 348 func (o *GetArtifactParams) SetWithLabel(withLabel *bool) { 349 o.WithLabel = withLabel 350 } 351 352 // WithWithScanOverview adds the withScanOverview to the get artifact params 353 func (o *GetArtifactParams) WithWithScanOverview(withScanOverview *bool) *GetArtifactParams { 354 o.SetWithScanOverview(withScanOverview) 355 return o 356 } 357 358 // SetWithScanOverview adds the withScanOverview to the get artifact params 359 func (o *GetArtifactParams) SetWithScanOverview(withScanOverview *bool) { 360 o.WithScanOverview = withScanOverview 361 } 362 363 // WithWithSignature adds the withSignature to the get artifact params 364 func (o *GetArtifactParams) WithWithSignature(withSignature *bool) *GetArtifactParams { 365 o.SetWithSignature(withSignature) 366 return o 367 } 368 369 // SetWithSignature adds the withSignature to the get artifact params 370 func (o *GetArtifactParams) SetWithSignature(withSignature *bool) { 371 o.WithSignature = withSignature 372 } 373 374 // WithWithTag adds the withTag to the get artifact params 375 func (o *GetArtifactParams) WithWithTag(withTag *bool) *GetArtifactParams { 376 o.SetWithTag(withTag) 377 return o 378 } 379 380 // SetWithTag adds the withTag to the get artifact params 381 func (o *GetArtifactParams) SetWithTag(withTag *bool) { 382 o.WithTag = withTag 383 } 384 385 // WriteToRequest writes these params to a swagger request 386 func (o *GetArtifactParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 387 388 if err := r.SetTimeout(o.timeout); err != nil { 389 return err 390 } 391 var res []error 392 393 if o.XAcceptVulnerabilities != nil { 394 395 // header param X-Accept-Vulnerabilities 396 if err := r.SetHeaderParam("X-Accept-Vulnerabilities", *o.XAcceptVulnerabilities); err != nil { 397 return err 398 } 399 } 400 401 if o.XRequestID != nil { 402 403 // header param X-Request-Id 404 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 405 return err 406 } 407 } 408 409 if o.Page != nil { 410 411 // query param page 412 var qrPage int64 413 414 if o.Page != nil { 415 qrPage = *o.Page 416 } 417 qPage := swag.FormatInt64(qrPage) 418 if qPage != "" { 419 420 if err := r.SetQueryParam("page", qPage); err != nil { 421 return err 422 } 423 } 424 } 425 426 if o.PageSize != nil { 427 428 // query param page_size 429 var qrPageSize int64 430 431 if o.PageSize != nil { 432 qrPageSize = *o.PageSize 433 } 434 qPageSize := swag.FormatInt64(qrPageSize) 435 if qPageSize != "" { 436 437 if err := r.SetQueryParam("page_size", qPageSize); err != nil { 438 return err 439 } 440 } 441 } 442 443 // path param project_name 444 if err := r.SetPathParam("project_name", o.ProjectName); err != nil { 445 return err 446 } 447 448 // path param reference 449 if err := r.SetPathParam("reference", o.Reference); err != nil { 450 return err 451 } 452 453 // path param repository_name 454 if err := r.SetPathParam("repository_name", o.RepositoryName); err != nil { 455 return err 456 } 457 458 if o.WithAccessory != nil { 459 460 // query param with_accessory 461 var qrWithAccessory bool 462 463 if o.WithAccessory != nil { 464 qrWithAccessory = *o.WithAccessory 465 } 466 qWithAccessory := swag.FormatBool(qrWithAccessory) 467 if qWithAccessory != "" { 468 469 if err := r.SetQueryParam("with_accessory", qWithAccessory); err != nil { 470 return err 471 } 472 } 473 } 474 475 if o.WithImmutableStatus != nil { 476 477 // query param with_immutable_status 478 var qrWithImmutableStatus bool 479 480 if o.WithImmutableStatus != nil { 481 qrWithImmutableStatus = *o.WithImmutableStatus 482 } 483 qWithImmutableStatus := swag.FormatBool(qrWithImmutableStatus) 484 if qWithImmutableStatus != "" { 485 486 if err := r.SetQueryParam("with_immutable_status", qWithImmutableStatus); err != nil { 487 return err 488 } 489 } 490 } 491 492 if o.WithLabel != nil { 493 494 // query param with_label 495 var qrWithLabel bool 496 497 if o.WithLabel != nil { 498 qrWithLabel = *o.WithLabel 499 } 500 qWithLabel := swag.FormatBool(qrWithLabel) 501 if qWithLabel != "" { 502 503 if err := r.SetQueryParam("with_label", qWithLabel); err != nil { 504 return err 505 } 506 } 507 } 508 509 if o.WithScanOverview != nil { 510 511 // query param with_scan_overview 512 var qrWithScanOverview bool 513 514 if o.WithScanOverview != nil { 515 qrWithScanOverview = *o.WithScanOverview 516 } 517 qWithScanOverview := swag.FormatBool(qrWithScanOverview) 518 if qWithScanOverview != "" { 519 520 if err := r.SetQueryParam("with_scan_overview", qWithScanOverview); err != nil { 521 return err 522 } 523 } 524 } 525 526 if o.WithSignature != nil { 527 528 // query param with_signature 529 var qrWithSignature bool 530 531 if o.WithSignature != nil { 532 qrWithSignature = *o.WithSignature 533 } 534 qWithSignature := swag.FormatBool(qrWithSignature) 535 if qWithSignature != "" { 536 537 if err := r.SetQueryParam("with_signature", qWithSignature); err != nil { 538 return err 539 } 540 } 541 } 542 543 if o.WithTag != nil { 544 545 // query param with_tag 546 var qrWithTag bool 547 548 if o.WithTag != nil { 549 qrWithTag = *o.WithTag 550 } 551 qWithTag := swag.FormatBool(qrWithTag) 552 if qWithTag != "" { 553 554 if err := r.SetQueryParam("with_tag", qWithTag); err != nil { 555 return err 556 } 557 } 558 } 559 560 if len(res) > 0 { 561 return errors.CompositeValidationError(res...) 562 } 563 return nil 564 }