github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/robot/refresh_sec_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 // NewRefreshSecParams creates a new RefreshSecParams 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 NewRefreshSecParams() *RefreshSecParams { 29 return &RefreshSecParams{ 30 timeout: cr.DefaultTimeout, 31 } 32 } 33 34 // NewRefreshSecParamsWithTimeout creates a new RefreshSecParams object 35 // with the ability to set a timeout on a request. 36 func NewRefreshSecParamsWithTimeout(timeout time.Duration) *RefreshSecParams { 37 return &RefreshSecParams{ 38 timeout: timeout, 39 } 40 } 41 42 // NewRefreshSecParamsWithContext creates a new RefreshSecParams object 43 // with the ability to set a context for a request. 44 func NewRefreshSecParamsWithContext(ctx context.Context) *RefreshSecParams { 45 return &RefreshSecParams{ 46 Context: ctx, 47 } 48 } 49 50 // NewRefreshSecParamsWithHTTPClient creates a new RefreshSecParams object 51 // with the ability to set a custom HTTPClient for a request. 52 func NewRefreshSecParamsWithHTTPClient(client *http.Client) *RefreshSecParams { 53 return &RefreshSecParams{ 54 HTTPClient: client, 55 } 56 } 57 58 /* 59 RefreshSecParams contains all the parameters to send to the API endpoint 60 61 for the refresh sec operation. 62 63 Typically these are written to a http.Request. 64 */ 65 type RefreshSecParams struct { 66 67 /* XRequestID. 68 69 An unique ID for the request 70 */ 71 XRequestID *string 72 73 /* RobotSec. 74 75 The JSON object of a robot account. 76 */ 77 RobotSec *models.RobotSec 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 refresh sec params (not the query body). 91 // 92 // All values with no default are reset to their zero value. 93 func (o *RefreshSecParams) WithDefaults() *RefreshSecParams { 94 o.SetDefaults() 95 return o 96 } 97 98 // SetDefaults hydrates default values in the refresh sec params (not the query body). 99 // 100 // All values with no default are reset to their zero value. 101 func (o *RefreshSecParams) SetDefaults() { 102 // no default values defined for this parameter 103 } 104 105 // WithTimeout adds the timeout to the refresh sec params 106 func (o *RefreshSecParams) WithTimeout(timeout time.Duration) *RefreshSecParams { 107 o.SetTimeout(timeout) 108 return o 109 } 110 111 // SetTimeout adds the timeout to the refresh sec params 112 func (o *RefreshSecParams) SetTimeout(timeout time.Duration) { 113 o.timeout = timeout 114 } 115 116 // WithContext adds the context to the refresh sec params 117 func (o *RefreshSecParams) WithContext(ctx context.Context) *RefreshSecParams { 118 o.SetContext(ctx) 119 return o 120 } 121 122 // SetContext adds the context to the refresh sec params 123 func (o *RefreshSecParams) SetContext(ctx context.Context) { 124 o.Context = ctx 125 } 126 127 // WithHTTPClient adds the HTTPClient to the refresh sec params 128 func (o *RefreshSecParams) WithHTTPClient(client *http.Client) *RefreshSecParams { 129 o.SetHTTPClient(client) 130 return o 131 } 132 133 // SetHTTPClient adds the HTTPClient to the refresh sec params 134 func (o *RefreshSecParams) SetHTTPClient(client *http.Client) { 135 o.HTTPClient = client 136 } 137 138 // WithXRequestID adds the xRequestID to the refresh sec params 139 func (o *RefreshSecParams) WithXRequestID(xRequestID *string) *RefreshSecParams { 140 o.SetXRequestID(xRequestID) 141 return o 142 } 143 144 // SetXRequestID adds the xRequestId to the refresh sec params 145 func (o *RefreshSecParams) SetXRequestID(xRequestID *string) { 146 o.XRequestID = xRequestID 147 } 148 149 // WithRobotSec adds the robotSec to the refresh sec params 150 func (o *RefreshSecParams) WithRobotSec(robotSec *models.RobotSec) *RefreshSecParams { 151 o.SetRobotSec(robotSec) 152 return o 153 } 154 155 // SetRobotSec adds the robotSec to the refresh sec params 156 func (o *RefreshSecParams) SetRobotSec(robotSec *models.RobotSec) { 157 o.RobotSec = robotSec 158 } 159 160 // WithRobotID adds the robotID to the refresh sec params 161 func (o *RefreshSecParams) WithRobotID(robotID int64) *RefreshSecParams { 162 o.SetRobotID(robotID) 163 return o 164 } 165 166 // SetRobotID adds the robotId to the refresh sec params 167 func (o *RefreshSecParams) SetRobotID(robotID int64) { 168 o.RobotID = robotID 169 } 170 171 // WriteToRequest writes these params to a swagger request 172 func (o *RefreshSecParams) 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.RobotSec != nil { 187 if err := r.SetBodyParam(o.RobotSec); 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 }