github.com/kubearmor/cilium@v1.6.12/api/v1/client/policy/policy_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package policy 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 "github.com/go-openapi/runtime" 10 11 strfmt "github.com/go-openapi/strfmt" 12 ) 13 14 // New creates a new policy API client. 15 func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { 16 return &Client{transport: transport, formats: formats} 17 } 18 19 /* 20 Client for policy API 21 */ 22 type Client struct { 23 transport runtime.ClientTransport 24 formats strfmt.Registry 25 } 26 27 /* 28 DeleteFqdnCache deletes matching DNS lookups from the policy generation cache 29 30 Deletes matching DNS lookups from the cache, optionally restricted by 31 DNS name. The removed IP data will no longer be used in generated 32 policies. 33 34 */ 35 func (a *Client) DeleteFqdnCache(params *DeleteFqdnCacheParams) (*DeleteFqdnCacheOK, error) { 36 // TODO: Validate the params before sending 37 if params == nil { 38 params = NewDeleteFqdnCacheParams() 39 } 40 41 result, err := a.transport.Submit(&runtime.ClientOperation{ 42 ID: "DeleteFqdnCache", 43 Method: "DELETE", 44 PathPattern: "/fqdn/cache", 45 ProducesMediaTypes: []string{"application/json"}, 46 ConsumesMediaTypes: []string{"application/json"}, 47 Schemes: []string{"http"}, 48 Params: params, 49 Reader: &DeleteFqdnCacheReader{formats: a.formats}, 50 Context: params.Context, 51 Client: params.HTTPClient, 52 }) 53 if err != nil { 54 return nil, err 55 } 56 return result.(*DeleteFqdnCacheOK), nil 57 58 } 59 60 /* 61 DeletePolicy deletes a policy sub tree 62 */ 63 func (a *Client) DeletePolicy(params *DeletePolicyParams) (*DeletePolicyOK, error) { 64 // TODO: Validate the params before sending 65 if params == nil { 66 params = NewDeletePolicyParams() 67 } 68 69 result, err := a.transport.Submit(&runtime.ClientOperation{ 70 ID: "DeletePolicy", 71 Method: "DELETE", 72 PathPattern: "/policy", 73 ProducesMediaTypes: []string{"application/json"}, 74 ConsumesMediaTypes: []string{"application/json"}, 75 Schemes: []string{"http"}, 76 Params: params, 77 Reader: &DeletePolicyReader{formats: a.formats}, 78 Context: params.Context, 79 Client: params.HTTPClient, 80 }) 81 if err != nil { 82 return nil, err 83 } 84 return result.(*DeletePolicyOK), nil 85 86 } 87 88 /* 89 GetFqdnCache retrieves the list of DNS lookups intercepted from all endpoints 90 91 Retrieves the list of DNS lookups intercepted from endpoints, 92 optionally filtered by endpoint id, DNS name, or CIDR IP range. 93 94 */ 95 func (a *Client) GetFqdnCache(params *GetFqdnCacheParams) (*GetFqdnCacheOK, error) { 96 // TODO: Validate the params before sending 97 if params == nil { 98 params = NewGetFqdnCacheParams() 99 } 100 101 result, err := a.transport.Submit(&runtime.ClientOperation{ 102 ID: "GetFqdnCache", 103 Method: "GET", 104 PathPattern: "/fqdn/cache", 105 ProducesMediaTypes: []string{"application/json"}, 106 ConsumesMediaTypes: []string{"application/json"}, 107 Schemes: []string{"http"}, 108 Params: params, 109 Reader: &GetFqdnCacheReader{formats: a.formats}, 110 Context: params.Context, 111 Client: params.HTTPClient, 112 }) 113 if err != nil { 114 return nil, err 115 } 116 return result.(*GetFqdnCacheOK), nil 117 118 } 119 120 /* 121 GetFqdnCacheID retrieves the list of DNS lookups intercepted from an endpoint 122 123 Retrieves the list of DNS lookups intercepted from endpoints, 124 optionally filtered by endpoint id, DNS name, or CIDR IP range. 125 126 */ 127 func (a *Client) GetFqdnCacheID(params *GetFqdnCacheIDParams) (*GetFqdnCacheIDOK, error) { 128 // TODO: Validate the params before sending 129 if params == nil { 130 params = NewGetFqdnCacheIDParams() 131 } 132 133 result, err := a.transport.Submit(&runtime.ClientOperation{ 134 ID: "GetFqdnCacheID", 135 Method: "GET", 136 PathPattern: "/fqdn/cache/{id}", 137 ProducesMediaTypes: []string{"application/json"}, 138 ConsumesMediaTypes: []string{"application/json"}, 139 Schemes: []string{"http"}, 140 Params: params, 141 Reader: &GetFqdnCacheIDReader{formats: a.formats}, 142 Context: params.Context, 143 Client: params.HTTPClient, 144 }) 145 if err != nil { 146 return nil, err 147 } 148 return result.(*GetFqdnCacheIDOK), nil 149 150 } 151 152 /* 153 GetIdentity retrieves a list of identities that have metadata matching the provided parameters 154 155 Retrieves a list of identities that have metadata matching the provided parameters, or all identities if no parameters are provided. 156 157 */ 158 func (a *Client) GetIdentity(params *GetIdentityParams) (*GetIdentityOK, error) { 159 // TODO: Validate the params before sending 160 if params == nil { 161 params = NewGetIdentityParams() 162 } 163 164 result, err := a.transport.Submit(&runtime.ClientOperation{ 165 ID: "GetIdentity", 166 Method: "GET", 167 PathPattern: "/identity", 168 ProducesMediaTypes: []string{"application/json"}, 169 ConsumesMediaTypes: []string{"application/json"}, 170 Schemes: []string{"http"}, 171 Params: params, 172 Reader: &GetIdentityReader{formats: a.formats}, 173 Context: params.Context, 174 Client: params.HTTPClient, 175 }) 176 if err != nil { 177 return nil, err 178 } 179 return result.(*GetIdentityOK), nil 180 181 } 182 183 /* 184 GetIdentityEndpoints retrieves identities which are being used by local endpoints 185 */ 186 func (a *Client) GetIdentityEndpoints(params *GetIdentityEndpointsParams) (*GetIdentityEndpointsOK, error) { 187 // TODO: Validate the params before sending 188 if params == nil { 189 params = NewGetIdentityEndpointsParams() 190 } 191 192 result, err := a.transport.Submit(&runtime.ClientOperation{ 193 ID: "GetIdentityEndpoints", 194 Method: "GET", 195 PathPattern: "/identity/endpoints", 196 ProducesMediaTypes: []string{"application/json"}, 197 ConsumesMediaTypes: []string{"application/json"}, 198 Schemes: []string{"http"}, 199 Params: params, 200 Reader: &GetIdentityEndpointsReader{formats: a.formats}, 201 Context: params.Context, 202 Client: params.HTTPClient, 203 }) 204 if err != nil { 205 return nil, err 206 } 207 return result.(*GetIdentityEndpointsOK), nil 208 209 } 210 211 /* 212 GetIdentityID retrieves identity 213 */ 214 func (a *Client) GetIdentityID(params *GetIdentityIDParams) (*GetIdentityIDOK, error) { 215 // TODO: Validate the params before sending 216 if params == nil { 217 params = NewGetIdentityIDParams() 218 } 219 220 result, err := a.transport.Submit(&runtime.ClientOperation{ 221 ID: "GetIdentityID", 222 Method: "GET", 223 PathPattern: "/identity/{id}", 224 ProducesMediaTypes: []string{"application/json"}, 225 ConsumesMediaTypes: []string{"application/json"}, 226 Schemes: []string{"http"}, 227 Params: params, 228 Reader: &GetIdentityIDReader{formats: a.formats}, 229 Context: params.Context, 230 Client: params.HTTPClient, 231 }) 232 if err != nil { 233 return nil, err 234 } 235 return result.(*GetIdentityIDOK), nil 236 237 } 238 239 /* 240 GetPolicy retrieves entire policy tree 241 242 Returns the entire policy tree with all children. 243 244 */ 245 func (a *Client) GetPolicy(params *GetPolicyParams) (*GetPolicyOK, error) { 246 // TODO: Validate the params before sending 247 if params == nil { 248 params = NewGetPolicyParams() 249 } 250 251 result, err := a.transport.Submit(&runtime.ClientOperation{ 252 ID: "GetPolicy", 253 Method: "GET", 254 PathPattern: "/policy", 255 ProducesMediaTypes: []string{"application/json"}, 256 ConsumesMediaTypes: []string{"application/json"}, 257 Schemes: []string{"http"}, 258 Params: params, 259 Reader: &GetPolicyReader{formats: a.formats}, 260 Context: params.Context, 261 Client: params.HTTPClient, 262 }) 263 if err != nil { 264 return nil, err 265 } 266 return result.(*GetPolicyOK), nil 267 268 } 269 270 /* 271 GetPolicyResolve resolves policy for an identity context 272 */ 273 func (a *Client) GetPolicyResolve(params *GetPolicyResolveParams) (*GetPolicyResolveOK, error) { 274 // TODO: Validate the params before sending 275 if params == nil { 276 params = NewGetPolicyResolveParams() 277 } 278 279 result, err := a.transport.Submit(&runtime.ClientOperation{ 280 ID: "GetPolicyResolve", 281 Method: "GET", 282 PathPattern: "/policy/resolve", 283 ProducesMediaTypes: []string{"application/json"}, 284 ConsumesMediaTypes: []string{"application/json"}, 285 Schemes: []string{"http"}, 286 Params: params, 287 Reader: &GetPolicyResolveReader{formats: a.formats}, 288 Context: params.Context, 289 Client: params.HTTPClient, 290 }) 291 if err != nil { 292 return nil, err 293 } 294 return result.(*GetPolicyResolveOK), nil 295 296 } 297 298 /* 299 GetPolicySelectors sees what selectors match which identities 300 */ 301 func (a *Client) GetPolicySelectors(params *GetPolicySelectorsParams) (*GetPolicySelectorsOK, error) { 302 // TODO: Validate the params before sending 303 if params == nil { 304 params = NewGetPolicySelectorsParams() 305 } 306 307 result, err := a.transport.Submit(&runtime.ClientOperation{ 308 ID: "GetPolicySelectors", 309 Method: "GET", 310 PathPattern: "/policy/selectors", 311 ProducesMediaTypes: []string{"application/json"}, 312 ConsumesMediaTypes: []string{"application/json"}, 313 Schemes: []string{"http"}, 314 Params: params, 315 Reader: &GetPolicySelectorsReader{formats: a.formats}, 316 Context: params.Context, 317 Client: params.HTTPClient, 318 }) 319 if err != nil { 320 return nil, err 321 } 322 return result.(*GetPolicySelectorsOK), nil 323 324 } 325 326 /* 327 PutPolicy creates or update a policy sub tree 328 */ 329 func (a *Client) PutPolicy(params *PutPolicyParams) (*PutPolicyOK, error) { 330 // TODO: Validate the params before sending 331 if params == nil { 332 params = NewPutPolicyParams() 333 } 334 335 result, err := a.transport.Submit(&runtime.ClientOperation{ 336 ID: "PutPolicy", 337 Method: "PUT", 338 PathPattern: "/policy", 339 ProducesMediaTypes: []string{"application/json"}, 340 ConsumesMediaTypes: []string{"application/json"}, 341 Schemes: []string{"http"}, 342 Params: params, 343 Reader: &PutPolicyReader{formats: a.formats}, 344 Context: params.Context, 345 Client: params.HTTPClient, 346 }) 347 if err != nil { 348 return nil, err 349 } 350 return result.(*PutPolicyOK), nil 351 352 } 353 354 // SetTransport changes the transport on the client 355 func (a *Client) SetTransport(transport runtime.ClientTransport) { 356 a.transport = transport 357 }