github.com/cilium/cilium@v1.16.2/api/v1/client/daemon/patch_config_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package daemon 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "context" 13 "net/http" 14 "time" 15 16 "github.com/go-openapi/errors" 17 "github.com/go-openapi/runtime" 18 cr "github.com/go-openapi/runtime/client" 19 "github.com/go-openapi/strfmt" 20 21 "github.com/cilium/cilium/api/v1/models" 22 ) 23 24 // NewPatchConfigParams creates a new PatchConfigParams object, 25 // with the default timeout for this client. 26 // 27 // Default values are not hydrated, since defaults are normally applied by the API server side. 28 // 29 // To enforce default values in parameter, use SetDefaults or WithDefaults. 30 func NewPatchConfigParams() *PatchConfigParams { 31 return &PatchConfigParams{ 32 timeout: cr.DefaultTimeout, 33 } 34 } 35 36 // NewPatchConfigParamsWithTimeout creates a new PatchConfigParams object 37 // with the ability to set a timeout on a request. 38 func NewPatchConfigParamsWithTimeout(timeout time.Duration) *PatchConfigParams { 39 return &PatchConfigParams{ 40 timeout: timeout, 41 } 42 } 43 44 // NewPatchConfigParamsWithContext creates a new PatchConfigParams object 45 // with the ability to set a context for a request. 46 func NewPatchConfigParamsWithContext(ctx context.Context) *PatchConfigParams { 47 return &PatchConfigParams{ 48 Context: ctx, 49 } 50 } 51 52 // NewPatchConfigParamsWithHTTPClient creates a new PatchConfigParams object 53 // with the ability to set a custom HTTPClient for a request. 54 func NewPatchConfigParamsWithHTTPClient(client *http.Client) *PatchConfigParams { 55 return &PatchConfigParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /* 61 PatchConfigParams contains all the parameters to send to the API endpoint 62 63 for the patch config operation. 64 65 Typically these are written to a http.Request. 66 */ 67 type PatchConfigParams struct { 68 69 // Configuration. 70 Configuration *models.DaemonConfigurationSpec 71 72 timeout time.Duration 73 Context context.Context 74 HTTPClient *http.Client 75 } 76 77 // WithDefaults hydrates default values in the patch config params (not the query body). 78 // 79 // All values with no default are reset to their zero value. 80 func (o *PatchConfigParams) WithDefaults() *PatchConfigParams { 81 o.SetDefaults() 82 return o 83 } 84 85 // SetDefaults hydrates default values in the patch config params (not the query body). 86 // 87 // All values with no default are reset to their zero value. 88 func (o *PatchConfigParams) SetDefaults() { 89 // no default values defined for this parameter 90 } 91 92 // WithTimeout adds the timeout to the patch config params 93 func (o *PatchConfigParams) WithTimeout(timeout time.Duration) *PatchConfigParams { 94 o.SetTimeout(timeout) 95 return o 96 } 97 98 // SetTimeout adds the timeout to the patch config params 99 func (o *PatchConfigParams) SetTimeout(timeout time.Duration) { 100 o.timeout = timeout 101 } 102 103 // WithContext adds the context to the patch config params 104 func (o *PatchConfigParams) WithContext(ctx context.Context) *PatchConfigParams { 105 o.SetContext(ctx) 106 return o 107 } 108 109 // SetContext adds the context to the patch config params 110 func (o *PatchConfigParams) SetContext(ctx context.Context) { 111 o.Context = ctx 112 } 113 114 // WithHTTPClient adds the HTTPClient to the patch config params 115 func (o *PatchConfigParams) WithHTTPClient(client *http.Client) *PatchConfigParams { 116 o.SetHTTPClient(client) 117 return o 118 } 119 120 // SetHTTPClient adds the HTTPClient to the patch config params 121 func (o *PatchConfigParams) SetHTTPClient(client *http.Client) { 122 o.HTTPClient = client 123 } 124 125 // WithConfiguration adds the configuration to the patch config params 126 func (o *PatchConfigParams) WithConfiguration(configuration *models.DaemonConfigurationSpec) *PatchConfigParams { 127 o.SetConfiguration(configuration) 128 return o 129 } 130 131 // SetConfiguration adds the configuration to the patch config params 132 func (o *PatchConfigParams) SetConfiguration(configuration *models.DaemonConfigurationSpec) { 133 o.Configuration = configuration 134 } 135 136 // WriteToRequest writes these params to a swagger request 137 func (o *PatchConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 138 139 if err := r.SetTimeout(o.timeout); err != nil { 140 return err 141 } 142 var res []error 143 if o.Configuration != nil { 144 if err := r.SetBodyParam(o.Configuration); err != nil { 145 return err 146 } 147 } 148 149 if len(res) > 0 { 150 return errors.CompositeValidationError(res...) 151 } 152 return nil 153 }