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