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