github.com/kubearmor/cilium@v1.6.12/api/v1/client/ipam/post_ip_a_m_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package ipam 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 "net/http" 11 "time" 12 13 "github.com/go-openapi/errors" 14 "github.com/go-openapi/runtime" 15 cr "github.com/go-openapi/runtime/client" 16 "github.com/go-openapi/swag" 17 18 strfmt "github.com/go-openapi/strfmt" 19 ) 20 21 // NewPostIPAMParams creates a new PostIPAMParams object 22 // with the default values initialized. 23 func NewPostIPAMParams() *PostIPAMParams { 24 var () 25 return &PostIPAMParams{ 26 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewPostIPAMParamsWithTimeout creates a new PostIPAMParams object 32 // with the default values initialized, and the ability to set a timeout on a request 33 func NewPostIPAMParamsWithTimeout(timeout time.Duration) *PostIPAMParams { 34 var () 35 return &PostIPAMParams{ 36 37 timeout: timeout, 38 } 39 } 40 41 // NewPostIPAMParamsWithContext creates a new PostIPAMParams object 42 // with the default values initialized, and the ability to set a context for a request 43 func NewPostIPAMParamsWithContext(ctx context.Context) *PostIPAMParams { 44 var () 45 return &PostIPAMParams{ 46 47 Context: ctx, 48 } 49 } 50 51 // NewPostIPAMParamsWithHTTPClient creates a new PostIPAMParams object 52 // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 func NewPostIPAMParamsWithHTTPClient(client *http.Client) *PostIPAMParams { 54 var () 55 return &PostIPAMParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /*PostIPAMParams contains all the parameters to send to the API endpoint 61 for the post IP a m operation typically these are written to a http.Request 62 */ 63 type PostIPAMParams struct { 64 65 /*Expiration*/ 66 Expiration *bool 67 /*Family*/ 68 Family *string 69 /*Owner*/ 70 Owner *string 71 72 timeout time.Duration 73 Context context.Context 74 HTTPClient *http.Client 75 } 76 77 // WithTimeout adds the timeout to the post IP a m params 78 func (o *PostIPAMParams) WithTimeout(timeout time.Duration) *PostIPAMParams { 79 o.SetTimeout(timeout) 80 return o 81 } 82 83 // SetTimeout adds the timeout to the post IP a m params 84 func (o *PostIPAMParams) SetTimeout(timeout time.Duration) { 85 o.timeout = timeout 86 } 87 88 // WithContext adds the context to the post IP a m params 89 func (o *PostIPAMParams) WithContext(ctx context.Context) *PostIPAMParams { 90 o.SetContext(ctx) 91 return o 92 } 93 94 // SetContext adds the context to the post IP a m params 95 func (o *PostIPAMParams) SetContext(ctx context.Context) { 96 o.Context = ctx 97 } 98 99 // WithHTTPClient adds the HTTPClient to the post IP a m params 100 func (o *PostIPAMParams) WithHTTPClient(client *http.Client) *PostIPAMParams { 101 o.SetHTTPClient(client) 102 return o 103 } 104 105 // SetHTTPClient adds the HTTPClient to the post IP a m params 106 func (o *PostIPAMParams) SetHTTPClient(client *http.Client) { 107 o.HTTPClient = client 108 } 109 110 // WithExpiration adds the expiration to the post IP a m params 111 func (o *PostIPAMParams) WithExpiration(expiration *bool) *PostIPAMParams { 112 o.SetExpiration(expiration) 113 return o 114 } 115 116 // SetExpiration adds the expiration to the post IP a m params 117 func (o *PostIPAMParams) SetExpiration(expiration *bool) { 118 o.Expiration = expiration 119 } 120 121 // WithFamily adds the family to the post IP a m params 122 func (o *PostIPAMParams) WithFamily(family *string) *PostIPAMParams { 123 o.SetFamily(family) 124 return o 125 } 126 127 // SetFamily adds the family to the post IP a m params 128 func (o *PostIPAMParams) SetFamily(family *string) { 129 o.Family = family 130 } 131 132 // WithOwner adds the owner to the post IP a m params 133 func (o *PostIPAMParams) WithOwner(owner *string) *PostIPAMParams { 134 o.SetOwner(owner) 135 return o 136 } 137 138 // SetOwner adds the owner to the post IP a m params 139 func (o *PostIPAMParams) SetOwner(owner *string) { 140 o.Owner = owner 141 } 142 143 // WriteToRequest writes these params to a swagger request 144 func (o *PostIPAMParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 145 146 if err := r.SetTimeout(o.timeout); err != nil { 147 return err 148 } 149 var res []error 150 151 if o.Expiration != nil { 152 153 // header param expiration 154 if err := r.SetHeaderParam("expiration", swag.FormatBool(*o.Expiration)); err != nil { 155 return err 156 } 157 158 } 159 160 if o.Family != nil { 161 162 // query param family 163 var qrFamily string 164 if o.Family != nil { 165 qrFamily = *o.Family 166 } 167 qFamily := qrFamily 168 if qFamily != "" { 169 if err := r.SetQueryParam("family", qFamily); err != nil { 170 return err 171 } 172 } 173 174 } 175 176 if o.Owner != nil { 177 178 // query param owner 179 var qrOwner string 180 if o.Owner != nil { 181 qrOwner = *o.Owner 182 } 183 qOwner := qrOwner 184 if qOwner != "" { 185 if err := r.SetQueryParam("owner", qOwner); err != nil { 186 return err 187 } 188 } 189 190 } 191 192 if len(res) > 0 { 193 return errors.CompositeValidationError(res...) 194 } 195 return nil 196 }