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