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