github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/bgp/get_bgp_route_policies_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 "net/http" 13 14 "github.com/go-openapi/errors" 15 "github.com/go-openapi/runtime" 16 "github.com/go-openapi/runtime/middleware" 17 "github.com/go-openapi/strfmt" 18 "github.com/go-openapi/swag" 19 ) 20 21 // NewGetBgpRoutePoliciesParams creates a new GetBgpRoutePoliciesParams object 22 // 23 // There are no default values defined in the spec. 24 func NewGetBgpRoutePoliciesParams() GetBgpRoutePoliciesParams { 25 26 return GetBgpRoutePoliciesParams{} 27 } 28 29 // GetBgpRoutePoliciesParams contains all the bound params for the get bgp route policies operation 30 // typically these are obtained from a http.Request 31 // 32 // swagger:parameters GetBgpRoutePolicies 33 type GetBgpRoutePoliciesParams struct { 34 35 // HTTP Request Object 36 HTTPRequest *http.Request `json:"-"` 37 38 /*Autonomous System Number (ASN) identifying a BGP virtual router instance. 39 If not specified, all virtual router instances are selected. 40 41 In: query 42 */ 43 RouterAsn *int64 44 } 45 46 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 47 // for simple values it will use straight method calls. 48 // 49 // To ensure default values, the struct must have been initialized with NewGetBgpRoutePoliciesParams() beforehand. 50 func (o *GetBgpRoutePoliciesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 51 var res []error 52 53 o.HTTPRequest = r 54 55 qs := runtime.Values(r.URL.Query()) 56 57 qRouterAsn, qhkRouterAsn, _ := qs.GetOK("router_asn") 58 if err := o.bindRouterAsn(qRouterAsn, qhkRouterAsn, route.Formats); err != nil { 59 res = append(res, err) 60 } 61 if len(res) > 0 { 62 return errors.CompositeValidationError(res...) 63 } 64 return nil 65 } 66 67 // bindRouterAsn binds and validates parameter RouterAsn from query. 68 func (o *GetBgpRoutePoliciesParams) bindRouterAsn(rawData []string, hasKey bool, formats strfmt.Registry) error { 69 var raw string 70 if len(rawData) > 0 { 71 raw = rawData[len(rawData)-1] 72 } 73 74 // Required: false 75 // AllowEmptyValue: false 76 77 if raw == "" { // empty values pass all other validations 78 return nil 79 } 80 81 value, err := swag.ConvertInt64(raw) 82 if err != nil { 83 return errors.InvalidType("router_asn", "query", "int64", raw) 84 } 85 o.RouterAsn = &value 86 87 return nil 88 }