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