github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/daemon/get_healthz_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 // NewGetHealthzParams creates a new GetHealthzParams object 21 // 22 // There are no default values defined in the spec. 23 func NewGetHealthzParams() GetHealthzParams { 24 25 return GetHealthzParams{} 26 } 27 28 // GetHealthzParams contains all the bound params for the get healthz operation 29 // typically these are obtained from a http.Request 30 // 31 // swagger:parameters GetHealthz 32 type GetHealthzParams struct { 33 34 // HTTP Request Object 35 HTTPRequest *http.Request `json:"-"` 36 37 /*Brief will return a brief representation of the Cilium status. 38 39 In: header 40 */ 41 Brief *bool 42 } 43 44 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 45 // for simple values it will use straight method calls. 46 // 47 // To ensure default values, the struct must have been initialized with NewGetHealthzParams() beforehand. 48 func (o *GetHealthzParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 49 var res []error 50 51 o.HTTPRequest = r 52 53 if err := o.bindBrief(r.Header[http.CanonicalHeaderKey("brief")], true, route.Formats); err != nil { 54 res = append(res, err) 55 } 56 if len(res) > 0 { 57 return errors.CompositeValidationError(res...) 58 } 59 return nil 60 } 61 62 // bindBrief binds and validates parameter Brief from header. 63 func (o *GetHealthzParams) bindBrief(rawData []string, hasKey bool, formats strfmt.Registry) error { 64 var raw string 65 if len(rawData) > 0 { 66 raw = rawData[len(rawData)-1] 67 } 68 69 // Required: false 70 71 if raw == "" { // empty values pass all other validations 72 return nil 73 } 74 75 value, err := swag.ConvertBool(raw) 76 if err != nil { 77 return errors.InvalidType("brief", "header", "bool", raw) 78 } 79 o.Brief = &value 80 81 return nil 82 }