github.com/cilium/cilium@v1.16.2/api/v1/client/service/put_service_id_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 service 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 "github.com/go-openapi/swag" 21 22 "github.com/cilium/cilium/api/v1/models" 23 ) 24 25 // NewPutServiceIDParams creates a new PutServiceIDParams object, 26 // with the default timeout for this client. 27 // 28 // Default values are not hydrated, since defaults are normally applied by the API server side. 29 // 30 // To enforce default values in parameter, use SetDefaults or WithDefaults. 31 func NewPutServiceIDParams() *PutServiceIDParams { 32 return &PutServiceIDParams{ 33 timeout: cr.DefaultTimeout, 34 } 35 } 36 37 // NewPutServiceIDParamsWithTimeout creates a new PutServiceIDParams object 38 // with the ability to set a timeout on a request. 39 func NewPutServiceIDParamsWithTimeout(timeout time.Duration) *PutServiceIDParams { 40 return &PutServiceIDParams{ 41 timeout: timeout, 42 } 43 } 44 45 // NewPutServiceIDParamsWithContext creates a new PutServiceIDParams object 46 // with the ability to set a context for a request. 47 func NewPutServiceIDParamsWithContext(ctx context.Context) *PutServiceIDParams { 48 return &PutServiceIDParams{ 49 Context: ctx, 50 } 51 } 52 53 // NewPutServiceIDParamsWithHTTPClient creates a new PutServiceIDParams object 54 // with the ability to set a custom HTTPClient for a request. 55 func NewPutServiceIDParamsWithHTTPClient(client *http.Client) *PutServiceIDParams { 56 return &PutServiceIDParams{ 57 HTTPClient: client, 58 } 59 } 60 61 /* 62 PutServiceIDParams contains all the parameters to send to the API endpoint 63 64 for the put service ID operation. 65 66 Typically these are written to a http.Request. 67 */ 68 type PutServiceIDParams struct { 69 70 /* Config. 71 72 Service configuration 73 */ 74 Config *models.ServiceSpec 75 76 /* ID. 77 78 ID of service 79 */ 80 ID int64 81 82 timeout time.Duration 83 Context context.Context 84 HTTPClient *http.Client 85 } 86 87 // WithDefaults hydrates default values in the put service ID params (not the query body). 88 // 89 // All values with no default are reset to their zero value. 90 func (o *PutServiceIDParams) WithDefaults() *PutServiceIDParams { 91 o.SetDefaults() 92 return o 93 } 94 95 // SetDefaults hydrates default values in the put service ID params (not the query body). 96 // 97 // All values with no default are reset to their zero value. 98 func (o *PutServiceIDParams) SetDefaults() { 99 // no default values defined for this parameter 100 } 101 102 // WithTimeout adds the timeout to the put service ID params 103 func (o *PutServiceIDParams) WithTimeout(timeout time.Duration) *PutServiceIDParams { 104 o.SetTimeout(timeout) 105 return o 106 } 107 108 // SetTimeout adds the timeout to the put service ID params 109 func (o *PutServiceIDParams) SetTimeout(timeout time.Duration) { 110 o.timeout = timeout 111 } 112 113 // WithContext adds the context to the put service ID params 114 func (o *PutServiceIDParams) WithContext(ctx context.Context) *PutServiceIDParams { 115 o.SetContext(ctx) 116 return o 117 } 118 119 // SetContext adds the context to the put service ID params 120 func (o *PutServiceIDParams) SetContext(ctx context.Context) { 121 o.Context = ctx 122 } 123 124 // WithHTTPClient adds the HTTPClient to the put service ID params 125 func (o *PutServiceIDParams) WithHTTPClient(client *http.Client) *PutServiceIDParams { 126 o.SetHTTPClient(client) 127 return o 128 } 129 130 // SetHTTPClient adds the HTTPClient to the put service ID params 131 func (o *PutServiceIDParams) SetHTTPClient(client *http.Client) { 132 o.HTTPClient = client 133 } 134 135 // WithConfig adds the config to the put service ID params 136 func (o *PutServiceIDParams) WithConfig(config *models.ServiceSpec) *PutServiceIDParams { 137 o.SetConfig(config) 138 return o 139 } 140 141 // SetConfig adds the config to the put service ID params 142 func (o *PutServiceIDParams) SetConfig(config *models.ServiceSpec) { 143 o.Config = config 144 } 145 146 // WithID adds the id to the put service ID params 147 func (o *PutServiceIDParams) WithID(id int64) *PutServiceIDParams { 148 o.SetID(id) 149 return o 150 } 151 152 // SetID adds the id to the put service ID params 153 func (o *PutServiceIDParams) SetID(id int64) { 154 o.ID = id 155 } 156 157 // WriteToRequest writes these params to a swagger request 158 func (o *PutServiceIDParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 159 160 if err := r.SetTimeout(o.timeout); err != nil { 161 return err 162 } 163 var res []error 164 if o.Config != nil { 165 if err := r.SetBodyParam(o.Config); err != nil { 166 return err 167 } 168 } 169 170 // path param id 171 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 172 return err 173 } 174 175 if len(res) > 0 { 176 return errors.CompositeValidationError(res...) 177 } 178 return nil 179 }