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