github.com/cilium/cilium@v1.16.2/api/v1/client/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 "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 ) 21 22 // NewDeleteIpamIPParams creates a new DeleteIpamIPParams object, 23 // with the default timeout for this client. 24 // 25 // Default values are not hydrated, since defaults are normally applied by the API server side. 26 // 27 // To enforce default values in parameter, use SetDefaults or WithDefaults. 28 func NewDeleteIpamIPParams() *DeleteIpamIPParams { 29 return &DeleteIpamIPParams{ 30 timeout: cr.DefaultTimeout, 31 } 32 } 33 34 // NewDeleteIpamIPParamsWithTimeout creates a new DeleteIpamIPParams object 35 // with the ability to set a timeout on a request. 36 func NewDeleteIpamIPParamsWithTimeout(timeout time.Duration) *DeleteIpamIPParams { 37 return &DeleteIpamIPParams{ 38 timeout: timeout, 39 } 40 } 41 42 // NewDeleteIpamIPParamsWithContext creates a new DeleteIpamIPParams object 43 // with the ability to set a context for a request. 44 func NewDeleteIpamIPParamsWithContext(ctx context.Context) *DeleteIpamIPParams { 45 return &DeleteIpamIPParams{ 46 Context: ctx, 47 } 48 } 49 50 // NewDeleteIpamIPParamsWithHTTPClient creates a new DeleteIpamIPParams object 51 // with the ability to set a custom HTTPClient for a request. 52 func NewDeleteIpamIPParamsWithHTTPClient(client *http.Client) *DeleteIpamIPParams { 53 return &DeleteIpamIPParams{ 54 HTTPClient: client, 55 } 56 } 57 58 /* 59 DeleteIpamIPParams contains all the parameters to send to the API endpoint 60 61 for the delete ipam IP operation. 62 63 Typically these are written to a http.Request. 64 */ 65 type DeleteIpamIPParams struct { 66 67 /* IP. 68 69 IP address 70 */ 71 IP string 72 73 // Pool. 74 Pool *string 75 76 timeout time.Duration 77 Context context.Context 78 HTTPClient *http.Client 79 } 80 81 // WithDefaults hydrates default values in the delete ipam IP params (not the query body). 82 // 83 // All values with no default are reset to their zero value. 84 func (o *DeleteIpamIPParams) WithDefaults() *DeleteIpamIPParams { 85 o.SetDefaults() 86 return o 87 } 88 89 // SetDefaults hydrates default values in the delete ipam IP params (not the query body). 90 // 91 // All values with no default are reset to their zero value. 92 func (o *DeleteIpamIPParams) SetDefaults() { 93 // no default values defined for this parameter 94 } 95 96 // WithTimeout adds the timeout to the delete ipam IP params 97 func (o *DeleteIpamIPParams) WithTimeout(timeout time.Duration) *DeleteIpamIPParams { 98 o.SetTimeout(timeout) 99 return o 100 } 101 102 // SetTimeout adds the timeout to the delete ipam IP params 103 func (o *DeleteIpamIPParams) SetTimeout(timeout time.Duration) { 104 o.timeout = timeout 105 } 106 107 // WithContext adds the context to the delete ipam IP params 108 func (o *DeleteIpamIPParams) WithContext(ctx context.Context) *DeleteIpamIPParams { 109 o.SetContext(ctx) 110 return o 111 } 112 113 // SetContext adds the context to the delete ipam IP params 114 func (o *DeleteIpamIPParams) SetContext(ctx context.Context) { 115 o.Context = ctx 116 } 117 118 // WithHTTPClient adds the HTTPClient to the delete ipam IP params 119 func (o *DeleteIpamIPParams) WithHTTPClient(client *http.Client) *DeleteIpamIPParams { 120 o.SetHTTPClient(client) 121 return o 122 } 123 124 // SetHTTPClient adds the HTTPClient to the delete ipam IP params 125 func (o *DeleteIpamIPParams) SetHTTPClient(client *http.Client) { 126 o.HTTPClient = client 127 } 128 129 // WithIP adds the ip to the delete ipam IP params 130 func (o *DeleteIpamIPParams) WithIP(ip string) *DeleteIpamIPParams { 131 o.SetIP(ip) 132 return o 133 } 134 135 // SetIP adds the ip to the delete ipam IP params 136 func (o *DeleteIpamIPParams) SetIP(ip string) { 137 o.IP = ip 138 } 139 140 // WithPool adds the pool to the delete ipam IP params 141 func (o *DeleteIpamIPParams) WithPool(pool *string) *DeleteIpamIPParams { 142 o.SetPool(pool) 143 return o 144 } 145 146 // SetPool adds the pool to the delete ipam IP params 147 func (o *DeleteIpamIPParams) SetPool(pool *string) { 148 o.Pool = pool 149 } 150 151 // WriteToRequest writes these params to a swagger request 152 func (o *DeleteIpamIPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 153 154 if err := r.SetTimeout(o.timeout); err != nil { 155 return err 156 } 157 var res []error 158 159 // path param ip 160 if err := r.SetPathParam("ip", o.IP); err != nil { 161 return err 162 } 163 164 if o.Pool != nil { 165 166 // query param pool 167 var qrPool string 168 169 if o.Pool != nil { 170 qrPool = *o.Pool 171 } 172 qPool := qrPool 173 if qPool != "" { 174 175 if err := r.SetQueryParam("pool", qPool); err != nil { 176 return err 177 } 178 } 179 } 180 181 if len(res) > 0 { 182 return errors.CompositeValidationError(res...) 183 } 184 return nil 185 }