github.com/kubearmor/cilium@v1.6.12/api/v1/client/ipam/post_ip_a_m_ip_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 17 strfmt "github.com/go-openapi/strfmt" 18 ) 19 20 // NewPostIPAMIPParams creates a new PostIPAMIPParams object 21 // with the default values initialized. 22 func NewPostIPAMIPParams() *PostIPAMIPParams { 23 var () 24 return &PostIPAMIPParams{ 25 26 timeout: cr.DefaultTimeout, 27 } 28 } 29 30 // NewPostIPAMIPParamsWithTimeout creates a new PostIPAMIPParams object 31 // with the default values initialized, and the ability to set a timeout on a request 32 func NewPostIPAMIPParamsWithTimeout(timeout time.Duration) *PostIPAMIPParams { 33 var () 34 return &PostIPAMIPParams{ 35 36 timeout: timeout, 37 } 38 } 39 40 // NewPostIPAMIPParamsWithContext creates a new PostIPAMIPParams object 41 // with the default values initialized, and the ability to set a context for a request 42 func NewPostIPAMIPParamsWithContext(ctx context.Context) *PostIPAMIPParams { 43 var () 44 return &PostIPAMIPParams{ 45 46 Context: ctx, 47 } 48 } 49 50 // NewPostIPAMIPParamsWithHTTPClient creates a new PostIPAMIPParams object 51 // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 func NewPostIPAMIPParamsWithHTTPClient(client *http.Client) *PostIPAMIPParams { 53 var () 54 return &PostIPAMIPParams{ 55 HTTPClient: client, 56 } 57 } 58 59 /*PostIPAMIPParams contains all the parameters to send to the API endpoint 60 for the post IP a m IP operation typically these are written to a http.Request 61 */ 62 type PostIPAMIPParams struct { 63 64 /*IP 65 IP address 66 67 */ 68 IP 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 IP params 78 func (o *PostIPAMIPParams) WithTimeout(timeout time.Duration) *PostIPAMIPParams { 79 o.SetTimeout(timeout) 80 return o 81 } 82 83 // SetTimeout adds the timeout to the post IP a m IP params 84 func (o *PostIPAMIPParams) SetTimeout(timeout time.Duration) { 85 o.timeout = timeout 86 } 87 88 // WithContext adds the context to the post IP a m IP params 89 func (o *PostIPAMIPParams) WithContext(ctx context.Context) *PostIPAMIPParams { 90 o.SetContext(ctx) 91 return o 92 } 93 94 // SetContext adds the context to the post IP a m IP params 95 func (o *PostIPAMIPParams) SetContext(ctx context.Context) { 96 o.Context = ctx 97 } 98 99 // WithHTTPClient adds the HTTPClient to the post IP a m IP params 100 func (o *PostIPAMIPParams) WithHTTPClient(client *http.Client) *PostIPAMIPParams { 101 o.SetHTTPClient(client) 102 return o 103 } 104 105 // SetHTTPClient adds the HTTPClient to the post IP a m IP params 106 func (o *PostIPAMIPParams) SetHTTPClient(client *http.Client) { 107 o.HTTPClient = client 108 } 109 110 // WithIP adds the ip to the post IP a m IP params 111 func (o *PostIPAMIPParams) WithIP(ip string) *PostIPAMIPParams { 112 o.SetIP(ip) 113 return o 114 } 115 116 // SetIP adds the ip to the post IP a m IP params 117 func (o *PostIPAMIPParams) SetIP(ip string) { 118 o.IP = ip 119 } 120 121 // WithOwner adds the owner to the post IP a m IP params 122 func (o *PostIPAMIPParams) WithOwner(owner *string) *PostIPAMIPParams { 123 o.SetOwner(owner) 124 return o 125 } 126 127 // SetOwner adds the owner to the post IP a m IP params 128 func (o *PostIPAMIPParams) SetOwner(owner *string) { 129 o.Owner = owner 130 } 131 132 // WriteToRequest writes these params to a swagger request 133 func (o *PostIPAMIPParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 134 135 if err := r.SetTimeout(o.timeout); err != nil { 136 return err 137 } 138 var res []error 139 140 // path param ip 141 if err := r.SetPathParam("ip", o.IP); err != nil { 142 return err 143 } 144 145 if o.Owner != nil { 146 147 // query param owner 148 var qrOwner string 149 if o.Owner != nil { 150 qrOwner = *o.Owner 151 } 152 qOwner := qrOwner 153 if qOwner != "" { 154 if err := r.SetQueryParam("owner", qOwner); err != nil { 155 return err 156 } 157 } 158 159 } 160 161 if len(res) > 0 { 162 return errors.CompositeValidationError(res...) 163 } 164 return nil 165 }