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

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