github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/quota/list_quotas_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 20 // NewListQuotasParams creates a new ListQuotasParams 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 NewListQuotasParams() *ListQuotasParams { 27 return &ListQuotasParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewListQuotasParamsWithTimeout creates a new ListQuotasParams object 33 // with the ability to set a timeout on a request. 34 func NewListQuotasParamsWithTimeout(timeout time.Duration) *ListQuotasParams { 35 return &ListQuotasParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewListQuotasParamsWithContext creates a new ListQuotasParams object 41 // with the ability to set a context for a request. 42 func NewListQuotasParamsWithContext(ctx context.Context) *ListQuotasParams { 43 return &ListQuotasParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewListQuotasParamsWithHTTPClient creates a new ListQuotasParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewListQuotasParamsWithHTTPClient(client *http.Client) *ListQuotasParams { 51 return &ListQuotasParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 ListQuotasParams contains all the parameters to send to the API endpoint 58 59 for the list quotas operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type ListQuotasParams struct { 64 65 /* XRequestID. 66 67 An unique ID for the request 68 */ 69 XRequestID *string 70 71 /* Page. 72 73 The page number 74 75 Format: int64 76 Default: 1 77 */ 78 Page *int64 79 80 /* PageSize. 81 82 The size of per page 83 84 Format: int64 85 Default: 10 86 */ 87 PageSize *int64 88 89 /* Reference. 90 91 The reference type of quota. 92 */ 93 Reference *string 94 95 /* ReferenceID. 96 97 The reference id of quota. 98 */ 99 ReferenceID *string 100 101 /* Sort. 102 103 Sort method, valid values include: 104 'hard.resource_name', '-hard.resource_name', 'used.resource_name', '-used.resource_name'. 105 Here '-' stands for descending order, resource_name should be the real resource name of the quota. 106 107 */ 108 Sort *string 109 110 timeout time.Duration 111 Context context.Context 112 HTTPClient *http.Client 113 } 114 115 // WithDefaults hydrates default values in the list quotas params (not the query body). 116 // 117 // All values with no default are reset to their zero value. 118 func (o *ListQuotasParams) WithDefaults() *ListQuotasParams { 119 o.SetDefaults() 120 return o 121 } 122 123 // SetDefaults hydrates default values in the list quotas params (not the query body). 124 // 125 // All values with no default are reset to their zero value. 126 func (o *ListQuotasParams) SetDefaults() { 127 var ( 128 pageDefault = int64(1) 129 130 pageSizeDefault = int64(10) 131 ) 132 133 val := ListQuotasParams{ 134 Page: &pageDefault, 135 PageSize: &pageSizeDefault, 136 } 137 138 val.timeout = o.timeout 139 val.Context = o.Context 140 val.HTTPClient = o.HTTPClient 141 *o = val 142 } 143 144 // WithTimeout adds the timeout to the list quotas params 145 func (o *ListQuotasParams) WithTimeout(timeout time.Duration) *ListQuotasParams { 146 o.SetTimeout(timeout) 147 return o 148 } 149 150 // SetTimeout adds the timeout to the list quotas params 151 func (o *ListQuotasParams) SetTimeout(timeout time.Duration) { 152 o.timeout = timeout 153 } 154 155 // WithContext adds the context to the list quotas params 156 func (o *ListQuotasParams) WithContext(ctx context.Context) *ListQuotasParams { 157 o.SetContext(ctx) 158 return o 159 } 160 161 // SetContext adds the context to the list quotas params 162 func (o *ListQuotasParams) SetContext(ctx context.Context) { 163 o.Context = ctx 164 } 165 166 // WithHTTPClient adds the HTTPClient to the list quotas params 167 func (o *ListQuotasParams) WithHTTPClient(client *http.Client) *ListQuotasParams { 168 o.SetHTTPClient(client) 169 return o 170 } 171 172 // SetHTTPClient adds the HTTPClient to the list quotas params 173 func (o *ListQuotasParams) SetHTTPClient(client *http.Client) { 174 o.HTTPClient = client 175 } 176 177 // WithXRequestID adds the xRequestID to the list quotas params 178 func (o *ListQuotasParams) WithXRequestID(xRequestID *string) *ListQuotasParams { 179 o.SetXRequestID(xRequestID) 180 return o 181 } 182 183 // SetXRequestID adds the xRequestId to the list quotas params 184 func (o *ListQuotasParams) SetXRequestID(xRequestID *string) { 185 o.XRequestID = xRequestID 186 } 187 188 // WithPage adds the page to the list quotas params 189 func (o *ListQuotasParams) WithPage(page *int64) *ListQuotasParams { 190 o.SetPage(page) 191 return o 192 } 193 194 // SetPage adds the page to the list quotas params 195 func (o *ListQuotasParams) SetPage(page *int64) { 196 o.Page = page 197 } 198 199 // WithPageSize adds the pageSize to the list quotas params 200 func (o *ListQuotasParams) WithPageSize(pageSize *int64) *ListQuotasParams { 201 o.SetPageSize(pageSize) 202 return o 203 } 204 205 // SetPageSize adds the pageSize to the list quotas params 206 func (o *ListQuotasParams) SetPageSize(pageSize *int64) { 207 o.PageSize = pageSize 208 } 209 210 // WithReference adds the reference to the list quotas params 211 func (o *ListQuotasParams) WithReference(reference *string) *ListQuotasParams { 212 o.SetReference(reference) 213 return o 214 } 215 216 // SetReference adds the reference to the list quotas params 217 func (o *ListQuotasParams) SetReference(reference *string) { 218 o.Reference = reference 219 } 220 221 // WithReferenceID adds the referenceID to the list quotas params 222 func (o *ListQuotasParams) WithReferenceID(referenceID *string) *ListQuotasParams { 223 o.SetReferenceID(referenceID) 224 return o 225 } 226 227 // SetReferenceID adds the referenceId to the list quotas params 228 func (o *ListQuotasParams) SetReferenceID(referenceID *string) { 229 o.ReferenceID = referenceID 230 } 231 232 // WithSort adds the sort to the list quotas params 233 func (o *ListQuotasParams) WithSort(sort *string) *ListQuotasParams { 234 o.SetSort(sort) 235 return o 236 } 237 238 // SetSort adds the sort to the list quotas params 239 func (o *ListQuotasParams) SetSort(sort *string) { 240 o.Sort = sort 241 } 242 243 // WriteToRequest writes these params to a swagger request 244 func (o *ListQuotasParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 245 246 if err := r.SetTimeout(o.timeout); err != nil { 247 return err 248 } 249 var res []error 250 251 if o.XRequestID != nil { 252 253 // header param X-Request-Id 254 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 255 return err 256 } 257 } 258 259 if o.Page != nil { 260 261 // query param page 262 var qrPage int64 263 264 if o.Page != nil { 265 qrPage = *o.Page 266 } 267 qPage := swag.FormatInt64(qrPage) 268 if qPage != "" { 269 270 if err := r.SetQueryParam("page", qPage); err != nil { 271 return err 272 } 273 } 274 } 275 276 if o.PageSize != nil { 277 278 // query param page_size 279 var qrPageSize int64 280 281 if o.PageSize != nil { 282 qrPageSize = *o.PageSize 283 } 284 qPageSize := swag.FormatInt64(qrPageSize) 285 if qPageSize != "" { 286 287 if err := r.SetQueryParam("page_size", qPageSize); err != nil { 288 return err 289 } 290 } 291 } 292 293 if o.Reference != nil { 294 295 // query param reference 296 var qrReference string 297 298 if o.Reference != nil { 299 qrReference = *o.Reference 300 } 301 qReference := qrReference 302 if qReference != "" { 303 304 if err := r.SetQueryParam("reference", qReference); err != nil { 305 return err 306 } 307 } 308 } 309 310 if o.ReferenceID != nil { 311 312 // query param reference_id 313 var qrReferenceID string 314 315 if o.ReferenceID != nil { 316 qrReferenceID = *o.ReferenceID 317 } 318 qReferenceID := qrReferenceID 319 if qReferenceID != "" { 320 321 if err := r.SetQueryParam("reference_id", qReferenceID); err != nil { 322 return err 323 } 324 } 325 } 326 327 if o.Sort != nil { 328 329 // query param sort 330 var qrSort string 331 332 if o.Sort != nil { 333 qrSort = *o.Sort 334 } 335 qSort := qrSort 336 if qSort != "" { 337 338 if err := r.SetQueryParam("sort", qSort); err != nil { 339 return err 340 } 341 } 342 } 343 344 if len(res) > 0 { 345 return errors.CompositeValidationError(res...) 346 } 347 return nil 348 }