github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/label/update_label_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package label
     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  	"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
    20  )
    21  
    22  // NewUpdateLabelParams creates a new UpdateLabelParams object,
    23  // with the default timeout for this client.
    24  //
    25  // Default values are not hydrated, since defaults are normally applied by the API server side.
    26  //
    27  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    28  func NewUpdateLabelParams() *UpdateLabelParams {
    29  	return &UpdateLabelParams{
    30  		timeout: cr.DefaultTimeout,
    31  	}
    32  }
    33  
    34  // NewUpdateLabelParamsWithTimeout creates a new UpdateLabelParams object
    35  // with the ability to set a timeout on a request.
    36  func NewUpdateLabelParamsWithTimeout(timeout time.Duration) *UpdateLabelParams {
    37  	return &UpdateLabelParams{
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewUpdateLabelParamsWithContext creates a new UpdateLabelParams object
    43  // with the ability to set a context for a request.
    44  func NewUpdateLabelParamsWithContext(ctx context.Context) *UpdateLabelParams {
    45  	return &UpdateLabelParams{
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewUpdateLabelParamsWithHTTPClient creates a new UpdateLabelParams object
    51  // with the ability to set a custom HTTPClient for a request.
    52  func NewUpdateLabelParamsWithHTTPClient(client *http.Client) *UpdateLabelParams {
    53  	return &UpdateLabelParams{
    54  		HTTPClient: client,
    55  	}
    56  }
    57  
    58  /*
    59  UpdateLabelParams contains all the parameters to send to the API endpoint
    60  
    61  	for the update label operation.
    62  
    63  	Typically these are written to a http.Request.
    64  */
    65  type UpdateLabelParams struct {
    66  
    67  	/* XRequestID.
    68  
    69  	   An unique ID for the request
    70  	*/
    71  	XRequestID *string
    72  
    73  	/* Label.
    74  
    75  	   The updated label json object.
    76  	*/
    77  	Label *models.Label
    78  
    79  	/* LabelID.
    80  
    81  	   Label ID
    82  
    83  	   Format: int64
    84  	*/
    85  	LabelID int64
    86  
    87  	timeout    time.Duration
    88  	Context    context.Context
    89  	HTTPClient *http.Client
    90  }
    91  
    92  // WithDefaults hydrates default values in the update label params (not the query body).
    93  //
    94  // All values with no default are reset to their zero value.
    95  func (o *UpdateLabelParams) WithDefaults() *UpdateLabelParams {
    96  	o.SetDefaults()
    97  	return o
    98  }
    99  
   100  // SetDefaults hydrates default values in the update label params (not the query body).
   101  //
   102  // All values with no default are reset to their zero value.
   103  func (o *UpdateLabelParams) SetDefaults() {
   104  	// no default values defined for this parameter
   105  }
   106  
   107  // WithTimeout adds the timeout to the update label params
   108  func (o *UpdateLabelParams) WithTimeout(timeout time.Duration) *UpdateLabelParams {
   109  	o.SetTimeout(timeout)
   110  	return o
   111  }
   112  
   113  // SetTimeout adds the timeout to the update label params
   114  func (o *UpdateLabelParams) SetTimeout(timeout time.Duration) {
   115  	o.timeout = timeout
   116  }
   117  
   118  // WithContext adds the context to the update label params
   119  func (o *UpdateLabelParams) WithContext(ctx context.Context) *UpdateLabelParams {
   120  	o.SetContext(ctx)
   121  	return o
   122  }
   123  
   124  // SetContext adds the context to the update label params
   125  func (o *UpdateLabelParams) SetContext(ctx context.Context) {
   126  	o.Context = ctx
   127  }
   128  
   129  // WithHTTPClient adds the HTTPClient to the update label params
   130  func (o *UpdateLabelParams) WithHTTPClient(client *http.Client) *UpdateLabelParams {
   131  	o.SetHTTPClient(client)
   132  	return o
   133  }
   134  
   135  // SetHTTPClient adds the HTTPClient to the update label params
   136  func (o *UpdateLabelParams) SetHTTPClient(client *http.Client) {
   137  	o.HTTPClient = client
   138  }
   139  
   140  // WithXRequestID adds the xRequestID to the update label params
   141  func (o *UpdateLabelParams) WithXRequestID(xRequestID *string) *UpdateLabelParams {
   142  	o.SetXRequestID(xRequestID)
   143  	return o
   144  }
   145  
   146  // SetXRequestID adds the xRequestId to the update label params
   147  func (o *UpdateLabelParams) SetXRequestID(xRequestID *string) {
   148  	o.XRequestID = xRequestID
   149  }
   150  
   151  // WithLabel adds the label to the update label params
   152  func (o *UpdateLabelParams) WithLabel(label *models.Label) *UpdateLabelParams {
   153  	o.SetLabel(label)
   154  	return o
   155  }
   156  
   157  // SetLabel adds the label to the update label params
   158  func (o *UpdateLabelParams) SetLabel(label *models.Label) {
   159  	o.Label = label
   160  }
   161  
   162  // WithLabelID adds the labelID to the update label params
   163  func (o *UpdateLabelParams) WithLabelID(labelID int64) *UpdateLabelParams {
   164  	o.SetLabelID(labelID)
   165  	return o
   166  }
   167  
   168  // SetLabelID adds the labelId to the update label params
   169  func (o *UpdateLabelParams) SetLabelID(labelID int64) {
   170  	o.LabelID = labelID
   171  }
   172  
   173  // WriteToRequest writes these params to a swagger request
   174  func (o *UpdateLabelParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   175  
   176  	if err := r.SetTimeout(o.timeout); err != nil {
   177  		return err
   178  	}
   179  	var res []error
   180  
   181  	if o.XRequestID != nil {
   182  
   183  		// header param X-Request-Id
   184  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   185  			return err
   186  		}
   187  	}
   188  	if o.Label != nil {
   189  		if err := r.SetBodyParam(o.Label); err != nil {
   190  			return err
   191  		}
   192  	}
   193  
   194  	// path param label_id
   195  	if err := r.SetPathParam("label_id", swag.FormatInt64(o.LabelID)); err != nil {
   196  		return err
   197  	}
   198  
   199  	if len(res) > 0 {
   200  		return errors.CompositeValidationError(res...)
   201  	}
   202  	return nil
   203  }