github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/ipam/delete_ipam_ip_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 ipam 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 ) 19 20 // NewDeleteIpamIPParams creates a new DeleteIpamIPParams object 21 // 22 // There are no default values defined in the spec. 23 func NewDeleteIpamIPParams() DeleteIpamIPParams { 24 25 return DeleteIpamIPParams{} 26 } 27 28 // DeleteIpamIPParams contains all the bound params for the delete ipam IP operation 29 // typically these are obtained from a http.Request 30 // 31 // swagger:parameters DeleteIpamIP 32 type DeleteIpamIPParams struct { 33 34 // HTTP Request Object 35 HTTPRequest *http.Request `json:"-"` 36 37 /*IP address 38 Required: true 39 In: path 40 */ 41 IP string 42 /* 43 In: query 44 */ 45 Pool *string 46 } 47 48 // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface 49 // for simple values it will use straight method calls. 50 // 51 // To ensure default values, the struct must have been initialized with NewDeleteIpamIPParams() beforehand. 52 func (o *DeleteIpamIPParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { 53 var res []error 54 55 o.HTTPRequest = r 56 57 qs := runtime.Values(r.URL.Query()) 58 59 rIP, rhkIP, _ := route.Params.GetOK("ip") 60 if err := o.bindIP(rIP, rhkIP, route.Formats); err != nil { 61 res = append(res, err) 62 } 63 64 qPool, qhkPool, _ := qs.GetOK("pool") 65 if err := o.bindPool(qPool, qhkPool, route.Formats); err != nil { 66 res = append(res, err) 67 } 68 if len(res) > 0 { 69 return errors.CompositeValidationError(res...) 70 } 71 return nil 72 } 73 74 // bindIP binds and validates parameter IP from path. 75 func (o *DeleteIpamIPParams) bindIP(rawData []string, hasKey bool, formats strfmt.Registry) error { 76 var raw string 77 if len(rawData) > 0 { 78 raw = rawData[len(rawData)-1] 79 } 80 81 // Required: true 82 // Parameter is provided by construction from the route 83 o.IP = raw 84 85 return nil 86 } 87 88 // bindPool binds and validates parameter Pool from query. 89 func (o *DeleteIpamIPParams) bindPool(rawData []string, hasKey bool, formats strfmt.Registry) error { 90 var raw string 91 if len(rawData) > 0 { 92 raw = rawData[len(rawData)-1] 93 } 94 95 // Required: false 96 // AllowEmptyValue: false 97 98 if raw == "" { // empty values pass all other validations 99 return nil 100 } 101 o.Pool = &raw 102 103 return nil 104 }