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