github.com/cilium/cilium@v1.16.2/api/v1/server/restapi/cilium_api_api.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 restapi 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 "fmt" 13 "net/http" 14 "strings" 15 16 "github.com/go-openapi/errors" 17 "github.com/go-openapi/loads" 18 "github.com/go-openapi/runtime" 19 "github.com/go-openapi/runtime/middleware" 20 "github.com/go-openapi/runtime/security" 21 "github.com/go-openapi/spec" 22 "github.com/go-openapi/strfmt" 23 "github.com/go-openapi/swag" 24 25 "github.com/cilium/cilium/api/v1/server/restapi/bgp" 26 "github.com/cilium/cilium/api/v1/server/restapi/daemon" 27 "github.com/cilium/cilium/api/v1/server/restapi/endpoint" 28 "github.com/cilium/cilium/api/v1/server/restapi/ipam" 29 "github.com/cilium/cilium/api/v1/server/restapi/metrics" 30 "github.com/cilium/cilium/api/v1/server/restapi/policy" 31 "github.com/cilium/cilium/api/v1/server/restapi/prefilter" 32 "github.com/cilium/cilium/api/v1/server/restapi/recorder" 33 "github.com/cilium/cilium/api/v1/server/restapi/service" 34 ) 35 36 // NewCiliumAPIAPI creates a new CiliumAPI instance 37 func NewCiliumAPIAPI(spec *loads.Document) *CiliumAPIAPI { 38 return &CiliumAPIAPI{ 39 handlers: make(map[string]map[string]http.Handler), 40 formats: strfmt.Default, 41 defaultConsumes: "application/json", 42 defaultProduces: "application/json", 43 customConsumers: make(map[string]runtime.Consumer), 44 customProducers: make(map[string]runtime.Producer), 45 PreServerShutdown: func() {}, 46 ServerShutdown: func() {}, 47 spec: spec, 48 useSwaggerUI: false, 49 ServeError: errors.ServeError, 50 BasicAuthenticator: security.BasicAuth, 51 APIKeyAuthenticator: security.APIKeyAuth, 52 BearerAuthenticator: security.BearerAuth, 53 54 JSONConsumer: runtime.JSONConsumer(), 55 56 JSONProducer: runtime.JSONProducer(), 57 58 EndpointDeleteEndpointHandler: endpoint.DeleteEndpointHandlerFunc(func(params endpoint.DeleteEndpointParams) middleware.Responder { 59 return middleware.NotImplemented("operation endpoint.DeleteEndpoint has not yet been implemented") 60 }), 61 EndpointDeleteEndpointIDHandler: endpoint.DeleteEndpointIDHandlerFunc(func(params endpoint.DeleteEndpointIDParams) middleware.Responder { 62 return middleware.NotImplemented("operation endpoint.DeleteEndpointID has not yet been implemented") 63 }), 64 PolicyDeleteFqdnCacheHandler: policy.DeleteFqdnCacheHandlerFunc(func(params policy.DeleteFqdnCacheParams) middleware.Responder { 65 return middleware.NotImplemented("operation policy.DeleteFqdnCache has not yet been implemented") 66 }), 67 IpamDeleteIpamIPHandler: ipam.DeleteIpamIPHandlerFunc(func(params ipam.DeleteIpamIPParams) middleware.Responder { 68 return middleware.NotImplemented("operation ipam.DeleteIpamIP has not yet been implemented") 69 }), 70 PolicyDeletePolicyHandler: policy.DeletePolicyHandlerFunc(func(params policy.DeletePolicyParams) middleware.Responder { 71 return middleware.NotImplemented("operation policy.DeletePolicy has not yet been implemented") 72 }), 73 PrefilterDeletePrefilterHandler: prefilter.DeletePrefilterHandlerFunc(func(params prefilter.DeletePrefilterParams) middleware.Responder { 74 return middleware.NotImplemented("operation prefilter.DeletePrefilter has not yet been implemented") 75 }), 76 RecorderDeleteRecorderIDHandler: recorder.DeleteRecorderIDHandlerFunc(func(params recorder.DeleteRecorderIDParams) middleware.Responder { 77 return middleware.NotImplemented("operation recorder.DeleteRecorderID has not yet been implemented") 78 }), 79 ServiceDeleteServiceIDHandler: service.DeleteServiceIDHandlerFunc(func(params service.DeleteServiceIDParams) middleware.Responder { 80 return middleware.NotImplemented("operation service.DeleteServiceID has not yet been implemented") 81 }), 82 BgpGetBgpPeersHandler: bgp.GetBgpPeersHandlerFunc(func(params bgp.GetBgpPeersParams) middleware.Responder { 83 return middleware.NotImplemented("operation bgp.GetBgpPeers has not yet been implemented") 84 }), 85 BgpGetBgpRoutePoliciesHandler: bgp.GetBgpRoutePoliciesHandlerFunc(func(params bgp.GetBgpRoutePoliciesParams) middleware.Responder { 86 return middleware.NotImplemented("operation bgp.GetBgpRoutePolicies has not yet been implemented") 87 }), 88 BgpGetBgpRoutesHandler: bgp.GetBgpRoutesHandlerFunc(func(params bgp.GetBgpRoutesParams) middleware.Responder { 89 return middleware.NotImplemented("operation bgp.GetBgpRoutes has not yet been implemented") 90 }), 91 DaemonGetCgroupDumpMetadataHandler: daemon.GetCgroupDumpMetadataHandlerFunc(func(params daemon.GetCgroupDumpMetadataParams) middleware.Responder { 92 return middleware.NotImplemented("operation daemon.GetCgroupDumpMetadata has not yet been implemented") 93 }), 94 DaemonGetClusterNodesHandler: daemon.GetClusterNodesHandlerFunc(func(params daemon.GetClusterNodesParams) middleware.Responder { 95 return middleware.NotImplemented("operation daemon.GetClusterNodes has not yet been implemented") 96 }), 97 DaemonGetConfigHandler: daemon.GetConfigHandlerFunc(func(params daemon.GetConfigParams) middleware.Responder { 98 return middleware.NotImplemented("operation daemon.GetConfig has not yet been implemented") 99 }), 100 DaemonGetDebuginfoHandler: daemon.GetDebuginfoHandlerFunc(func(params daemon.GetDebuginfoParams) middleware.Responder { 101 return middleware.NotImplemented("operation daemon.GetDebuginfo has not yet been implemented") 102 }), 103 EndpointGetEndpointHandler: endpoint.GetEndpointHandlerFunc(func(params endpoint.GetEndpointParams) middleware.Responder { 104 return middleware.NotImplemented("operation endpoint.GetEndpoint has not yet been implemented") 105 }), 106 EndpointGetEndpointIDHandler: endpoint.GetEndpointIDHandlerFunc(func(params endpoint.GetEndpointIDParams) middleware.Responder { 107 return middleware.NotImplemented("operation endpoint.GetEndpointID has not yet been implemented") 108 }), 109 EndpointGetEndpointIDConfigHandler: endpoint.GetEndpointIDConfigHandlerFunc(func(params endpoint.GetEndpointIDConfigParams) middleware.Responder { 110 return middleware.NotImplemented("operation endpoint.GetEndpointIDConfig has not yet been implemented") 111 }), 112 EndpointGetEndpointIDHealthzHandler: endpoint.GetEndpointIDHealthzHandlerFunc(func(params endpoint.GetEndpointIDHealthzParams) middleware.Responder { 113 return middleware.NotImplemented("operation endpoint.GetEndpointIDHealthz has not yet been implemented") 114 }), 115 EndpointGetEndpointIDLabelsHandler: endpoint.GetEndpointIDLabelsHandlerFunc(func(params endpoint.GetEndpointIDLabelsParams) middleware.Responder { 116 return middleware.NotImplemented("operation endpoint.GetEndpointIDLabels has not yet been implemented") 117 }), 118 EndpointGetEndpointIDLogHandler: endpoint.GetEndpointIDLogHandlerFunc(func(params endpoint.GetEndpointIDLogParams) middleware.Responder { 119 return middleware.NotImplemented("operation endpoint.GetEndpointIDLog has not yet been implemented") 120 }), 121 PolicyGetFqdnCacheHandler: policy.GetFqdnCacheHandlerFunc(func(params policy.GetFqdnCacheParams) middleware.Responder { 122 return middleware.NotImplemented("operation policy.GetFqdnCache has not yet been implemented") 123 }), 124 PolicyGetFqdnCacheIDHandler: policy.GetFqdnCacheIDHandlerFunc(func(params policy.GetFqdnCacheIDParams) middleware.Responder { 125 return middleware.NotImplemented("operation policy.GetFqdnCacheID has not yet been implemented") 126 }), 127 PolicyGetFqdnNamesHandler: policy.GetFqdnNamesHandlerFunc(func(params policy.GetFqdnNamesParams) middleware.Responder { 128 return middleware.NotImplemented("operation policy.GetFqdnNames has not yet been implemented") 129 }), 130 DaemonGetHealthzHandler: daemon.GetHealthzHandlerFunc(func(params daemon.GetHealthzParams) middleware.Responder { 131 return middleware.NotImplemented("operation daemon.GetHealthz has not yet been implemented") 132 }), 133 PolicyGetIPHandler: policy.GetIPHandlerFunc(func(params policy.GetIPParams) middleware.Responder { 134 return middleware.NotImplemented("operation policy.GetIP has not yet been implemented") 135 }), 136 PolicyGetIdentityHandler: policy.GetIdentityHandlerFunc(func(params policy.GetIdentityParams) middleware.Responder { 137 return middleware.NotImplemented("operation policy.GetIdentity has not yet been implemented") 138 }), 139 PolicyGetIdentityEndpointsHandler: policy.GetIdentityEndpointsHandlerFunc(func(params policy.GetIdentityEndpointsParams) middleware.Responder { 140 return middleware.NotImplemented("operation policy.GetIdentityEndpoints has not yet been implemented") 141 }), 142 PolicyGetIdentityIDHandler: policy.GetIdentityIDHandlerFunc(func(params policy.GetIdentityIDParams) middleware.Responder { 143 return middleware.NotImplemented("operation policy.GetIdentityID has not yet been implemented") 144 }), 145 ServiceGetLrpHandler: service.GetLrpHandlerFunc(func(params service.GetLrpParams) middleware.Responder { 146 return middleware.NotImplemented("operation service.GetLrp has not yet been implemented") 147 }), 148 DaemonGetMapHandler: daemon.GetMapHandlerFunc(func(params daemon.GetMapParams) middleware.Responder { 149 return middleware.NotImplemented("operation daemon.GetMap has not yet been implemented") 150 }), 151 DaemonGetMapNameHandler: daemon.GetMapNameHandlerFunc(func(params daemon.GetMapNameParams) middleware.Responder { 152 return middleware.NotImplemented("operation daemon.GetMapName has not yet been implemented") 153 }), 154 DaemonGetMapNameEventsHandler: daemon.GetMapNameEventsHandlerFunc(func(params daemon.GetMapNameEventsParams) middleware.Responder { 155 return middleware.NotImplemented("operation daemon.GetMapNameEvents has not yet been implemented") 156 }), 157 MetricsGetMetricsHandler: metrics.GetMetricsHandlerFunc(func(params metrics.GetMetricsParams) middleware.Responder { 158 return middleware.NotImplemented("operation metrics.GetMetrics has not yet been implemented") 159 }), 160 DaemonGetNodeIdsHandler: daemon.GetNodeIdsHandlerFunc(func(params daemon.GetNodeIdsParams) middleware.Responder { 161 return middleware.NotImplemented("operation daemon.GetNodeIds has not yet been implemented") 162 }), 163 PolicyGetPolicyHandler: policy.GetPolicyHandlerFunc(func(params policy.GetPolicyParams) middleware.Responder { 164 return middleware.NotImplemented("operation policy.GetPolicy has not yet been implemented") 165 }), 166 PolicyGetPolicySelectorsHandler: policy.GetPolicySelectorsHandlerFunc(func(params policy.GetPolicySelectorsParams) middleware.Responder { 167 return middleware.NotImplemented("operation policy.GetPolicySelectors has not yet been implemented") 168 }), 169 PrefilterGetPrefilterHandler: prefilter.GetPrefilterHandlerFunc(func(params prefilter.GetPrefilterParams) middleware.Responder { 170 return middleware.NotImplemented("operation prefilter.GetPrefilter has not yet been implemented") 171 }), 172 RecorderGetRecorderHandler: recorder.GetRecorderHandlerFunc(func(params recorder.GetRecorderParams) middleware.Responder { 173 return middleware.NotImplemented("operation recorder.GetRecorder has not yet been implemented") 174 }), 175 RecorderGetRecorderIDHandler: recorder.GetRecorderIDHandlerFunc(func(params recorder.GetRecorderIDParams) middleware.Responder { 176 return middleware.NotImplemented("operation recorder.GetRecorderID has not yet been implemented") 177 }), 178 RecorderGetRecorderMasksHandler: recorder.GetRecorderMasksHandlerFunc(func(params recorder.GetRecorderMasksParams) middleware.Responder { 179 return middleware.NotImplemented("operation recorder.GetRecorderMasks has not yet been implemented") 180 }), 181 ServiceGetServiceHandler: service.GetServiceHandlerFunc(func(params service.GetServiceParams) middleware.Responder { 182 return middleware.NotImplemented("operation service.GetService has not yet been implemented") 183 }), 184 ServiceGetServiceIDHandler: service.GetServiceIDHandlerFunc(func(params service.GetServiceIDParams) middleware.Responder { 185 return middleware.NotImplemented("operation service.GetServiceID has not yet been implemented") 186 }), 187 DaemonPatchConfigHandler: daemon.PatchConfigHandlerFunc(func(params daemon.PatchConfigParams) middleware.Responder { 188 return middleware.NotImplemented("operation daemon.PatchConfig has not yet been implemented") 189 }), 190 EndpointPatchEndpointIDHandler: endpoint.PatchEndpointIDHandlerFunc(func(params endpoint.PatchEndpointIDParams) middleware.Responder { 191 return middleware.NotImplemented("operation endpoint.PatchEndpointID has not yet been implemented") 192 }), 193 EndpointPatchEndpointIDConfigHandler: endpoint.PatchEndpointIDConfigHandlerFunc(func(params endpoint.PatchEndpointIDConfigParams) middleware.Responder { 194 return middleware.NotImplemented("operation endpoint.PatchEndpointIDConfig has not yet been implemented") 195 }), 196 EndpointPatchEndpointIDLabelsHandler: endpoint.PatchEndpointIDLabelsHandlerFunc(func(params endpoint.PatchEndpointIDLabelsParams) middleware.Responder { 197 return middleware.NotImplemented("operation endpoint.PatchEndpointIDLabels has not yet been implemented") 198 }), 199 PrefilterPatchPrefilterHandler: prefilter.PatchPrefilterHandlerFunc(func(params prefilter.PatchPrefilterParams) middleware.Responder { 200 return middleware.NotImplemented("operation prefilter.PatchPrefilter has not yet been implemented") 201 }), 202 IpamPostIpamHandler: ipam.PostIpamHandlerFunc(func(params ipam.PostIpamParams) middleware.Responder { 203 return middleware.NotImplemented("operation ipam.PostIpam has not yet been implemented") 204 }), 205 IpamPostIpamIPHandler: ipam.PostIpamIPHandlerFunc(func(params ipam.PostIpamIPParams) middleware.Responder { 206 return middleware.NotImplemented("operation ipam.PostIpamIP has not yet been implemented") 207 }), 208 EndpointPutEndpointIDHandler: endpoint.PutEndpointIDHandlerFunc(func(params endpoint.PutEndpointIDParams) middleware.Responder { 209 return middleware.NotImplemented("operation endpoint.PutEndpointID has not yet been implemented") 210 }), 211 PolicyPutPolicyHandler: policy.PutPolicyHandlerFunc(func(params policy.PutPolicyParams) middleware.Responder { 212 return middleware.NotImplemented("operation policy.PutPolicy has not yet been implemented") 213 }), 214 RecorderPutRecorderIDHandler: recorder.PutRecorderIDHandlerFunc(func(params recorder.PutRecorderIDParams) middleware.Responder { 215 return middleware.NotImplemented("operation recorder.PutRecorderID has not yet been implemented") 216 }), 217 ServicePutServiceIDHandler: service.PutServiceIDHandlerFunc(func(params service.PutServiceIDParams) middleware.Responder { 218 return middleware.NotImplemented("operation service.PutServiceID has not yet been implemented") 219 }), 220 } 221 } 222 223 /*CiliumAPIAPI Cilium */ 224 type CiliumAPIAPI struct { 225 spec *loads.Document 226 context *middleware.Context 227 handlers map[string]map[string]http.Handler 228 formats strfmt.Registry 229 customConsumers map[string]runtime.Consumer 230 customProducers map[string]runtime.Producer 231 defaultConsumes string 232 defaultProduces string 233 Middleware func(middleware.Builder) http.Handler 234 useSwaggerUI bool 235 236 // BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function. 237 // It has a default implementation in the security package, however you can replace it for your particular usage. 238 BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator 239 240 // APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function. 241 // It has a default implementation in the security package, however you can replace it for your particular usage. 242 APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator 243 244 // BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function. 245 // It has a default implementation in the security package, however you can replace it for your particular usage. 246 BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator 247 248 // JSONConsumer registers a consumer for the following mime types: 249 // - application/json 250 JSONConsumer runtime.Consumer 251 252 // JSONProducer registers a producer for the following mime types: 253 // - application/json 254 JSONProducer runtime.Producer 255 256 // EndpointDeleteEndpointHandler sets the operation handler for the delete endpoint operation 257 EndpointDeleteEndpointHandler endpoint.DeleteEndpointHandler 258 // EndpointDeleteEndpointIDHandler sets the operation handler for the delete endpoint ID operation 259 EndpointDeleteEndpointIDHandler endpoint.DeleteEndpointIDHandler 260 // PolicyDeleteFqdnCacheHandler sets the operation handler for the delete fqdn cache operation 261 PolicyDeleteFqdnCacheHandler policy.DeleteFqdnCacheHandler 262 // IpamDeleteIpamIPHandler sets the operation handler for the delete ipam IP operation 263 IpamDeleteIpamIPHandler ipam.DeleteIpamIPHandler 264 // PolicyDeletePolicyHandler sets the operation handler for the delete policy operation 265 PolicyDeletePolicyHandler policy.DeletePolicyHandler 266 // PrefilterDeletePrefilterHandler sets the operation handler for the delete prefilter operation 267 PrefilterDeletePrefilterHandler prefilter.DeletePrefilterHandler 268 // RecorderDeleteRecorderIDHandler sets the operation handler for the delete recorder ID operation 269 RecorderDeleteRecorderIDHandler recorder.DeleteRecorderIDHandler 270 // ServiceDeleteServiceIDHandler sets the operation handler for the delete service ID operation 271 ServiceDeleteServiceIDHandler service.DeleteServiceIDHandler 272 // BgpGetBgpPeersHandler sets the operation handler for the get bgp peers operation 273 BgpGetBgpPeersHandler bgp.GetBgpPeersHandler 274 // BgpGetBgpRoutePoliciesHandler sets the operation handler for the get bgp route policies operation 275 BgpGetBgpRoutePoliciesHandler bgp.GetBgpRoutePoliciesHandler 276 // BgpGetBgpRoutesHandler sets the operation handler for the get bgp routes operation 277 BgpGetBgpRoutesHandler bgp.GetBgpRoutesHandler 278 // DaemonGetCgroupDumpMetadataHandler sets the operation handler for the get cgroup dump metadata operation 279 DaemonGetCgroupDumpMetadataHandler daemon.GetCgroupDumpMetadataHandler 280 // DaemonGetClusterNodesHandler sets the operation handler for the get cluster nodes operation 281 DaemonGetClusterNodesHandler daemon.GetClusterNodesHandler 282 // DaemonGetConfigHandler sets the operation handler for the get config operation 283 DaemonGetConfigHandler daemon.GetConfigHandler 284 // DaemonGetDebuginfoHandler sets the operation handler for the get debuginfo operation 285 DaemonGetDebuginfoHandler daemon.GetDebuginfoHandler 286 // EndpointGetEndpointHandler sets the operation handler for the get endpoint operation 287 EndpointGetEndpointHandler endpoint.GetEndpointHandler 288 // EndpointGetEndpointIDHandler sets the operation handler for the get endpoint ID operation 289 EndpointGetEndpointIDHandler endpoint.GetEndpointIDHandler 290 // EndpointGetEndpointIDConfigHandler sets the operation handler for the get endpoint ID config operation 291 EndpointGetEndpointIDConfigHandler endpoint.GetEndpointIDConfigHandler 292 // EndpointGetEndpointIDHealthzHandler sets the operation handler for the get endpoint ID healthz operation 293 EndpointGetEndpointIDHealthzHandler endpoint.GetEndpointIDHealthzHandler 294 // EndpointGetEndpointIDLabelsHandler sets the operation handler for the get endpoint ID labels operation 295 EndpointGetEndpointIDLabelsHandler endpoint.GetEndpointIDLabelsHandler 296 // EndpointGetEndpointIDLogHandler sets the operation handler for the get endpoint ID log operation 297 EndpointGetEndpointIDLogHandler endpoint.GetEndpointIDLogHandler 298 // PolicyGetFqdnCacheHandler sets the operation handler for the get fqdn cache operation 299 PolicyGetFqdnCacheHandler policy.GetFqdnCacheHandler 300 // PolicyGetFqdnCacheIDHandler sets the operation handler for the get fqdn cache ID operation 301 PolicyGetFqdnCacheIDHandler policy.GetFqdnCacheIDHandler 302 // PolicyGetFqdnNamesHandler sets the operation handler for the get fqdn names operation 303 PolicyGetFqdnNamesHandler policy.GetFqdnNamesHandler 304 // DaemonGetHealthzHandler sets the operation handler for the get healthz operation 305 DaemonGetHealthzHandler daemon.GetHealthzHandler 306 // PolicyGetIPHandler sets the operation handler for the get IP operation 307 PolicyGetIPHandler policy.GetIPHandler 308 // PolicyGetIdentityHandler sets the operation handler for the get identity operation 309 PolicyGetIdentityHandler policy.GetIdentityHandler 310 // PolicyGetIdentityEndpointsHandler sets the operation handler for the get identity endpoints operation 311 PolicyGetIdentityEndpointsHandler policy.GetIdentityEndpointsHandler 312 // PolicyGetIdentityIDHandler sets the operation handler for the get identity ID operation 313 PolicyGetIdentityIDHandler policy.GetIdentityIDHandler 314 // ServiceGetLrpHandler sets the operation handler for the get lrp operation 315 ServiceGetLrpHandler service.GetLrpHandler 316 // DaemonGetMapHandler sets the operation handler for the get map operation 317 DaemonGetMapHandler daemon.GetMapHandler 318 // DaemonGetMapNameHandler sets the operation handler for the get map name operation 319 DaemonGetMapNameHandler daemon.GetMapNameHandler 320 // DaemonGetMapNameEventsHandler sets the operation handler for the get map name events operation 321 DaemonGetMapNameEventsHandler daemon.GetMapNameEventsHandler 322 // MetricsGetMetricsHandler sets the operation handler for the get metrics operation 323 MetricsGetMetricsHandler metrics.GetMetricsHandler 324 // DaemonGetNodeIdsHandler sets the operation handler for the get node ids operation 325 DaemonGetNodeIdsHandler daemon.GetNodeIdsHandler 326 // PolicyGetPolicyHandler sets the operation handler for the get policy operation 327 PolicyGetPolicyHandler policy.GetPolicyHandler 328 // PolicyGetPolicySelectorsHandler sets the operation handler for the get policy selectors operation 329 PolicyGetPolicySelectorsHandler policy.GetPolicySelectorsHandler 330 // PrefilterGetPrefilterHandler sets the operation handler for the get prefilter operation 331 PrefilterGetPrefilterHandler prefilter.GetPrefilterHandler 332 // RecorderGetRecorderHandler sets the operation handler for the get recorder operation 333 RecorderGetRecorderHandler recorder.GetRecorderHandler 334 // RecorderGetRecorderIDHandler sets the operation handler for the get recorder ID operation 335 RecorderGetRecorderIDHandler recorder.GetRecorderIDHandler 336 // RecorderGetRecorderMasksHandler sets the operation handler for the get recorder masks operation 337 RecorderGetRecorderMasksHandler recorder.GetRecorderMasksHandler 338 // ServiceGetServiceHandler sets the operation handler for the get service operation 339 ServiceGetServiceHandler service.GetServiceHandler 340 // ServiceGetServiceIDHandler sets the operation handler for the get service ID operation 341 ServiceGetServiceIDHandler service.GetServiceIDHandler 342 // DaemonPatchConfigHandler sets the operation handler for the patch config operation 343 DaemonPatchConfigHandler daemon.PatchConfigHandler 344 // EndpointPatchEndpointIDHandler sets the operation handler for the patch endpoint ID operation 345 EndpointPatchEndpointIDHandler endpoint.PatchEndpointIDHandler 346 // EndpointPatchEndpointIDConfigHandler sets the operation handler for the patch endpoint ID config operation 347 EndpointPatchEndpointIDConfigHandler endpoint.PatchEndpointIDConfigHandler 348 // EndpointPatchEndpointIDLabelsHandler sets the operation handler for the patch endpoint ID labels operation 349 EndpointPatchEndpointIDLabelsHandler endpoint.PatchEndpointIDLabelsHandler 350 // PrefilterPatchPrefilterHandler sets the operation handler for the patch prefilter operation 351 PrefilterPatchPrefilterHandler prefilter.PatchPrefilterHandler 352 // IpamPostIpamHandler sets the operation handler for the post ipam operation 353 IpamPostIpamHandler ipam.PostIpamHandler 354 // IpamPostIpamIPHandler sets the operation handler for the post ipam IP operation 355 IpamPostIpamIPHandler ipam.PostIpamIPHandler 356 // EndpointPutEndpointIDHandler sets the operation handler for the put endpoint ID operation 357 EndpointPutEndpointIDHandler endpoint.PutEndpointIDHandler 358 // PolicyPutPolicyHandler sets the operation handler for the put policy operation 359 PolicyPutPolicyHandler policy.PutPolicyHandler 360 // RecorderPutRecorderIDHandler sets the operation handler for the put recorder ID operation 361 RecorderPutRecorderIDHandler recorder.PutRecorderIDHandler 362 // ServicePutServiceIDHandler sets the operation handler for the put service ID operation 363 ServicePutServiceIDHandler service.PutServiceIDHandler 364 365 // ServeError is called when an error is received, there is a default handler 366 // but you can set your own with this 367 ServeError func(http.ResponseWriter, *http.Request, error) 368 369 // PreServerShutdown is called before the HTTP(S) server is shutdown 370 // This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic 371 PreServerShutdown func() 372 373 // ServerShutdown is called when the HTTP(S) server is shut down and done 374 // handling all active connections and does not accept connections any more 375 ServerShutdown func() 376 377 // Custom command line argument groups with their descriptions 378 CommandLineOptionsGroups []swag.CommandLineOptionsGroup 379 380 // User defined logger function. 381 Logger func(string, ...interface{}) 382 } 383 384 // UseRedoc for documentation at /docs 385 func (o *CiliumAPIAPI) UseRedoc() { 386 o.useSwaggerUI = false 387 } 388 389 // UseSwaggerUI for documentation at /docs 390 func (o *CiliumAPIAPI) UseSwaggerUI() { 391 o.useSwaggerUI = true 392 } 393 394 // SetDefaultProduces sets the default produces media type 395 func (o *CiliumAPIAPI) SetDefaultProduces(mediaType string) { 396 o.defaultProduces = mediaType 397 } 398 399 // SetDefaultConsumes returns the default consumes media type 400 func (o *CiliumAPIAPI) SetDefaultConsumes(mediaType string) { 401 o.defaultConsumes = mediaType 402 } 403 404 // SetSpec sets a spec that will be served for the clients. 405 func (o *CiliumAPIAPI) SetSpec(spec *loads.Document) { 406 o.spec = spec 407 } 408 409 // DefaultProduces returns the default produces media type 410 func (o *CiliumAPIAPI) DefaultProduces() string { 411 return o.defaultProduces 412 } 413 414 // DefaultConsumes returns the default consumes media type 415 func (o *CiliumAPIAPI) DefaultConsumes() string { 416 return o.defaultConsumes 417 } 418 419 // Formats returns the registered string formats 420 func (o *CiliumAPIAPI) Formats() strfmt.Registry { 421 return o.formats 422 } 423 424 // RegisterFormat registers a custom format validator 425 func (o *CiliumAPIAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { 426 o.formats.Add(name, format, validator) 427 } 428 429 // Validate validates the registrations in the CiliumAPIAPI 430 func (o *CiliumAPIAPI) Validate() error { 431 var unregistered []string 432 433 if o.JSONConsumer == nil { 434 unregistered = append(unregistered, "JSONConsumer") 435 } 436 437 if o.JSONProducer == nil { 438 unregistered = append(unregistered, "JSONProducer") 439 } 440 441 if o.EndpointDeleteEndpointHandler == nil { 442 unregistered = append(unregistered, "endpoint.DeleteEndpointHandler") 443 } 444 if o.EndpointDeleteEndpointIDHandler == nil { 445 unregistered = append(unregistered, "endpoint.DeleteEndpointIDHandler") 446 } 447 if o.PolicyDeleteFqdnCacheHandler == nil { 448 unregistered = append(unregistered, "policy.DeleteFqdnCacheHandler") 449 } 450 if o.IpamDeleteIpamIPHandler == nil { 451 unregistered = append(unregistered, "ipam.DeleteIpamIPHandler") 452 } 453 if o.PolicyDeletePolicyHandler == nil { 454 unregistered = append(unregistered, "policy.DeletePolicyHandler") 455 } 456 if o.PrefilterDeletePrefilterHandler == nil { 457 unregistered = append(unregistered, "prefilter.DeletePrefilterHandler") 458 } 459 if o.RecorderDeleteRecorderIDHandler == nil { 460 unregistered = append(unregistered, "recorder.DeleteRecorderIDHandler") 461 } 462 if o.ServiceDeleteServiceIDHandler == nil { 463 unregistered = append(unregistered, "service.DeleteServiceIDHandler") 464 } 465 if o.BgpGetBgpPeersHandler == nil { 466 unregistered = append(unregistered, "bgp.GetBgpPeersHandler") 467 } 468 if o.BgpGetBgpRoutePoliciesHandler == nil { 469 unregistered = append(unregistered, "bgp.GetBgpRoutePoliciesHandler") 470 } 471 if o.BgpGetBgpRoutesHandler == nil { 472 unregistered = append(unregistered, "bgp.GetBgpRoutesHandler") 473 } 474 if o.DaemonGetCgroupDumpMetadataHandler == nil { 475 unregistered = append(unregistered, "daemon.GetCgroupDumpMetadataHandler") 476 } 477 if o.DaemonGetClusterNodesHandler == nil { 478 unregistered = append(unregistered, "daemon.GetClusterNodesHandler") 479 } 480 if o.DaemonGetConfigHandler == nil { 481 unregistered = append(unregistered, "daemon.GetConfigHandler") 482 } 483 if o.DaemonGetDebuginfoHandler == nil { 484 unregistered = append(unregistered, "daemon.GetDebuginfoHandler") 485 } 486 if o.EndpointGetEndpointHandler == nil { 487 unregistered = append(unregistered, "endpoint.GetEndpointHandler") 488 } 489 if o.EndpointGetEndpointIDHandler == nil { 490 unregistered = append(unregistered, "endpoint.GetEndpointIDHandler") 491 } 492 if o.EndpointGetEndpointIDConfigHandler == nil { 493 unregistered = append(unregistered, "endpoint.GetEndpointIDConfigHandler") 494 } 495 if o.EndpointGetEndpointIDHealthzHandler == nil { 496 unregistered = append(unregistered, "endpoint.GetEndpointIDHealthzHandler") 497 } 498 if o.EndpointGetEndpointIDLabelsHandler == nil { 499 unregistered = append(unregistered, "endpoint.GetEndpointIDLabelsHandler") 500 } 501 if o.EndpointGetEndpointIDLogHandler == nil { 502 unregistered = append(unregistered, "endpoint.GetEndpointIDLogHandler") 503 } 504 if o.PolicyGetFqdnCacheHandler == nil { 505 unregistered = append(unregistered, "policy.GetFqdnCacheHandler") 506 } 507 if o.PolicyGetFqdnCacheIDHandler == nil { 508 unregistered = append(unregistered, "policy.GetFqdnCacheIDHandler") 509 } 510 if o.PolicyGetFqdnNamesHandler == nil { 511 unregistered = append(unregistered, "policy.GetFqdnNamesHandler") 512 } 513 if o.DaemonGetHealthzHandler == nil { 514 unregistered = append(unregistered, "daemon.GetHealthzHandler") 515 } 516 if o.PolicyGetIPHandler == nil { 517 unregistered = append(unregistered, "policy.GetIPHandler") 518 } 519 if o.PolicyGetIdentityHandler == nil { 520 unregistered = append(unregistered, "policy.GetIdentityHandler") 521 } 522 if o.PolicyGetIdentityEndpointsHandler == nil { 523 unregistered = append(unregistered, "policy.GetIdentityEndpointsHandler") 524 } 525 if o.PolicyGetIdentityIDHandler == nil { 526 unregistered = append(unregistered, "policy.GetIdentityIDHandler") 527 } 528 if o.ServiceGetLrpHandler == nil { 529 unregistered = append(unregistered, "service.GetLrpHandler") 530 } 531 if o.DaemonGetMapHandler == nil { 532 unregistered = append(unregistered, "daemon.GetMapHandler") 533 } 534 if o.DaemonGetMapNameHandler == nil { 535 unregistered = append(unregistered, "daemon.GetMapNameHandler") 536 } 537 if o.DaemonGetMapNameEventsHandler == nil { 538 unregistered = append(unregistered, "daemon.GetMapNameEventsHandler") 539 } 540 if o.MetricsGetMetricsHandler == nil { 541 unregistered = append(unregistered, "metrics.GetMetricsHandler") 542 } 543 if o.DaemonGetNodeIdsHandler == nil { 544 unregistered = append(unregistered, "daemon.GetNodeIdsHandler") 545 } 546 if o.PolicyGetPolicyHandler == nil { 547 unregistered = append(unregistered, "policy.GetPolicyHandler") 548 } 549 if o.PolicyGetPolicySelectorsHandler == nil { 550 unregistered = append(unregistered, "policy.GetPolicySelectorsHandler") 551 } 552 if o.PrefilterGetPrefilterHandler == nil { 553 unregistered = append(unregistered, "prefilter.GetPrefilterHandler") 554 } 555 if o.RecorderGetRecorderHandler == nil { 556 unregistered = append(unregistered, "recorder.GetRecorderHandler") 557 } 558 if o.RecorderGetRecorderIDHandler == nil { 559 unregistered = append(unregistered, "recorder.GetRecorderIDHandler") 560 } 561 if o.RecorderGetRecorderMasksHandler == nil { 562 unregistered = append(unregistered, "recorder.GetRecorderMasksHandler") 563 } 564 if o.ServiceGetServiceHandler == nil { 565 unregistered = append(unregistered, "service.GetServiceHandler") 566 } 567 if o.ServiceGetServiceIDHandler == nil { 568 unregistered = append(unregistered, "service.GetServiceIDHandler") 569 } 570 if o.DaemonPatchConfigHandler == nil { 571 unregistered = append(unregistered, "daemon.PatchConfigHandler") 572 } 573 if o.EndpointPatchEndpointIDHandler == nil { 574 unregistered = append(unregistered, "endpoint.PatchEndpointIDHandler") 575 } 576 if o.EndpointPatchEndpointIDConfigHandler == nil { 577 unregistered = append(unregistered, "endpoint.PatchEndpointIDConfigHandler") 578 } 579 if o.EndpointPatchEndpointIDLabelsHandler == nil { 580 unregistered = append(unregistered, "endpoint.PatchEndpointIDLabelsHandler") 581 } 582 if o.PrefilterPatchPrefilterHandler == nil { 583 unregistered = append(unregistered, "prefilter.PatchPrefilterHandler") 584 } 585 if o.IpamPostIpamHandler == nil { 586 unregistered = append(unregistered, "ipam.PostIpamHandler") 587 } 588 if o.IpamPostIpamIPHandler == nil { 589 unregistered = append(unregistered, "ipam.PostIpamIPHandler") 590 } 591 if o.EndpointPutEndpointIDHandler == nil { 592 unregistered = append(unregistered, "endpoint.PutEndpointIDHandler") 593 } 594 if o.PolicyPutPolicyHandler == nil { 595 unregistered = append(unregistered, "policy.PutPolicyHandler") 596 } 597 if o.RecorderPutRecorderIDHandler == nil { 598 unregistered = append(unregistered, "recorder.PutRecorderIDHandler") 599 } 600 if o.ServicePutServiceIDHandler == nil { 601 unregistered = append(unregistered, "service.PutServiceIDHandler") 602 } 603 604 if len(unregistered) > 0 { 605 return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", ")) 606 } 607 608 return nil 609 } 610 611 // ServeErrorFor gets a error handler for a given operation id 612 func (o *CiliumAPIAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) { 613 return o.ServeError 614 } 615 616 // AuthenticatorsFor gets the authenticators for the specified security schemes 617 func (o *CiliumAPIAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { 618 return nil 619 } 620 621 // Authorizer returns the registered authorizer 622 func (o *CiliumAPIAPI) Authorizer() runtime.Authorizer { 623 return nil 624 } 625 626 // ConsumersFor gets the consumers for the specified media types. 627 // MIME type parameters are ignored here. 628 func (o *CiliumAPIAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { 629 result := make(map[string]runtime.Consumer, len(mediaTypes)) 630 for _, mt := range mediaTypes { 631 switch mt { 632 case "application/json": 633 result["application/json"] = o.JSONConsumer 634 } 635 636 if c, ok := o.customConsumers[mt]; ok { 637 result[mt] = c 638 } 639 } 640 return result 641 } 642 643 // ProducersFor gets the producers for the specified media types. 644 // MIME type parameters are ignored here. 645 func (o *CiliumAPIAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { 646 result := make(map[string]runtime.Producer, len(mediaTypes)) 647 for _, mt := range mediaTypes { 648 switch mt { 649 case "application/json": 650 result["application/json"] = o.JSONProducer 651 } 652 653 if p, ok := o.customProducers[mt]; ok { 654 result[mt] = p 655 } 656 } 657 return result 658 } 659 660 // HandlerFor gets a http.Handler for the provided operation method and path 661 func (o *CiliumAPIAPI) HandlerFor(method, path string) (http.Handler, bool) { 662 if o.handlers == nil { 663 return nil, false 664 } 665 um := strings.ToUpper(method) 666 if _, ok := o.handlers[um]; !ok { 667 return nil, false 668 } 669 if path == "/" { 670 path = "" 671 } 672 h, ok := o.handlers[um][path] 673 return h, ok 674 } 675 676 // Context returns the middleware context for the cilium API API 677 func (o *CiliumAPIAPI) Context() *middleware.Context { 678 if o.context == nil { 679 o.context = middleware.NewRoutableContext(o.spec, o, nil) 680 } 681 682 return o.context 683 } 684 685 func (o *CiliumAPIAPI) initHandlerCache() { 686 o.Context() // don't care about the result, just that the initialization happened 687 if o.handlers == nil { 688 o.handlers = make(map[string]map[string]http.Handler) 689 } 690 691 if o.handlers["DELETE"] == nil { 692 o.handlers["DELETE"] = make(map[string]http.Handler) 693 } 694 o.handlers["DELETE"]["/endpoint"] = endpoint.NewDeleteEndpoint(o.context, o.EndpointDeleteEndpointHandler) 695 if o.handlers["DELETE"] == nil { 696 o.handlers["DELETE"] = make(map[string]http.Handler) 697 } 698 o.handlers["DELETE"]["/endpoint/{id}"] = endpoint.NewDeleteEndpointID(o.context, o.EndpointDeleteEndpointIDHandler) 699 if o.handlers["DELETE"] == nil { 700 o.handlers["DELETE"] = make(map[string]http.Handler) 701 } 702 o.handlers["DELETE"]["/fqdn/cache"] = policy.NewDeleteFqdnCache(o.context, o.PolicyDeleteFqdnCacheHandler) 703 if o.handlers["DELETE"] == nil { 704 o.handlers["DELETE"] = make(map[string]http.Handler) 705 } 706 o.handlers["DELETE"]["/ipam/{ip}"] = ipam.NewDeleteIpamIP(o.context, o.IpamDeleteIpamIPHandler) 707 if o.handlers["DELETE"] == nil { 708 o.handlers["DELETE"] = make(map[string]http.Handler) 709 } 710 o.handlers["DELETE"]["/policy"] = policy.NewDeletePolicy(o.context, o.PolicyDeletePolicyHandler) 711 if o.handlers["DELETE"] == nil { 712 o.handlers["DELETE"] = make(map[string]http.Handler) 713 } 714 o.handlers["DELETE"]["/prefilter"] = prefilter.NewDeletePrefilter(o.context, o.PrefilterDeletePrefilterHandler) 715 if o.handlers["DELETE"] == nil { 716 o.handlers["DELETE"] = make(map[string]http.Handler) 717 } 718 o.handlers["DELETE"]["/recorder/{id}"] = recorder.NewDeleteRecorderID(o.context, o.RecorderDeleteRecorderIDHandler) 719 if o.handlers["DELETE"] == nil { 720 o.handlers["DELETE"] = make(map[string]http.Handler) 721 } 722 o.handlers["DELETE"]["/service/{id}"] = service.NewDeleteServiceID(o.context, o.ServiceDeleteServiceIDHandler) 723 if o.handlers["GET"] == nil { 724 o.handlers["GET"] = make(map[string]http.Handler) 725 } 726 o.handlers["GET"]["/bgp/peers"] = bgp.NewGetBgpPeers(o.context, o.BgpGetBgpPeersHandler) 727 if o.handlers["GET"] == nil { 728 o.handlers["GET"] = make(map[string]http.Handler) 729 } 730 o.handlers["GET"]["/bgp/route-policies"] = bgp.NewGetBgpRoutePolicies(o.context, o.BgpGetBgpRoutePoliciesHandler) 731 if o.handlers["GET"] == nil { 732 o.handlers["GET"] = make(map[string]http.Handler) 733 } 734 o.handlers["GET"]["/bgp/routes"] = bgp.NewGetBgpRoutes(o.context, o.BgpGetBgpRoutesHandler) 735 if o.handlers["GET"] == nil { 736 o.handlers["GET"] = make(map[string]http.Handler) 737 } 738 o.handlers["GET"]["/cgroup-dump-metadata"] = daemon.NewGetCgroupDumpMetadata(o.context, o.DaemonGetCgroupDumpMetadataHandler) 739 if o.handlers["GET"] == nil { 740 o.handlers["GET"] = make(map[string]http.Handler) 741 } 742 o.handlers["GET"]["/cluster/nodes"] = daemon.NewGetClusterNodes(o.context, o.DaemonGetClusterNodesHandler) 743 if o.handlers["GET"] == nil { 744 o.handlers["GET"] = make(map[string]http.Handler) 745 } 746 o.handlers["GET"]["/config"] = daemon.NewGetConfig(o.context, o.DaemonGetConfigHandler) 747 if o.handlers["GET"] == nil { 748 o.handlers["GET"] = make(map[string]http.Handler) 749 } 750 o.handlers["GET"]["/debuginfo"] = daemon.NewGetDebuginfo(o.context, o.DaemonGetDebuginfoHandler) 751 if o.handlers["GET"] == nil { 752 o.handlers["GET"] = make(map[string]http.Handler) 753 } 754 o.handlers["GET"]["/endpoint"] = endpoint.NewGetEndpoint(o.context, o.EndpointGetEndpointHandler) 755 if o.handlers["GET"] == nil { 756 o.handlers["GET"] = make(map[string]http.Handler) 757 } 758 o.handlers["GET"]["/endpoint/{id}"] = endpoint.NewGetEndpointID(o.context, o.EndpointGetEndpointIDHandler) 759 if o.handlers["GET"] == nil { 760 o.handlers["GET"] = make(map[string]http.Handler) 761 } 762 o.handlers["GET"]["/endpoint/{id}/config"] = endpoint.NewGetEndpointIDConfig(o.context, o.EndpointGetEndpointIDConfigHandler) 763 if o.handlers["GET"] == nil { 764 o.handlers["GET"] = make(map[string]http.Handler) 765 } 766 o.handlers["GET"]["/endpoint/{id}/healthz"] = endpoint.NewGetEndpointIDHealthz(o.context, o.EndpointGetEndpointIDHealthzHandler) 767 if o.handlers["GET"] == nil { 768 o.handlers["GET"] = make(map[string]http.Handler) 769 } 770 o.handlers["GET"]["/endpoint/{id}/labels"] = endpoint.NewGetEndpointIDLabels(o.context, o.EndpointGetEndpointIDLabelsHandler) 771 if o.handlers["GET"] == nil { 772 o.handlers["GET"] = make(map[string]http.Handler) 773 } 774 o.handlers["GET"]["/endpoint/{id}/log"] = endpoint.NewGetEndpointIDLog(o.context, o.EndpointGetEndpointIDLogHandler) 775 if o.handlers["GET"] == nil { 776 o.handlers["GET"] = make(map[string]http.Handler) 777 } 778 o.handlers["GET"]["/fqdn/cache"] = policy.NewGetFqdnCache(o.context, o.PolicyGetFqdnCacheHandler) 779 if o.handlers["GET"] == nil { 780 o.handlers["GET"] = make(map[string]http.Handler) 781 } 782 o.handlers["GET"]["/fqdn/cache/{id}"] = policy.NewGetFqdnCacheID(o.context, o.PolicyGetFqdnCacheIDHandler) 783 if o.handlers["GET"] == nil { 784 o.handlers["GET"] = make(map[string]http.Handler) 785 } 786 o.handlers["GET"]["/fqdn/names"] = policy.NewGetFqdnNames(o.context, o.PolicyGetFqdnNamesHandler) 787 if o.handlers["GET"] == nil { 788 o.handlers["GET"] = make(map[string]http.Handler) 789 } 790 o.handlers["GET"]["/healthz"] = daemon.NewGetHealthz(o.context, o.DaemonGetHealthzHandler) 791 if o.handlers["GET"] == nil { 792 o.handlers["GET"] = make(map[string]http.Handler) 793 } 794 o.handlers["GET"]["/ip"] = policy.NewGetIP(o.context, o.PolicyGetIPHandler) 795 if o.handlers["GET"] == nil { 796 o.handlers["GET"] = make(map[string]http.Handler) 797 } 798 o.handlers["GET"]["/identity"] = policy.NewGetIdentity(o.context, o.PolicyGetIdentityHandler) 799 if o.handlers["GET"] == nil { 800 o.handlers["GET"] = make(map[string]http.Handler) 801 } 802 o.handlers["GET"]["/identity/endpoints"] = policy.NewGetIdentityEndpoints(o.context, o.PolicyGetIdentityEndpointsHandler) 803 if o.handlers["GET"] == nil { 804 o.handlers["GET"] = make(map[string]http.Handler) 805 } 806 o.handlers["GET"]["/identity/{id}"] = policy.NewGetIdentityID(o.context, o.PolicyGetIdentityIDHandler) 807 if o.handlers["GET"] == nil { 808 o.handlers["GET"] = make(map[string]http.Handler) 809 } 810 o.handlers["GET"]["/lrp"] = service.NewGetLrp(o.context, o.ServiceGetLrpHandler) 811 if o.handlers["GET"] == nil { 812 o.handlers["GET"] = make(map[string]http.Handler) 813 } 814 o.handlers["GET"]["/map"] = daemon.NewGetMap(o.context, o.DaemonGetMapHandler) 815 if o.handlers["GET"] == nil { 816 o.handlers["GET"] = make(map[string]http.Handler) 817 } 818 o.handlers["GET"]["/map/{name}"] = daemon.NewGetMapName(o.context, o.DaemonGetMapNameHandler) 819 if o.handlers["GET"] == nil { 820 o.handlers["GET"] = make(map[string]http.Handler) 821 } 822 o.handlers["GET"]["/map/{name}/events"] = daemon.NewGetMapNameEvents(o.context, o.DaemonGetMapNameEventsHandler) 823 if o.handlers["GET"] == nil { 824 o.handlers["GET"] = make(map[string]http.Handler) 825 } 826 o.handlers["GET"]["/metrics"] = metrics.NewGetMetrics(o.context, o.MetricsGetMetricsHandler) 827 if o.handlers["GET"] == nil { 828 o.handlers["GET"] = make(map[string]http.Handler) 829 } 830 o.handlers["GET"]["/node/ids"] = daemon.NewGetNodeIds(o.context, o.DaemonGetNodeIdsHandler) 831 if o.handlers["GET"] == nil { 832 o.handlers["GET"] = make(map[string]http.Handler) 833 } 834 o.handlers["GET"]["/policy"] = policy.NewGetPolicy(o.context, o.PolicyGetPolicyHandler) 835 if o.handlers["GET"] == nil { 836 o.handlers["GET"] = make(map[string]http.Handler) 837 } 838 o.handlers["GET"]["/policy/selectors"] = policy.NewGetPolicySelectors(o.context, o.PolicyGetPolicySelectorsHandler) 839 if o.handlers["GET"] == nil { 840 o.handlers["GET"] = make(map[string]http.Handler) 841 } 842 o.handlers["GET"]["/prefilter"] = prefilter.NewGetPrefilter(o.context, o.PrefilterGetPrefilterHandler) 843 if o.handlers["GET"] == nil { 844 o.handlers["GET"] = make(map[string]http.Handler) 845 } 846 o.handlers["GET"]["/recorder"] = recorder.NewGetRecorder(o.context, o.RecorderGetRecorderHandler) 847 if o.handlers["GET"] == nil { 848 o.handlers["GET"] = make(map[string]http.Handler) 849 } 850 o.handlers["GET"]["/recorder/{id}"] = recorder.NewGetRecorderID(o.context, o.RecorderGetRecorderIDHandler) 851 if o.handlers["GET"] == nil { 852 o.handlers["GET"] = make(map[string]http.Handler) 853 } 854 o.handlers["GET"]["/recorder/masks"] = recorder.NewGetRecorderMasks(o.context, o.RecorderGetRecorderMasksHandler) 855 if o.handlers["GET"] == nil { 856 o.handlers["GET"] = make(map[string]http.Handler) 857 } 858 o.handlers["GET"]["/service"] = service.NewGetService(o.context, o.ServiceGetServiceHandler) 859 if o.handlers["GET"] == nil { 860 o.handlers["GET"] = make(map[string]http.Handler) 861 } 862 o.handlers["GET"]["/service/{id}"] = service.NewGetServiceID(o.context, o.ServiceGetServiceIDHandler) 863 if o.handlers["PATCH"] == nil { 864 o.handlers["PATCH"] = make(map[string]http.Handler) 865 } 866 o.handlers["PATCH"]["/config"] = daemon.NewPatchConfig(o.context, o.DaemonPatchConfigHandler) 867 if o.handlers["PATCH"] == nil { 868 o.handlers["PATCH"] = make(map[string]http.Handler) 869 } 870 o.handlers["PATCH"]["/endpoint/{id}"] = endpoint.NewPatchEndpointID(o.context, o.EndpointPatchEndpointIDHandler) 871 if o.handlers["PATCH"] == nil { 872 o.handlers["PATCH"] = make(map[string]http.Handler) 873 } 874 o.handlers["PATCH"]["/endpoint/{id}/config"] = endpoint.NewPatchEndpointIDConfig(o.context, o.EndpointPatchEndpointIDConfigHandler) 875 if o.handlers["PATCH"] == nil { 876 o.handlers["PATCH"] = make(map[string]http.Handler) 877 } 878 o.handlers["PATCH"]["/endpoint/{id}/labels"] = endpoint.NewPatchEndpointIDLabels(o.context, o.EndpointPatchEndpointIDLabelsHandler) 879 if o.handlers["PATCH"] == nil { 880 o.handlers["PATCH"] = make(map[string]http.Handler) 881 } 882 o.handlers["PATCH"]["/prefilter"] = prefilter.NewPatchPrefilter(o.context, o.PrefilterPatchPrefilterHandler) 883 if o.handlers["POST"] == nil { 884 o.handlers["POST"] = make(map[string]http.Handler) 885 } 886 o.handlers["POST"]["/ipam"] = ipam.NewPostIpam(o.context, o.IpamPostIpamHandler) 887 if o.handlers["POST"] == nil { 888 o.handlers["POST"] = make(map[string]http.Handler) 889 } 890 o.handlers["POST"]["/ipam/{ip}"] = ipam.NewPostIpamIP(o.context, o.IpamPostIpamIPHandler) 891 if o.handlers["PUT"] == nil { 892 o.handlers["PUT"] = make(map[string]http.Handler) 893 } 894 o.handlers["PUT"]["/endpoint/{id}"] = endpoint.NewPutEndpointID(o.context, o.EndpointPutEndpointIDHandler) 895 if o.handlers["PUT"] == nil { 896 o.handlers["PUT"] = make(map[string]http.Handler) 897 } 898 o.handlers["PUT"]["/policy"] = policy.NewPutPolicy(o.context, o.PolicyPutPolicyHandler) 899 if o.handlers["PUT"] == nil { 900 o.handlers["PUT"] = make(map[string]http.Handler) 901 } 902 o.handlers["PUT"]["/recorder/{id}"] = recorder.NewPutRecorderID(o.context, o.RecorderPutRecorderIDHandler) 903 if o.handlers["PUT"] == nil { 904 o.handlers["PUT"] = make(map[string]http.Handler) 905 } 906 o.handlers["PUT"]["/service/{id}"] = service.NewPutServiceID(o.context, o.ServicePutServiceIDHandler) 907 } 908 909 // Serve creates a http handler to serve the API over HTTP 910 // can be used directly in http.ListenAndServe(":8000", api.Serve(nil)) 911 func (o *CiliumAPIAPI) Serve(builder middleware.Builder) http.Handler { 912 o.Init() 913 914 if o.Middleware != nil { 915 return o.Middleware(builder) 916 } 917 if o.useSwaggerUI { 918 return o.context.APIHandlerSwaggerUI(builder) 919 } 920 return o.context.APIHandler(builder) 921 } 922 923 // Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit 924 func (o *CiliumAPIAPI) Init() { 925 if len(o.handlers) == 0 { 926 o.initHandlerCache() 927 } 928 } 929 930 // RegisterConsumer allows you to add (or override) a consumer for a media type. 931 func (o *CiliumAPIAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) { 932 o.customConsumers[mediaType] = consumer 933 } 934 935 // RegisterProducer allows you to add (or override) a producer for a media type. 936 func (o *CiliumAPIAPI) RegisterProducer(mediaType string, producer runtime.Producer) { 937 o.customProducers[mediaType] = producer 938 } 939 940 // AddMiddlewareFor adds a http middleware to existing handler 941 func (o *CiliumAPIAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) { 942 um := strings.ToUpper(method) 943 if path == "/" { 944 path = "" 945 } 946 o.Init() 947 if h, ok := o.handlers[um][path]; ok { 948 o.handlers[um][path] = builder(h) 949 } 950 }