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