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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package robotv1
     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  // NewUpdateRobotV1Params creates a new UpdateRobotV1Params 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 NewUpdateRobotV1Params() *UpdateRobotV1Params {
    29  	return &UpdateRobotV1Params{
    30  		timeout: cr.DefaultTimeout,
    31  	}
    32  }
    33  
    34  // NewUpdateRobotV1ParamsWithTimeout creates a new UpdateRobotV1Params object
    35  // with the ability to set a timeout on a request.
    36  func NewUpdateRobotV1ParamsWithTimeout(timeout time.Duration) *UpdateRobotV1Params {
    37  	return &UpdateRobotV1Params{
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewUpdateRobotV1ParamsWithContext creates a new UpdateRobotV1Params object
    43  // with the ability to set a context for a request.
    44  func NewUpdateRobotV1ParamsWithContext(ctx context.Context) *UpdateRobotV1Params {
    45  	return &UpdateRobotV1Params{
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewUpdateRobotV1ParamsWithHTTPClient creates a new UpdateRobotV1Params object
    51  // with the ability to set a custom HTTPClient for a request.
    52  func NewUpdateRobotV1ParamsWithHTTPClient(client *http.Client) *UpdateRobotV1Params {
    53  	return &UpdateRobotV1Params{
    54  		HTTPClient: client,
    55  	}
    56  }
    57  
    58  /*
    59  UpdateRobotV1Params contains all the parameters to send to the API endpoint
    60  
    61  	for the update robot v1 operation.
    62  
    63  	Typically these are written to a http.Request.
    64  */
    65  type UpdateRobotV1Params struct {
    66  
    67  	/* XIsResourceName.
    68  
    69  	   The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.
    70  	*/
    71  	XIsResourceName *bool
    72  
    73  	/* XRequestID.
    74  
    75  	   An unique ID for the request
    76  	*/
    77  	XRequestID *string
    78  
    79  	/* ProjectNameOrID.
    80  
    81  	   The name or id of the project
    82  	*/
    83  	ProjectNameOrID string
    84  
    85  	/* Robot.
    86  
    87  	   The JSON object of a robot account.
    88  	*/
    89  	Robot *models.Robot
    90  
    91  	/* RobotID.
    92  
    93  	   Robot ID
    94  	*/
    95  	RobotID int64
    96  
    97  	timeout    time.Duration
    98  	Context    context.Context
    99  	HTTPClient *http.Client
   100  }
   101  
   102  // WithDefaults hydrates default values in the update robot v1 params (not the query body).
   103  //
   104  // All values with no default are reset to their zero value.
   105  func (o *UpdateRobotV1Params) WithDefaults() *UpdateRobotV1Params {
   106  	o.SetDefaults()
   107  	return o
   108  }
   109  
   110  // SetDefaults hydrates default values in the update robot v1 params (not the query body).
   111  //
   112  // All values with no default are reset to their zero value.
   113  func (o *UpdateRobotV1Params) SetDefaults() {
   114  	var (
   115  		xIsResourceNameDefault = bool(false)
   116  	)
   117  
   118  	val := UpdateRobotV1Params{
   119  		XIsResourceName: &xIsResourceNameDefault,
   120  	}
   121  
   122  	val.timeout = o.timeout
   123  	val.Context = o.Context
   124  	val.HTTPClient = o.HTTPClient
   125  	*o = val
   126  }
   127  
   128  // WithTimeout adds the timeout to the update robot v1 params
   129  func (o *UpdateRobotV1Params) WithTimeout(timeout time.Duration) *UpdateRobotV1Params {
   130  	o.SetTimeout(timeout)
   131  	return o
   132  }
   133  
   134  // SetTimeout adds the timeout to the update robot v1 params
   135  func (o *UpdateRobotV1Params) SetTimeout(timeout time.Duration) {
   136  	o.timeout = timeout
   137  }
   138  
   139  // WithContext adds the context to the update robot v1 params
   140  func (o *UpdateRobotV1Params) WithContext(ctx context.Context) *UpdateRobotV1Params {
   141  	o.SetContext(ctx)
   142  	return o
   143  }
   144  
   145  // SetContext adds the context to the update robot v1 params
   146  func (o *UpdateRobotV1Params) SetContext(ctx context.Context) {
   147  	o.Context = ctx
   148  }
   149  
   150  // WithHTTPClient adds the HTTPClient to the update robot v1 params
   151  func (o *UpdateRobotV1Params) WithHTTPClient(client *http.Client) *UpdateRobotV1Params {
   152  	o.SetHTTPClient(client)
   153  	return o
   154  }
   155  
   156  // SetHTTPClient adds the HTTPClient to the update robot v1 params
   157  func (o *UpdateRobotV1Params) SetHTTPClient(client *http.Client) {
   158  	o.HTTPClient = client
   159  }
   160  
   161  // WithXIsResourceName adds the xIsResourceName to the update robot v1 params
   162  func (o *UpdateRobotV1Params) WithXIsResourceName(xIsResourceName *bool) *UpdateRobotV1Params {
   163  	o.SetXIsResourceName(xIsResourceName)
   164  	return o
   165  }
   166  
   167  // SetXIsResourceName adds the xIsResourceName to the update robot v1 params
   168  func (o *UpdateRobotV1Params) SetXIsResourceName(xIsResourceName *bool) {
   169  	o.XIsResourceName = xIsResourceName
   170  }
   171  
   172  // WithXRequestID adds the xRequestID to the update robot v1 params
   173  func (o *UpdateRobotV1Params) WithXRequestID(xRequestID *string) *UpdateRobotV1Params {
   174  	o.SetXRequestID(xRequestID)
   175  	return o
   176  }
   177  
   178  // SetXRequestID adds the xRequestId to the update robot v1 params
   179  func (o *UpdateRobotV1Params) SetXRequestID(xRequestID *string) {
   180  	o.XRequestID = xRequestID
   181  }
   182  
   183  // WithProjectNameOrID adds the projectNameOrID to the update robot v1 params
   184  func (o *UpdateRobotV1Params) WithProjectNameOrID(projectNameOrID string) *UpdateRobotV1Params {
   185  	o.SetProjectNameOrID(projectNameOrID)
   186  	return o
   187  }
   188  
   189  // SetProjectNameOrID adds the projectNameOrId to the update robot v1 params
   190  func (o *UpdateRobotV1Params) SetProjectNameOrID(projectNameOrID string) {
   191  	o.ProjectNameOrID = projectNameOrID
   192  }
   193  
   194  // WithRobot adds the robot to the update robot v1 params
   195  func (o *UpdateRobotV1Params) WithRobot(robot *models.Robot) *UpdateRobotV1Params {
   196  	o.SetRobot(robot)
   197  	return o
   198  }
   199  
   200  // SetRobot adds the robot to the update robot v1 params
   201  func (o *UpdateRobotV1Params) SetRobot(robot *models.Robot) {
   202  	o.Robot = robot
   203  }
   204  
   205  // WithRobotID adds the robotID to the update robot v1 params
   206  func (o *UpdateRobotV1Params) WithRobotID(robotID int64) *UpdateRobotV1Params {
   207  	o.SetRobotID(robotID)
   208  	return o
   209  }
   210  
   211  // SetRobotID adds the robotId to the update robot v1 params
   212  func (o *UpdateRobotV1Params) SetRobotID(robotID int64) {
   213  	o.RobotID = robotID
   214  }
   215  
   216  // WriteToRequest writes these params to a swagger request
   217  func (o *UpdateRobotV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   218  
   219  	if err := r.SetTimeout(o.timeout); err != nil {
   220  		return err
   221  	}
   222  	var res []error
   223  
   224  	if o.XIsResourceName != nil {
   225  
   226  		// header param X-Is-Resource-Name
   227  		if err := r.SetHeaderParam("X-Is-Resource-Name", swag.FormatBool(*o.XIsResourceName)); err != nil {
   228  			return err
   229  		}
   230  	}
   231  
   232  	if o.XRequestID != nil {
   233  
   234  		// header param X-Request-Id
   235  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   236  			return err
   237  		}
   238  	}
   239  
   240  	// path param project_name_or_id
   241  	if err := r.SetPathParam("project_name_or_id", o.ProjectNameOrID); err != nil {
   242  		return err
   243  	}
   244  	if o.Robot != nil {
   245  		if err := r.SetBodyParam(o.Robot); err != nil {
   246  			return err
   247  		}
   248  	}
   249  
   250  	// path param robot_id
   251  	if err := r.SetPathParam("robot_id", swag.FormatInt64(o.RobotID)); err != nil {
   252  		return err
   253  	}
   254  
   255  	if len(res) > 0 {
   256  		return errors.CompositeValidationError(res...)
   257  	}
   258  	return nil
   259  }