github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/daemon/get_cluster_nodes_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 "net/http" 13 14 "github.com/go-openapi/errors" 15 "github.com/go-openapi/runtime/middleware" 16 "github.com/go-openapi/strfmt" 17 "github.com/go-openapi/swag" 18 ) 19 20 // NewGetClusterNodesParams creates a new GetClusterNodesParams object 21 // 22 // There are no default values defined in the spec. 23 func NewGetClusterNodesParams() GetClusterNodesParams { 24 25 return GetClusterNodesParams{} 26 } 27 28 // GetClusterNodesParams contains all the bound params for the get cluster nodes operation 29 // typically these are obtained from a http.Request 30 // 31 // swagger:parameters GetClusterNodes 32 type GetClusterNodesParams struct { 33 34 // HTTP Request Object 35 HTTPRequest *http.Request `json:"-"` 36 37 /*Client UUID should be used when the client wants to request 38 a diff of nodes added and / or removed since the last time 39 that client has made a request. 40 41 In: header 42 */ 43 ClientID *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 NewGetClusterNodesParams() beforehand. 50 func (o *GetClusterNodesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 51 var res []error 52 53 o.HTTPRequest = r 54 55 if err := o.bindClientID(r.Header[http.CanonicalHeaderKey("client-id")], true, route.Formats); err != nil { 56 res = append(res, err) 57 } 58 if len(res) > 0 { 59 return errors.CompositeValidationError(res...) 60 } 61 return nil 62 } 63 64 // bindClientID binds and validates parameter ClientID from header. 65 func (o *GetClusterNodesParams) bindClientID(rawData []string, hasKey bool, formats strfmt.Registry) error { 66 var raw string 67 if len(rawData) > 0 { 68 raw = rawData[len(rawData)-1] 69 } 70 71 // Required: false 72 73 if raw == "" { // empty values pass all other validations 74 return nil 75 } 76 77 value, err := swag.ConvertInt64(raw) 78 if err != nil { 79 return errors.InvalidType("client-id", "header", "int64", raw) 80 } 81 o.ClientID = &value 82 83 return nil 84 }