github.com/cilium/cilium@v1.16.2/api/v1/client/bgp/get_bgp_routes_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 bgp 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 23 // NewGetBgpRoutesParams creates a new GetBgpRoutesParams object, 24 // with the default timeout for this client. 25 // 26 // Default values are not hydrated, since defaults are normally applied by the API server side. 27 // 28 // To enforce default values in parameter, use SetDefaults or WithDefaults. 29 func NewGetBgpRoutesParams() *GetBgpRoutesParams { 30 return &GetBgpRoutesParams{ 31 timeout: cr.DefaultTimeout, 32 } 33 } 34 35 // NewGetBgpRoutesParamsWithTimeout creates a new GetBgpRoutesParams object 36 // with the ability to set a timeout on a request. 37 func NewGetBgpRoutesParamsWithTimeout(timeout time.Duration) *GetBgpRoutesParams { 38 return &GetBgpRoutesParams{ 39 timeout: timeout, 40 } 41 } 42 43 // NewGetBgpRoutesParamsWithContext creates a new GetBgpRoutesParams object 44 // with the ability to set a context for a request. 45 func NewGetBgpRoutesParamsWithContext(ctx context.Context) *GetBgpRoutesParams { 46 return &GetBgpRoutesParams{ 47 Context: ctx, 48 } 49 } 50 51 // NewGetBgpRoutesParamsWithHTTPClient creates a new GetBgpRoutesParams object 52 // with the ability to set a custom HTTPClient for a request. 53 func NewGetBgpRoutesParamsWithHTTPClient(client *http.Client) *GetBgpRoutesParams { 54 return &GetBgpRoutesParams{ 55 HTTPClient: client, 56 } 57 } 58 59 /* 60 GetBgpRoutesParams contains all the parameters to send to the API endpoint 61 62 for the get bgp routes operation. 63 64 Typically these are written to a http.Request. 65 */ 66 type GetBgpRoutesParams struct { 67 68 /* Afi. 69 70 Address Family Indicator (AFI) of a BGP route 71 */ 72 Afi string 73 74 /* Neighbor. 75 76 IP address specifying a BGP neighbor. 77 Has to be specified only when table type is adj-rib-in or adj-rib-out. 78 79 */ 80 Neighbor *string 81 82 /* RouterAsn. 83 84 Autonomous System Number (ASN) identifying a BGP virtual router instance. 85 If not specified, all virtual router instances are selected. 86 87 */ 88 RouterAsn *int64 89 90 /* Safi. 91 92 Subsequent Address Family Indicator (SAFI) of a BGP route 93 */ 94 Safi string 95 96 /* TableType. 97 98 BGP Routing Information Base (RIB) table type 99 */ 100 TableType string 101 102 timeout time.Duration 103 Context context.Context 104 HTTPClient *http.Client 105 } 106 107 // WithDefaults hydrates default values in the get bgp routes params (not the query body). 108 // 109 // All values with no default are reset to their zero value. 110 func (o *GetBgpRoutesParams) WithDefaults() *GetBgpRoutesParams { 111 o.SetDefaults() 112 return o 113 } 114 115 // SetDefaults hydrates default values in the get bgp routes params (not the query body). 116 // 117 // All values with no default are reset to their zero value. 118 func (o *GetBgpRoutesParams) SetDefaults() { 119 // no default values defined for this parameter 120 } 121 122 // WithTimeout adds the timeout to the get bgp routes params 123 func (o *GetBgpRoutesParams) WithTimeout(timeout time.Duration) *GetBgpRoutesParams { 124 o.SetTimeout(timeout) 125 return o 126 } 127 128 // SetTimeout adds the timeout to the get bgp routes params 129 func (o *GetBgpRoutesParams) SetTimeout(timeout time.Duration) { 130 o.timeout = timeout 131 } 132 133 // WithContext adds the context to the get bgp routes params 134 func (o *GetBgpRoutesParams) WithContext(ctx context.Context) *GetBgpRoutesParams { 135 o.SetContext(ctx) 136 return o 137 } 138 139 // SetContext adds the context to the get bgp routes params 140 func (o *GetBgpRoutesParams) SetContext(ctx context.Context) { 141 o.Context = ctx 142 } 143 144 // WithHTTPClient adds the HTTPClient to the get bgp routes params 145 func (o *GetBgpRoutesParams) WithHTTPClient(client *http.Client) *GetBgpRoutesParams { 146 o.SetHTTPClient(client) 147 return o 148 } 149 150 // SetHTTPClient adds the HTTPClient to the get bgp routes params 151 func (o *GetBgpRoutesParams) SetHTTPClient(client *http.Client) { 152 o.HTTPClient = client 153 } 154 155 // WithAfi adds the afi to the get bgp routes params 156 func (o *GetBgpRoutesParams) WithAfi(afi string) *GetBgpRoutesParams { 157 o.SetAfi(afi) 158 return o 159 } 160 161 // SetAfi adds the afi to the get bgp routes params 162 func (o *GetBgpRoutesParams) SetAfi(afi string) { 163 o.Afi = afi 164 } 165 166 // WithNeighbor adds the neighbor to the get bgp routes params 167 func (o *GetBgpRoutesParams) WithNeighbor(neighbor *string) *GetBgpRoutesParams { 168 o.SetNeighbor(neighbor) 169 return o 170 } 171 172 // SetNeighbor adds the neighbor to the get bgp routes params 173 func (o *GetBgpRoutesParams) SetNeighbor(neighbor *string) { 174 o.Neighbor = neighbor 175 } 176 177 // WithRouterAsn adds the routerAsn to the get bgp routes params 178 func (o *GetBgpRoutesParams) WithRouterAsn(routerAsn *int64) *GetBgpRoutesParams { 179 o.SetRouterAsn(routerAsn) 180 return o 181 } 182 183 // SetRouterAsn adds the routerAsn to the get bgp routes params 184 func (o *GetBgpRoutesParams) SetRouterAsn(routerAsn *int64) { 185 o.RouterAsn = routerAsn 186 } 187 188 // WithSafi adds the safi to the get bgp routes params 189 func (o *GetBgpRoutesParams) WithSafi(safi string) *GetBgpRoutesParams { 190 o.SetSafi(safi) 191 return o 192 } 193 194 // SetSafi adds the safi to the get bgp routes params 195 func (o *GetBgpRoutesParams) SetSafi(safi string) { 196 o.Safi = safi 197 } 198 199 // WithTableType adds the tableType to the get bgp routes params 200 func (o *GetBgpRoutesParams) WithTableType(tableType string) *GetBgpRoutesParams { 201 o.SetTableType(tableType) 202 return o 203 } 204 205 // SetTableType adds the tableType to the get bgp routes params 206 func (o *GetBgpRoutesParams) SetTableType(tableType string) { 207 o.TableType = tableType 208 } 209 210 // WriteToRequest writes these params to a swagger request 211 func (o *GetBgpRoutesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 212 213 if err := r.SetTimeout(o.timeout); err != nil { 214 return err 215 } 216 var res []error 217 218 // query param afi 219 qrAfi := o.Afi 220 qAfi := qrAfi 221 if qAfi != "" { 222 223 if err := r.SetQueryParam("afi", qAfi); err != nil { 224 return err 225 } 226 } 227 228 if o.Neighbor != nil { 229 230 // query param neighbor 231 var qrNeighbor string 232 233 if o.Neighbor != nil { 234 qrNeighbor = *o.Neighbor 235 } 236 qNeighbor := qrNeighbor 237 if qNeighbor != "" { 238 239 if err := r.SetQueryParam("neighbor", qNeighbor); err != nil { 240 return err 241 } 242 } 243 } 244 245 if o.RouterAsn != nil { 246 247 // query param router_asn 248 var qrRouterAsn int64 249 250 if o.RouterAsn != nil { 251 qrRouterAsn = *o.RouterAsn 252 } 253 qRouterAsn := swag.FormatInt64(qrRouterAsn) 254 if qRouterAsn != "" { 255 256 if err := r.SetQueryParam("router_asn", qRouterAsn); err != nil { 257 return err 258 } 259 } 260 } 261 262 // query param safi 263 qrSafi := o.Safi 264 qSafi := qrSafi 265 if qSafi != "" { 266 267 if err := r.SetQueryParam("safi", qSafi); err != nil { 268 return err 269 } 270 } 271 272 // query param table_type 273 qrTableType := o.TableType 274 qTableType := qrTableType 275 if qTableType != "" { 276 277 if err := r.SetQueryParam("table_type", qTableType); err != nil { 278 return err 279 } 280 } 281 282 if len(res) > 0 { 283 return errors.CompositeValidationError(res...) 284 } 285 return nil 286 }