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