github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/artifact/remove_label_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  // NewRemoveLabelParams creates a new RemoveLabelParams 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 NewRemoveLabelParams() *RemoveLabelParams {
    27  	return &RemoveLabelParams{
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewRemoveLabelParamsWithTimeout creates a new RemoveLabelParams object
    33  // with the ability to set a timeout on a request.
    34  func NewRemoveLabelParamsWithTimeout(timeout time.Duration) *RemoveLabelParams {
    35  	return &RemoveLabelParams{
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewRemoveLabelParamsWithContext creates a new RemoveLabelParams object
    41  // with the ability to set a context for a request.
    42  func NewRemoveLabelParamsWithContext(ctx context.Context) *RemoveLabelParams {
    43  	return &RemoveLabelParams{
    44  		Context: ctx,
    45  	}
    46  }
    47  
    48  // NewRemoveLabelParamsWithHTTPClient creates a new RemoveLabelParams object
    49  // with the ability to set a custom HTTPClient for a request.
    50  func NewRemoveLabelParamsWithHTTPClient(client *http.Client) *RemoveLabelParams {
    51  	return &RemoveLabelParams{
    52  		HTTPClient: client,
    53  	}
    54  }
    55  
    56  /*
    57  RemoveLabelParams contains all the parameters to send to the API endpoint
    58  
    59  	for the remove label operation.
    60  
    61  	Typically these are written to a http.Request.
    62  */
    63  type RemoveLabelParams struct {
    64  
    65  	/* XRequestID.
    66  
    67  	   An unique ID for the request
    68  	*/
    69  	XRequestID *string
    70  
    71  	/* LabelID.
    72  
    73  	   The ID of the label that removed from the artifact.
    74  
    75  	   Format: int64
    76  	*/
    77  	LabelID int64
    78  
    79  	/* ProjectName.
    80  
    81  	   The name of the project
    82  	*/
    83  	ProjectName string
    84  
    85  	/* Reference.
    86  
    87  	   The reference of the artifact, can be digest or tag
    88  	*/
    89  	Reference string
    90  
    91  	/* RepositoryName.
    92  
    93  	   The name of the repository. If it contains slash, encode it twice over with URL encoding. e.g. a/b -> a%2Fb -> a%252Fb
    94  	*/
    95  	RepositoryName string
    96  
    97  	timeout    time.Duration
    98  	Context    context.Context
    99  	HTTPClient *http.Client
   100  }
   101  
   102  // WithDefaults hydrates default values in the remove label params (not the query body).
   103  //
   104  // All values with no default are reset to their zero value.
   105  func (o *RemoveLabelParams) WithDefaults() *RemoveLabelParams {
   106  	o.SetDefaults()
   107  	return o
   108  }
   109  
   110  // SetDefaults hydrates default values in the remove label params (not the query body).
   111  //
   112  // All values with no default are reset to their zero value.
   113  func (o *RemoveLabelParams) SetDefaults() {
   114  	// no default values defined for this parameter
   115  }
   116  
   117  // WithTimeout adds the timeout to the remove label params
   118  func (o *RemoveLabelParams) WithTimeout(timeout time.Duration) *RemoveLabelParams {
   119  	o.SetTimeout(timeout)
   120  	return o
   121  }
   122  
   123  // SetTimeout adds the timeout to the remove label params
   124  func (o *RemoveLabelParams) SetTimeout(timeout time.Duration) {
   125  	o.timeout = timeout
   126  }
   127  
   128  // WithContext adds the context to the remove label params
   129  func (o *RemoveLabelParams) WithContext(ctx context.Context) *RemoveLabelParams {
   130  	o.SetContext(ctx)
   131  	return o
   132  }
   133  
   134  // SetContext adds the context to the remove label params
   135  func (o *RemoveLabelParams) SetContext(ctx context.Context) {
   136  	o.Context = ctx
   137  }
   138  
   139  // WithHTTPClient adds the HTTPClient to the remove label params
   140  func (o *RemoveLabelParams) WithHTTPClient(client *http.Client) *RemoveLabelParams {
   141  	o.SetHTTPClient(client)
   142  	return o
   143  }
   144  
   145  // SetHTTPClient adds the HTTPClient to the remove label params
   146  func (o *RemoveLabelParams) SetHTTPClient(client *http.Client) {
   147  	o.HTTPClient = client
   148  }
   149  
   150  // WithXRequestID adds the xRequestID to the remove label params
   151  func (o *RemoveLabelParams) WithXRequestID(xRequestID *string) *RemoveLabelParams {
   152  	o.SetXRequestID(xRequestID)
   153  	return o
   154  }
   155  
   156  // SetXRequestID adds the xRequestId to the remove label params
   157  func (o *RemoveLabelParams) SetXRequestID(xRequestID *string) {
   158  	o.XRequestID = xRequestID
   159  }
   160  
   161  // WithLabelID adds the labelID to the remove label params
   162  func (o *RemoveLabelParams) WithLabelID(labelID int64) *RemoveLabelParams {
   163  	o.SetLabelID(labelID)
   164  	return o
   165  }
   166  
   167  // SetLabelID adds the labelId to the remove label params
   168  func (o *RemoveLabelParams) SetLabelID(labelID int64) {
   169  	o.LabelID = labelID
   170  }
   171  
   172  // WithProjectName adds the projectName to the remove label params
   173  func (o *RemoveLabelParams) WithProjectName(projectName string) *RemoveLabelParams {
   174  	o.SetProjectName(projectName)
   175  	return o
   176  }
   177  
   178  // SetProjectName adds the projectName to the remove label params
   179  func (o *RemoveLabelParams) SetProjectName(projectName string) {
   180  	o.ProjectName = projectName
   181  }
   182  
   183  // WithReference adds the reference to the remove label params
   184  func (o *RemoveLabelParams) WithReference(reference string) *RemoveLabelParams {
   185  	o.SetReference(reference)
   186  	return o
   187  }
   188  
   189  // SetReference adds the reference to the remove label params
   190  func (o *RemoveLabelParams) SetReference(reference string) {
   191  	o.Reference = reference
   192  }
   193  
   194  // WithRepositoryName adds the repositoryName to the remove label params
   195  func (o *RemoveLabelParams) WithRepositoryName(repositoryName string) *RemoveLabelParams {
   196  	o.SetRepositoryName(repositoryName)
   197  	return o
   198  }
   199  
   200  // SetRepositoryName adds the repositoryName to the remove label params
   201  func (o *RemoveLabelParams) SetRepositoryName(repositoryName string) {
   202  	o.RepositoryName = repositoryName
   203  }
   204  
   205  // WriteToRequest writes these params to a swagger request
   206  func (o *RemoveLabelParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   207  
   208  	if err := r.SetTimeout(o.timeout); err != nil {
   209  		return err
   210  	}
   211  	var res []error
   212  
   213  	if o.XRequestID != nil {
   214  
   215  		// header param X-Request-Id
   216  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   217  			return err
   218  		}
   219  	}
   220  
   221  	// path param label_id
   222  	if err := r.SetPathParam("label_id", swag.FormatInt64(o.LabelID)); err != nil {
   223  		return err
   224  	}
   225  
   226  	// path param project_name
   227  	if err := r.SetPathParam("project_name", o.ProjectName); err != nil {
   228  		return err
   229  	}
   230  
   231  	// path param reference
   232  	if err := r.SetPathParam("reference", o.Reference); err != nil {
   233  		return err
   234  	}
   235  
   236  	// path param repository_name
   237  	if err := r.SetPathParam("repository_name", o.RepositoryName); err != nil {
   238  		return err
   239  	}
   240  
   241  	if len(res) > 0 {
   242  		return errors.CompositeValidationError(res...)
   243  	}
   244  	return nil
   245  }