github.com/kubearmor/cilium@v1.6.12/api/v1/server/restapi/cilium_api.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package restapi
     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  	"fmt"
    10  	"net/http"
    11  	"strings"
    12  
    13  	errors "github.com/go-openapi/errors"
    14  	loads "github.com/go-openapi/loads"
    15  	runtime "github.com/go-openapi/runtime"
    16  	middleware "github.com/go-openapi/runtime/middleware"
    17  	security "github.com/go-openapi/runtime/security"
    18  	spec "github.com/go-openapi/spec"
    19  	strfmt "github.com/go-openapi/strfmt"
    20  	"github.com/go-openapi/swag"
    21  
    22  	"github.com/cilium/cilium/api/v1/server/restapi/daemon"
    23  	"github.com/cilium/cilium/api/v1/server/restapi/endpoint"
    24  	"github.com/cilium/cilium/api/v1/server/restapi/ipam"
    25  	"github.com/cilium/cilium/api/v1/server/restapi/metrics"
    26  	"github.com/cilium/cilium/api/v1/server/restapi/policy"
    27  	"github.com/cilium/cilium/api/v1/server/restapi/prefilter"
    28  	"github.com/cilium/cilium/api/v1/server/restapi/service"
    29  )
    30  
    31  // NewCiliumAPI creates a new Cilium instance
    32  func NewCiliumAPI(spec *loads.Document) *CiliumAPI {
    33  	return &CiliumAPI{
    34  		handlers:            make(map[string]map[string]http.Handler),
    35  		formats:             strfmt.Default,
    36  		defaultConsumes:     "application/json",
    37  		defaultProduces:     "application/json",
    38  		customConsumers:     make(map[string]runtime.Consumer),
    39  		customProducers:     make(map[string]runtime.Producer),
    40  		ServerShutdown:      func() {},
    41  		spec:                spec,
    42  		ServeError:          errors.ServeError,
    43  		BasicAuthenticator:  security.BasicAuth,
    44  		APIKeyAuthenticator: security.APIKeyAuth,
    45  		BearerAuthenticator: security.BearerAuth,
    46  		JSONConsumer:        runtime.JSONConsumer(),
    47  		JSONProducer:        runtime.JSONProducer(),
    48  		EndpointDeleteEndpointIDHandler: endpoint.DeleteEndpointIDHandlerFunc(func(params endpoint.DeleteEndpointIDParams) middleware.Responder {
    49  			return middleware.NotImplemented("operation EndpointDeleteEndpointID has not yet been implemented")
    50  		}),
    51  		PolicyDeleteFqdnCacheHandler: policy.DeleteFqdnCacheHandlerFunc(func(params policy.DeleteFqdnCacheParams) middleware.Responder {
    52  			return middleware.NotImplemented("operation PolicyDeleteFqdnCache has not yet been implemented")
    53  		}),
    54  		IPAMDeleteIPAMIPHandler: ipam.DeleteIPAMIPHandlerFunc(func(params ipam.DeleteIPAMIPParams) middleware.Responder {
    55  			return middleware.NotImplemented("operation IPAMDeleteIPAMIP has not yet been implemented")
    56  		}),
    57  		PolicyDeletePolicyHandler: policy.DeletePolicyHandlerFunc(func(params policy.DeletePolicyParams) middleware.Responder {
    58  			return middleware.NotImplemented("operation PolicyDeletePolicy has not yet been implemented")
    59  		}),
    60  		PrefilterDeletePrefilterHandler: prefilter.DeletePrefilterHandlerFunc(func(params prefilter.DeletePrefilterParams) middleware.Responder {
    61  			return middleware.NotImplemented("operation PrefilterDeletePrefilter has not yet been implemented")
    62  		}),
    63  		ServiceDeleteServiceIDHandler: service.DeleteServiceIDHandlerFunc(func(params service.DeleteServiceIDParams) middleware.Responder {
    64  			return middleware.NotImplemented("operation ServiceDeleteServiceID has not yet been implemented")
    65  		}),
    66  		DaemonGetClusterNodesHandler: daemon.GetClusterNodesHandlerFunc(func(params daemon.GetClusterNodesParams) middleware.Responder {
    67  			return middleware.NotImplemented("operation DaemonGetClusterNodes has not yet been implemented")
    68  		}),
    69  		DaemonGetConfigHandler: daemon.GetConfigHandlerFunc(func(params daemon.GetConfigParams) middleware.Responder {
    70  			return middleware.NotImplemented("operation DaemonGetConfig has not yet been implemented")
    71  		}),
    72  		DaemonGetDebuginfoHandler: daemon.GetDebuginfoHandlerFunc(func(params daemon.GetDebuginfoParams) middleware.Responder {
    73  			return middleware.NotImplemented("operation DaemonGetDebuginfo has not yet been implemented")
    74  		}),
    75  		EndpointGetEndpointHandler: endpoint.GetEndpointHandlerFunc(func(params endpoint.GetEndpointParams) middleware.Responder {
    76  			return middleware.NotImplemented("operation EndpointGetEndpoint has not yet been implemented")
    77  		}),
    78  		EndpointGetEndpointIDHandler: endpoint.GetEndpointIDHandlerFunc(func(params endpoint.GetEndpointIDParams) middleware.Responder {
    79  			return middleware.NotImplemented("operation EndpointGetEndpointID has not yet been implemented")
    80  		}),
    81  		EndpointGetEndpointIDConfigHandler: endpoint.GetEndpointIDConfigHandlerFunc(func(params endpoint.GetEndpointIDConfigParams) middleware.Responder {
    82  			return middleware.NotImplemented("operation EndpointGetEndpointIDConfig has not yet been implemented")
    83  		}),
    84  		EndpointGetEndpointIDHealthzHandler: endpoint.GetEndpointIDHealthzHandlerFunc(func(params endpoint.GetEndpointIDHealthzParams) middleware.Responder {
    85  			return middleware.NotImplemented("operation EndpointGetEndpointIDHealthz has not yet been implemented")
    86  		}),
    87  		EndpointGetEndpointIDLabelsHandler: endpoint.GetEndpointIDLabelsHandlerFunc(func(params endpoint.GetEndpointIDLabelsParams) middleware.Responder {
    88  			return middleware.NotImplemented("operation EndpointGetEndpointIDLabels has not yet been implemented")
    89  		}),
    90  		EndpointGetEndpointIDLogHandler: endpoint.GetEndpointIDLogHandlerFunc(func(params endpoint.GetEndpointIDLogParams) middleware.Responder {
    91  			return middleware.NotImplemented("operation EndpointGetEndpointIDLog has not yet been implemented")
    92  		}),
    93  		PolicyGetFqdnCacheHandler: policy.GetFqdnCacheHandlerFunc(func(params policy.GetFqdnCacheParams) middleware.Responder {
    94  			return middleware.NotImplemented("operation PolicyGetFqdnCache has not yet been implemented")
    95  		}),
    96  		PolicyGetFqdnCacheIDHandler: policy.GetFqdnCacheIDHandlerFunc(func(params policy.GetFqdnCacheIDParams) middleware.Responder {
    97  			return middleware.NotImplemented("operation PolicyGetFqdnCacheID has not yet been implemented")
    98  		}),
    99  		DaemonGetHealthzHandler: daemon.GetHealthzHandlerFunc(func(params daemon.GetHealthzParams) middleware.Responder {
   100  			return middleware.NotImplemented("operation DaemonGetHealthz has not yet been implemented")
   101  		}),
   102  		PolicyGetIdentityHandler: policy.GetIdentityHandlerFunc(func(params policy.GetIdentityParams) middleware.Responder {
   103  			return middleware.NotImplemented("operation PolicyGetIdentity has not yet been implemented")
   104  		}),
   105  		PolicyGetIdentityEndpointsHandler: policy.GetIdentityEndpointsHandlerFunc(func(params policy.GetIdentityEndpointsParams) middleware.Responder {
   106  			return middleware.NotImplemented("operation PolicyGetIdentityEndpoints has not yet been implemented")
   107  		}),
   108  		PolicyGetIdentityIDHandler: policy.GetIdentityIDHandlerFunc(func(params policy.GetIdentityIDParams) middleware.Responder {
   109  			return middleware.NotImplemented("operation PolicyGetIdentityID has not yet been implemented")
   110  		}),
   111  		DaemonGetMapHandler: daemon.GetMapHandlerFunc(func(params daemon.GetMapParams) middleware.Responder {
   112  			return middleware.NotImplemented("operation DaemonGetMap has not yet been implemented")
   113  		}),
   114  		DaemonGetMapNameHandler: daemon.GetMapNameHandlerFunc(func(params daemon.GetMapNameParams) middleware.Responder {
   115  			return middleware.NotImplemented("operation DaemonGetMapName has not yet been implemented")
   116  		}),
   117  		MetricsGetMetricsHandler: metrics.GetMetricsHandlerFunc(func(params metrics.GetMetricsParams) middleware.Responder {
   118  			return middleware.NotImplemented("operation MetricsGetMetrics has not yet been implemented")
   119  		}),
   120  		PolicyGetPolicyHandler: policy.GetPolicyHandlerFunc(func(params policy.GetPolicyParams) middleware.Responder {
   121  			return middleware.NotImplemented("operation PolicyGetPolicy has not yet been implemented")
   122  		}),
   123  		PolicyGetPolicyResolveHandler: policy.GetPolicyResolveHandlerFunc(func(params policy.GetPolicyResolveParams) middleware.Responder {
   124  			return middleware.NotImplemented("operation PolicyGetPolicyResolve has not yet been implemented")
   125  		}),
   126  		PolicyGetPolicySelectorsHandler: policy.GetPolicySelectorsHandlerFunc(func(params policy.GetPolicySelectorsParams) middleware.Responder {
   127  			return middleware.NotImplemented("operation PolicyGetPolicySelectors has not yet been implemented")
   128  		}),
   129  		PrefilterGetPrefilterHandler: prefilter.GetPrefilterHandlerFunc(func(params prefilter.GetPrefilterParams) middleware.Responder {
   130  			return middleware.NotImplemented("operation PrefilterGetPrefilter has not yet been implemented")
   131  		}),
   132  		ServiceGetServiceHandler: service.GetServiceHandlerFunc(func(params service.GetServiceParams) middleware.Responder {
   133  			return middleware.NotImplemented("operation ServiceGetService has not yet been implemented")
   134  		}),
   135  		ServiceGetServiceIDHandler: service.GetServiceIDHandlerFunc(func(params service.GetServiceIDParams) middleware.Responder {
   136  			return middleware.NotImplemented("operation ServiceGetServiceID has not yet been implemented")
   137  		}),
   138  		DaemonPatchConfigHandler: daemon.PatchConfigHandlerFunc(func(params daemon.PatchConfigParams) middleware.Responder {
   139  			return middleware.NotImplemented("operation DaemonPatchConfig has not yet been implemented")
   140  		}),
   141  		EndpointPatchEndpointIDHandler: endpoint.PatchEndpointIDHandlerFunc(func(params endpoint.PatchEndpointIDParams) middleware.Responder {
   142  			return middleware.NotImplemented("operation EndpointPatchEndpointID has not yet been implemented")
   143  		}),
   144  		EndpointPatchEndpointIDConfigHandler: endpoint.PatchEndpointIDConfigHandlerFunc(func(params endpoint.PatchEndpointIDConfigParams) middleware.Responder {
   145  			return middleware.NotImplemented("operation EndpointPatchEndpointIDConfig has not yet been implemented")
   146  		}),
   147  		EndpointPatchEndpointIDLabelsHandler: endpoint.PatchEndpointIDLabelsHandlerFunc(func(params endpoint.PatchEndpointIDLabelsParams) middleware.Responder {
   148  			return middleware.NotImplemented("operation EndpointPatchEndpointIDLabels has not yet been implemented")
   149  		}),
   150  		PrefilterPatchPrefilterHandler: prefilter.PatchPrefilterHandlerFunc(func(params prefilter.PatchPrefilterParams) middleware.Responder {
   151  			return middleware.NotImplemented("operation PrefilterPatchPrefilter has not yet been implemented")
   152  		}),
   153  		IPAMPostIPAMHandler: ipam.PostIPAMHandlerFunc(func(params ipam.PostIPAMParams) middleware.Responder {
   154  			return middleware.NotImplemented("operation IPAMPostIPAM has not yet been implemented")
   155  		}),
   156  		IPAMPostIPAMIPHandler: ipam.PostIPAMIPHandlerFunc(func(params ipam.PostIPAMIPParams) middleware.Responder {
   157  			return middleware.NotImplemented("operation IPAMPostIPAMIP has not yet been implemented")
   158  		}),
   159  		EndpointPutEndpointIDHandler: endpoint.PutEndpointIDHandlerFunc(func(params endpoint.PutEndpointIDParams) middleware.Responder {
   160  			return middleware.NotImplemented("operation EndpointPutEndpointID has not yet been implemented")
   161  		}),
   162  		PolicyPutPolicyHandler: policy.PutPolicyHandlerFunc(func(params policy.PutPolicyParams) middleware.Responder {
   163  			return middleware.NotImplemented("operation PolicyPutPolicy has not yet been implemented")
   164  		}),
   165  		ServicePutServiceIDHandler: service.PutServiceIDHandlerFunc(func(params service.PutServiceIDParams) middleware.Responder {
   166  			return middleware.NotImplemented("operation ServicePutServiceID has not yet been implemented")
   167  		}),
   168  	}
   169  }
   170  
   171  /*CiliumAPI Cilium */
   172  type CiliumAPI struct {
   173  	spec            *loads.Document
   174  	context         *middleware.Context
   175  	handlers        map[string]map[string]http.Handler
   176  	formats         strfmt.Registry
   177  	customConsumers map[string]runtime.Consumer
   178  	customProducers map[string]runtime.Producer
   179  	defaultConsumes string
   180  	defaultProduces string
   181  	Middleware      func(middleware.Builder) http.Handler
   182  
   183  	// BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
   184  	// It has a default implementation in the security package, however you can replace it for your particular usage.
   185  	BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator
   186  	// APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
   187  	// It has a default implementation in the security package, however you can replace it for your particular usage.
   188  	APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator
   189  	// BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
   190  	// It has a default implementation in the security package, however you can replace it for your particular usage.
   191  	BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator
   192  
   193  	// JSONConsumer registers a consumer for a "application/json" mime type
   194  	JSONConsumer runtime.Consumer
   195  
   196  	// JSONProducer registers a producer for a "application/json" mime type
   197  	JSONProducer runtime.Producer
   198  
   199  	// EndpointDeleteEndpointIDHandler sets the operation handler for the delete endpoint ID operation
   200  	EndpointDeleteEndpointIDHandler endpoint.DeleteEndpointIDHandler
   201  	// PolicyDeleteFqdnCacheHandler sets the operation handler for the delete fqdn cache operation
   202  	PolicyDeleteFqdnCacheHandler policy.DeleteFqdnCacheHandler
   203  	// IPAMDeleteIPAMIPHandler sets the operation handler for the delete IP a m IP operation
   204  	IPAMDeleteIPAMIPHandler ipam.DeleteIPAMIPHandler
   205  	// PolicyDeletePolicyHandler sets the operation handler for the delete policy operation
   206  	PolicyDeletePolicyHandler policy.DeletePolicyHandler
   207  	// PrefilterDeletePrefilterHandler sets the operation handler for the delete prefilter operation
   208  	PrefilterDeletePrefilterHandler prefilter.DeletePrefilterHandler
   209  	// ServiceDeleteServiceIDHandler sets the operation handler for the delete service ID operation
   210  	ServiceDeleteServiceIDHandler service.DeleteServiceIDHandler
   211  	// DaemonGetClusterNodesHandler sets the operation handler for the get cluster nodes operation
   212  	DaemonGetClusterNodesHandler daemon.GetClusterNodesHandler
   213  	// DaemonGetConfigHandler sets the operation handler for the get config operation
   214  	DaemonGetConfigHandler daemon.GetConfigHandler
   215  	// DaemonGetDebuginfoHandler sets the operation handler for the get debuginfo operation
   216  	DaemonGetDebuginfoHandler daemon.GetDebuginfoHandler
   217  	// EndpointGetEndpointHandler sets the operation handler for the get endpoint operation
   218  	EndpointGetEndpointHandler endpoint.GetEndpointHandler
   219  	// EndpointGetEndpointIDHandler sets the operation handler for the get endpoint ID operation
   220  	EndpointGetEndpointIDHandler endpoint.GetEndpointIDHandler
   221  	// EndpointGetEndpointIDConfigHandler sets the operation handler for the get endpoint ID config operation
   222  	EndpointGetEndpointIDConfigHandler endpoint.GetEndpointIDConfigHandler
   223  	// EndpointGetEndpointIDHealthzHandler sets the operation handler for the get endpoint ID healthz operation
   224  	EndpointGetEndpointIDHealthzHandler endpoint.GetEndpointIDHealthzHandler
   225  	// EndpointGetEndpointIDLabelsHandler sets the operation handler for the get endpoint ID labels operation
   226  	EndpointGetEndpointIDLabelsHandler endpoint.GetEndpointIDLabelsHandler
   227  	// EndpointGetEndpointIDLogHandler sets the operation handler for the get endpoint ID log operation
   228  	EndpointGetEndpointIDLogHandler endpoint.GetEndpointIDLogHandler
   229  	// PolicyGetFqdnCacheHandler sets the operation handler for the get fqdn cache operation
   230  	PolicyGetFqdnCacheHandler policy.GetFqdnCacheHandler
   231  	// PolicyGetFqdnCacheIDHandler sets the operation handler for the get fqdn cache ID operation
   232  	PolicyGetFqdnCacheIDHandler policy.GetFqdnCacheIDHandler
   233  	// DaemonGetHealthzHandler sets the operation handler for the get healthz operation
   234  	DaemonGetHealthzHandler daemon.GetHealthzHandler
   235  	// PolicyGetIdentityHandler sets the operation handler for the get identity operation
   236  	PolicyGetIdentityHandler policy.GetIdentityHandler
   237  	// PolicyGetIdentityEndpointsHandler sets the operation handler for the get identity endpoints operation
   238  	PolicyGetIdentityEndpointsHandler policy.GetIdentityEndpointsHandler
   239  	// PolicyGetIdentityIDHandler sets the operation handler for the get identity ID operation
   240  	PolicyGetIdentityIDHandler policy.GetIdentityIDHandler
   241  	// DaemonGetMapHandler sets the operation handler for the get map operation
   242  	DaemonGetMapHandler daemon.GetMapHandler
   243  	// DaemonGetMapNameHandler sets the operation handler for the get map name operation
   244  	DaemonGetMapNameHandler daemon.GetMapNameHandler
   245  	// MetricsGetMetricsHandler sets the operation handler for the get metrics operation
   246  	MetricsGetMetricsHandler metrics.GetMetricsHandler
   247  	// PolicyGetPolicyHandler sets the operation handler for the get policy operation
   248  	PolicyGetPolicyHandler policy.GetPolicyHandler
   249  	// PolicyGetPolicyResolveHandler sets the operation handler for the get policy resolve operation
   250  	PolicyGetPolicyResolveHandler policy.GetPolicyResolveHandler
   251  	// PolicyGetPolicySelectorsHandler sets the operation handler for the get policy selectors operation
   252  	PolicyGetPolicySelectorsHandler policy.GetPolicySelectorsHandler
   253  	// PrefilterGetPrefilterHandler sets the operation handler for the get prefilter operation
   254  	PrefilterGetPrefilterHandler prefilter.GetPrefilterHandler
   255  	// ServiceGetServiceHandler sets the operation handler for the get service operation
   256  	ServiceGetServiceHandler service.GetServiceHandler
   257  	// ServiceGetServiceIDHandler sets the operation handler for the get service ID operation
   258  	ServiceGetServiceIDHandler service.GetServiceIDHandler
   259  	// DaemonPatchConfigHandler sets the operation handler for the patch config operation
   260  	DaemonPatchConfigHandler daemon.PatchConfigHandler
   261  	// EndpointPatchEndpointIDHandler sets the operation handler for the patch endpoint ID operation
   262  	EndpointPatchEndpointIDHandler endpoint.PatchEndpointIDHandler
   263  	// EndpointPatchEndpointIDConfigHandler sets the operation handler for the patch endpoint ID config operation
   264  	EndpointPatchEndpointIDConfigHandler endpoint.PatchEndpointIDConfigHandler
   265  	// EndpointPatchEndpointIDLabelsHandler sets the operation handler for the patch endpoint ID labels operation
   266  	EndpointPatchEndpointIDLabelsHandler endpoint.PatchEndpointIDLabelsHandler
   267  	// PrefilterPatchPrefilterHandler sets the operation handler for the patch prefilter operation
   268  	PrefilterPatchPrefilterHandler prefilter.PatchPrefilterHandler
   269  	// IPAMPostIPAMHandler sets the operation handler for the post IP a m operation
   270  	IPAMPostIPAMHandler ipam.PostIPAMHandler
   271  	// IPAMPostIPAMIPHandler sets the operation handler for the post IP a m IP operation
   272  	IPAMPostIPAMIPHandler ipam.PostIPAMIPHandler
   273  	// EndpointPutEndpointIDHandler sets the operation handler for the put endpoint ID operation
   274  	EndpointPutEndpointIDHandler endpoint.PutEndpointIDHandler
   275  	// PolicyPutPolicyHandler sets the operation handler for the put policy operation
   276  	PolicyPutPolicyHandler policy.PutPolicyHandler
   277  	// ServicePutServiceIDHandler sets the operation handler for the put service ID operation
   278  	ServicePutServiceIDHandler service.PutServiceIDHandler
   279  
   280  	// ServeError is called when an error is received, there is a default handler
   281  	// but you can set your own with this
   282  	ServeError func(http.ResponseWriter, *http.Request, error)
   283  
   284  	// ServerShutdown is called when the HTTP(S) server is shut down and done
   285  	// handling all active connections and does not accept connections any more
   286  	ServerShutdown func()
   287  
   288  	// Custom command line argument groups with their descriptions
   289  	CommandLineOptionsGroups []swag.CommandLineOptionsGroup
   290  
   291  	// User defined logger function.
   292  	Logger func(string, ...interface{})
   293  }
   294  
   295  // SetDefaultProduces sets the default produces media type
   296  func (o *CiliumAPI) SetDefaultProduces(mediaType string) {
   297  	o.defaultProduces = mediaType
   298  }
   299  
   300  // SetDefaultConsumes returns the default consumes media type
   301  func (o *CiliumAPI) SetDefaultConsumes(mediaType string) {
   302  	o.defaultConsumes = mediaType
   303  }
   304  
   305  // SetSpec sets a spec that will be served for the clients.
   306  func (o *CiliumAPI) SetSpec(spec *loads.Document) {
   307  	o.spec = spec
   308  }
   309  
   310  // DefaultProduces returns the default produces media type
   311  func (o *CiliumAPI) DefaultProduces() string {
   312  	return o.defaultProduces
   313  }
   314  
   315  // DefaultConsumes returns the default consumes media type
   316  func (o *CiliumAPI) DefaultConsumes() string {
   317  	return o.defaultConsumes
   318  }
   319  
   320  // Formats returns the registered string formats
   321  func (o *CiliumAPI) Formats() strfmt.Registry {
   322  	return o.formats
   323  }
   324  
   325  // RegisterFormat registers a custom format validator
   326  func (o *CiliumAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
   327  	o.formats.Add(name, format, validator)
   328  }
   329  
   330  // Validate validates the registrations in the CiliumAPI
   331  func (o *CiliumAPI) Validate() error {
   332  	var unregistered []string
   333  
   334  	if o.JSONConsumer == nil {
   335  		unregistered = append(unregistered, "JSONConsumer")
   336  	}
   337  
   338  	if o.JSONProducer == nil {
   339  		unregistered = append(unregistered, "JSONProducer")
   340  	}
   341  
   342  	if o.EndpointDeleteEndpointIDHandler == nil {
   343  		unregistered = append(unregistered, "endpoint.DeleteEndpointIDHandler")
   344  	}
   345  
   346  	if o.PolicyDeleteFqdnCacheHandler == nil {
   347  		unregistered = append(unregistered, "policy.DeleteFqdnCacheHandler")
   348  	}
   349  
   350  	if o.IPAMDeleteIPAMIPHandler == nil {
   351  		unregistered = append(unregistered, "ipam.DeleteIPAMIPHandler")
   352  	}
   353  
   354  	if o.PolicyDeletePolicyHandler == nil {
   355  		unregistered = append(unregistered, "policy.DeletePolicyHandler")
   356  	}
   357  
   358  	if o.PrefilterDeletePrefilterHandler == nil {
   359  		unregistered = append(unregistered, "prefilter.DeletePrefilterHandler")
   360  	}
   361  
   362  	if o.ServiceDeleteServiceIDHandler == nil {
   363  		unregistered = append(unregistered, "service.DeleteServiceIDHandler")
   364  	}
   365  
   366  	if o.DaemonGetClusterNodesHandler == nil {
   367  		unregistered = append(unregistered, "daemon.GetClusterNodesHandler")
   368  	}
   369  
   370  	if o.DaemonGetConfigHandler == nil {
   371  		unregistered = append(unregistered, "daemon.GetConfigHandler")
   372  	}
   373  
   374  	if o.DaemonGetDebuginfoHandler == nil {
   375  		unregistered = append(unregistered, "daemon.GetDebuginfoHandler")
   376  	}
   377  
   378  	if o.EndpointGetEndpointHandler == nil {
   379  		unregistered = append(unregistered, "endpoint.GetEndpointHandler")
   380  	}
   381  
   382  	if o.EndpointGetEndpointIDHandler == nil {
   383  		unregistered = append(unregistered, "endpoint.GetEndpointIDHandler")
   384  	}
   385  
   386  	if o.EndpointGetEndpointIDConfigHandler == nil {
   387  		unregistered = append(unregistered, "endpoint.GetEndpointIDConfigHandler")
   388  	}
   389  
   390  	if o.EndpointGetEndpointIDHealthzHandler == nil {
   391  		unregistered = append(unregistered, "endpoint.GetEndpointIDHealthzHandler")
   392  	}
   393  
   394  	if o.EndpointGetEndpointIDLabelsHandler == nil {
   395  		unregistered = append(unregistered, "endpoint.GetEndpointIDLabelsHandler")
   396  	}
   397  
   398  	if o.EndpointGetEndpointIDLogHandler == nil {
   399  		unregistered = append(unregistered, "endpoint.GetEndpointIDLogHandler")
   400  	}
   401  
   402  	if o.PolicyGetFqdnCacheHandler == nil {
   403  		unregistered = append(unregistered, "policy.GetFqdnCacheHandler")
   404  	}
   405  
   406  	if o.PolicyGetFqdnCacheIDHandler == nil {
   407  		unregistered = append(unregistered, "policy.GetFqdnCacheIDHandler")
   408  	}
   409  
   410  	if o.DaemonGetHealthzHandler == nil {
   411  		unregistered = append(unregistered, "daemon.GetHealthzHandler")
   412  	}
   413  
   414  	if o.PolicyGetIdentityHandler == nil {
   415  		unregistered = append(unregistered, "policy.GetIdentityHandler")
   416  	}
   417  
   418  	if o.PolicyGetIdentityEndpointsHandler == nil {
   419  		unregistered = append(unregistered, "policy.GetIdentityEndpointsHandler")
   420  	}
   421  
   422  	if o.PolicyGetIdentityIDHandler == nil {
   423  		unregistered = append(unregistered, "policy.GetIdentityIDHandler")
   424  	}
   425  
   426  	if o.DaemonGetMapHandler == nil {
   427  		unregistered = append(unregistered, "daemon.GetMapHandler")
   428  	}
   429  
   430  	if o.DaemonGetMapNameHandler == nil {
   431  		unregistered = append(unregistered, "daemon.GetMapNameHandler")
   432  	}
   433  
   434  	if o.MetricsGetMetricsHandler == nil {
   435  		unregistered = append(unregistered, "metrics.GetMetricsHandler")
   436  	}
   437  
   438  	if o.PolicyGetPolicyHandler == nil {
   439  		unregistered = append(unregistered, "policy.GetPolicyHandler")
   440  	}
   441  
   442  	if o.PolicyGetPolicyResolveHandler == nil {
   443  		unregistered = append(unregistered, "policy.GetPolicyResolveHandler")
   444  	}
   445  
   446  	if o.PolicyGetPolicySelectorsHandler == nil {
   447  		unregistered = append(unregistered, "policy.GetPolicySelectorsHandler")
   448  	}
   449  
   450  	if o.PrefilterGetPrefilterHandler == nil {
   451  		unregistered = append(unregistered, "prefilter.GetPrefilterHandler")
   452  	}
   453  
   454  	if o.ServiceGetServiceHandler == nil {
   455  		unregistered = append(unregistered, "service.GetServiceHandler")
   456  	}
   457  
   458  	if o.ServiceGetServiceIDHandler == nil {
   459  		unregistered = append(unregistered, "service.GetServiceIDHandler")
   460  	}
   461  
   462  	if o.DaemonPatchConfigHandler == nil {
   463  		unregistered = append(unregistered, "daemon.PatchConfigHandler")
   464  	}
   465  
   466  	if o.EndpointPatchEndpointIDHandler == nil {
   467  		unregistered = append(unregistered, "endpoint.PatchEndpointIDHandler")
   468  	}
   469  
   470  	if o.EndpointPatchEndpointIDConfigHandler == nil {
   471  		unregistered = append(unregistered, "endpoint.PatchEndpointIDConfigHandler")
   472  	}
   473  
   474  	if o.EndpointPatchEndpointIDLabelsHandler == nil {
   475  		unregistered = append(unregistered, "endpoint.PatchEndpointIDLabelsHandler")
   476  	}
   477  
   478  	if o.PrefilterPatchPrefilterHandler == nil {
   479  		unregistered = append(unregistered, "prefilter.PatchPrefilterHandler")
   480  	}
   481  
   482  	if o.IPAMPostIPAMHandler == nil {
   483  		unregistered = append(unregistered, "ipam.PostIPAMHandler")
   484  	}
   485  
   486  	if o.IPAMPostIPAMIPHandler == nil {
   487  		unregistered = append(unregistered, "ipam.PostIPAMIPHandler")
   488  	}
   489  
   490  	if o.EndpointPutEndpointIDHandler == nil {
   491  		unregistered = append(unregistered, "endpoint.PutEndpointIDHandler")
   492  	}
   493  
   494  	if o.PolicyPutPolicyHandler == nil {
   495  		unregistered = append(unregistered, "policy.PutPolicyHandler")
   496  	}
   497  
   498  	if o.ServicePutServiceIDHandler == nil {
   499  		unregistered = append(unregistered, "service.PutServiceIDHandler")
   500  	}
   501  
   502  	if len(unregistered) > 0 {
   503  		return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
   504  	}
   505  
   506  	return nil
   507  }
   508  
   509  // ServeErrorFor gets a error handler for a given operation id
   510  func (o *CiliumAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
   511  	return o.ServeError
   512  }
   513  
   514  // AuthenticatorsFor gets the authenticators for the specified security schemes
   515  func (o *CiliumAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
   516  
   517  	return nil
   518  
   519  }
   520  
   521  // Authorizer returns the registered authorizer
   522  func (o *CiliumAPI) Authorizer() runtime.Authorizer {
   523  
   524  	return nil
   525  
   526  }
   527  
   528  // ConsumersFor gets the consumers for the specified media types
   529  func (o *CiliumAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
   530  
   531  	result := make(map[string]runtime.Consumer)
   532  	for _, mt := range mediaTypes {
   533  		switch mt {
   534  
   535  		case "application/json":
   536  			result["application/json"] = o.JSONConsumer
   537  
   538  		}
   539  
   540  		if c, ok := o.customConsumers[mt]; ok {
   541  			result[mt] = c
   542  		}
   543  	}
   544  	return result
   545  
   546  }
   547  
   548  // ProducersFor gets the producers for the specified media types
   549  func (o *CiliumAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
   550  
   551  	result := make(map[string]runtime.Producer)
   552  	for _, mt := range mediaTypes {
   553  		switch mt {
   554  
   555  		case "application/json":
   556  			result["application/json"] = o.JSONProducer
   557  
   558  		}
   559  
   560  		if p, ok := o.customProducers[mt]; ok {
   561  			result[mt] = p
   562  		}
   563  	}
   564  	return result
   565  
   566  }
   567  
   568  // HandlerFor gets a http.Handler for the provided operation method and path
   569  func (o *CiliumAPI) HandlerFor(method, path string) (http.Handler, bool) {
   570  	if o.handlers == nil {
   571  		return nil, false
   572  	}
   573  	um := strings.ToUpper(method)
   574  	if _, ok := o.handlers[um]; !ok {
   575  		return nil, false
   576  	}
   577  	if path == "/" {
   578  		path = ""
   579  	}
   580  	h, ok := o.handlers[um][path]
   581  	return h, ok
   582  }
   583  
   584  // Context returns the middleware context for the cilium API
   585  func (o *CiliumAPI) Context() *middleware.Context {
   586  	if o.context == nil {
   587  		o.context = middleware.NewRoutableContext(o.spec, o, nil)
   588  	}
   589  
   590  	return o.context
   591  }
   592  
   593  func (o *CiliumAPI) initHandlerCache() {
   594  	o.Context() // don't care about the result, just that the initialization happened
   595  
   596  	if o.handlers == nil {
   597  		o.handlers = make(map[string]map[string]http.Handler)
   598  	}
   599  
   600  	if o.handlers["DELETE"] == nil {
   601  		o.handlers["DELETE"] = make(map[string]http.Handler)
   602  	}
   603  	o.handlers["DELETE"]["/endpoint/{id}"] = endpoint.NewDeleteEndpointID(o.context, o.EndpointDeleteEndpointIDHandler)
   604  
   605  	if o.handlers["DELETE"] == nil {
   606  		o.handlers["DELETE"] = make(map[string]http.Handler)
   607  	}
   608  	o.handlers["DELETE"]["/fqdn/cache"] = policy.NewDeleteFqdnCache(o.context, o.PolicyDeleteFqdnCacheHandler)
   609  
   610  	if o.handlers["DELETE"] == nil {
   611  		o.handlers["DELETE"] = make(map[string]http.Handler)
   612  	}
   613  	o.handlers["DELETE"]["/ipam/{ip}"] = ipam.NewDeleteIPAMIP(o.context, o.IPAMDeleteIPAMIPHandler)
   614  
   615  	if o.handlers["DELETE"] == nil {
   616  		o.handlers["DELETE"] = make(map[string]http.Handler)
   617  	}
   618  	o.handlers["DELETE"]["/policy"] = policy.NewDeletePolicy(o.context, o.PolicyDeletePolicyHandler)
   619  
   620  	if o.handlers["DELETE"] == nil {
   621  		o.handlers["DELETE"] = make(map[string]http.Handler)
   622  	}
   623  	o.handlers["DELETE"]["/prefilter"] = prefilter.NewDeletePrefilter(o.context, o.PrefilterDeletePrefilterHandler)
   624  
   625  	if o.handlers["DELETE"] == nil {
   626  		o.handlers["DELETE"] = make(map[string]http.Handler)
   627  	}
   628  	o.handlers["DELETE"]["/service/{id}"] = service.NewDeleteServiceID(o.context, o.ServiceDeleteServiceIDHandler)
   629  
   630  	if o.handlers["GET"] == nil {
   631  		o.handlers["GET"] = make(map[string]http.Handler)
   632  	}
   633  	o.handlers["GET"]["/cluster/nodes"] = daemon.NewGetClusterNodes(o.context, o.DaemonGetClusterNodesHandler)
   634  
   635  	if o.handlers["GET"] == nil {
   636  		o.handlers["GET"] = make(map[string]http.Handler)
   637  	}
   638  	o.handlers["GET"]["/config"] = daemon.NewGetConfig(o.context, o.DaemonGetConfigHandler)
   639  
   640  	if o.handlers["GET"] == nil {
   641  		o.handlers["GET"] = make(map[string]http.Handler)
   642  	}
   643  	o.handlers["GET"]["/debuginfo"] = daemon.NewGetDebuginfo(o.context, o.DaemonGetDebuginfoHandler)
   644  
   645  	if o.handlers["GET"] == nil {
   646  		o.handlers["GET"] = make(map[string]http.Handler)
   647  	}
   648  	o.handlers["GET"]["/endpoint"] = endpoint.NewGetEndpoint(o.context, o.EndpointGetEndpointHandler)
   649  
   650  	if o.handlers["GET"] == nil {
   651  		o.handlers["GET"] = make(map[string]http.Handler)
   652  	}
   653  	o.handlers["GET"]["/endpoint/{id}"] = endpoint.NewGetEndpointID(o.context, o.EndpointGetEndpointIDHandler)
   654  
   655  	if o.handlers["GET"] == nil {
   656  		o.handlers["GET"] = make(map[string]http.Handler)
   657  	}
   658  	o.handlers["GET"]["/endpoint/{id}/config"] = endpoint.NewGetEndpointIDConfig(o.context, o.EndpointGetEndpointIDConfigHandler)
   659  
   660  	if o.handlers["GET"] == nil {
   661  		o.handlers["GET"] = make(map[string]http.Handler)
   662  	}
   663  	o.handlers["GET"]["/endpoint/{id}/healthz"] = endpoint.NewGetEndpointIDHealthz(o.context, o.EndpointGetEndpointIDHealthzHandler)
   664  
   665  	if o.handlers["GET"] == nil {
   666  		o.handlers["GET"] = make(map[string]http.Handler)
   667  	}
   668  	o.handlers["GET"]["/endpoint/{id}/labels"] = endpoint.NewGetEndpointIDLabels(o.context, o.EndpointGetEndpointIDLabelsHandler)
   669  
   670  	if o.handlers["GET"] == nil {
   671  		o.handlers["GET"] = make(map[string]http.Handler)
   672  	}
   673  	o.handlers["GET"]["/endpoint/{id}/log"] = endpoint.NewGetEndpointIDLog(o.context, o.EndpointGetEndpointIDLogHandler)
   674  
   675  	if o.handlers["GET"] == nil {
   676  		o.handlers["GET"] = make(map[string]http.Handler)
   677  	}
   678  	o.handlers["GET"]["/fqdn/cache"] = policy.NewGetFqdnCache(o.context, o.PolicyGetFqdnCacheHandler)
   679  
   680  	if o.handlers["GET"] == nil {
   681  		o.handlers["GET"] = make(map[string]http.Handler)
   682  	}
   683  	o.handlers["GET"]["/fqdn/cache/{id}"] = policy.NewGetFqdnCacheID(o.context, o.PolicyGetFqdnCacheIDHandler)
   684  
   685  	if o.handlers["GET"] == nil {
   686  		o.handlers["GET"] = make(map[string]http.Handler)
   687  	}
   688  	o.handlers["GET"]["/healthz"] = daemon.NewGetHealthz(o.context, o.DaemonGetHealthzHandler)
   689  
   690  	if o.handlers["GET"] == nil {
   691  		o.handlers["GET"] = make(map[string]http.Handler)
   692  	}
   693  	o.handlers["GET"]["/identity"] = policy.NewGetIdentity(o.context, o.PolicyGetIdentityHandler)
   694  
   695  	if o.handlers["GET"] == nil {
   696  		o.handlers["GET"] = make(map[string]http.Handler)
   697  	}
   698  	o.handlers["GET"]["/identity/endpoints"] = policy.NewGetIdentityEndpoints(o.context, o.PolicyGetIdentityEndpointsHandler)
   699  
   700  	if o.handlers["GET"] == nil {
   701  		o.handlers["GET"] = make(map[string]http.Handler)
   702  	}
   703  	o.handlers["GET"]["/identity/{id}"] = policy.NewGetIdentityID(o.context, o.PolicyGetIdentityIDHandler)
   704  
   705  	if o.handlers["GET"] == nil {
   706  		o.handlers["GET"] = make(map[string]http.Handler)
   707  	}
   708  	o.handlers["GET"]["/map"] = daemon.NewGetMap(o.context, o.DaemonGetMapHandler)
   709  
   710  	if o.handlers["GET"] == nil {
   711  		o.handlers["GET"] = make(map[string]http.Handler)
   712  	}
   713  	o.handlers["GET"]["/map/{name}"] = daemon.NewGetMapName(o.context, o.DaemonGetMapNameHandler)
   714  
   715  	if o.handlers["GET"] == nil {
   716  		o.handlers["GET"] = make(map[string]http.Handler)
   717  	}
   718  	o.handlers["GET"]["/metrics"] = metrics.NewGetMetrics(o.context, o.MetricsGetMetricsHandler)
   719  
   720  	if o.handlers["GET"] == nil {
   721  		o.handlers["GET"] = make(map[string]http.Handler)
   722  	}
   723  	o.handlers["GET"]["/policy"] = policy.NewGetPolicy(o.context, o.PolicyGetPolicyHandler)
   724  
   725  	if o.handlers["GET"] == nil {
   726  		o.handlers["GET"] = make(map[string]http.Handler)
   727  	}
   728  	o.handlers["GET"]["/policy/resolve"] = policy.NewGetPolicyResolve(o.context, o.PolicyGetPolicyResolveHandler)
   729  
   730  	if o.handlers["GET"] == nil {
   731  		o.handlers["GET"] = make(map[string]http.Handler)
   732  	}
   733  	o.handlers["GET"]["/policy/selectors"] = policy.NewGetPolicySelectors(o.context, o.PolicyGetPolicySelectorsHandler)
   734  
   735  	if o.handlers["GET"] == nil {
   736  		o.handlers["GET"] = make(map[string]http.Handler)
   737  	}
   738  	o.handlers["GET"]["/prefilter"] = prefilter.NewGetPrefilter(o.context, o.PrefilterGetPrefilterHandler)
   739  
   740  	if o.handlers["GET"] == nil {
   741  		o.handlers["GET"] = make(map[string]http.Handler)
   742  	}
   743  	o.handlers["GET"]["/service"] = service.NewGetService(o.context, o.ServiceGetServiceHandler)
   744  
   745  	if o.handlers["GET"] == nil {
   746  		o.handlers["GET"] = make(map[string]http.Handler)
   747  	}
   748  	o.handlers["GET"]["/service/{id}"] = service.NewGetServiceID(o.context, o.ServiceGetServiceIDHandler)
   749  
   750  	if o.handlers["PATCH"] == nil {
   751  		o.handlers["PATCH"] = make(map[string]http.Handler)
   752  	}
   753  	o.handlers["PATCH"]["/config"] = daemon.NewPatchConfig(o.context, o.DaemonPatchConfigHandler)
   754  
   755  	if o.handlers["PATCH"] == nil {
   756  		o.handlers["PATCH"] = make(map[string]http.Handler)
   757  	}
   758  	o.handlers["PATCH"]["/endpoint/{id}"] = endpoint.NewPatchEndpointID(o.context, o.EndpointPatchEndpointIDHandler)
   759  
   760  	if o.handlers["PATCH"] == nil {
   761  		o.handlers["PATCH"] = make(map[string]http.Handler)
   762  	}
   763  	o.handlers["PATCH"]["/endpoint/{id}/config"] = endpoint.NewPatchEndpointIDConfig(o.context, o.EndpointPatchEndpointIDConfigHandler)
   764  
   765  	if o.handlers["PATCH"] == nil {
   766  		o.handlers["PATCH"] = make(map[string]http.Handler)
   767  	}
   768  	o.handlers["PATCH"]["/endpoint/{id}/labels"] = endpoint.NewPatchEndpointIDLabels(o.context, o.EndpointPatchEndpointIDLabelsHandler)
   769  
   770  	if o.handlers["PATCH"] == nil {
   771  		o.handlers["PATCH"] = make(map[string]http.Handler)
   772  	}
   773  	o.handlers["PATCH"]["/prefilter"] = prefilter.NewPatchPrefilter(o.context, o.PrefilterPatchPrefilterHandler)
   774  
   775  	if o.handlers["POST"] == nil {
   776  		o.handlers["POST"] = make(map[string]http.Handler)
   777  	}
   778  	o.handlers["POST"]["/ipam"] = ipam.NewPostIPAM(o.context, o.IPAMPostIPAMHandler)
   779  
   780  	if o.handlers["POST"] == nil {
   781  		o.handlers["POST"] = make(map[string]http.Handler)
   782  	}
   783  	o.handlers["POST"]["/ipam/{ip}"] = ipam.NewPostIPAMIP(o.context, o.IPAMPostIPAMIPHandler)
   784  
   785  	if o.handlers["PUT"] == nil {
   786  		o.handlers["PUT"] = make(map[string]http.Handler)
   787  	}
   788  	o.handlers["PUT"]["/endpoint/{id}"] = endpoint.NewPutEndpointID(o.context, o.EndpointPutEndpointIDHandler)
   789  
   790  	if o.handlers["PUT"] == nil {
   791  		o.handlers["PUT"] = make(map[string]http.Handler)
   792  	}
   793  	o.handlers["PUT"]["/policy"] = policy.NewPutPolicy(o.context, o.PolicyPutPolicyHandler)
   794  
   795  	if o.handlers["PUT"] == nil {
   796  		o.handlers["PUT"] = make(map[string]http.Handler)
   797  	}
   798  	o.handlers["PUT"]["/service/{id}"] = service.NewPutServiceID(o.context, o.ServicePutServiceIDHandler)
   799  
   800  }
   801  
   802  // Serve creates a http handler to serve the API over HTTP
   803  // can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
   804  func (o *CiliumAPI) Serve(builder middleware.Builder) http.Handler {
   805  	o.Init()
   806  
   807  	if o.Middleware != nil {
   808  		return o.Middleware(builder)
   809  	}
   810  	return o.context.APIHandler(builder)
   811  }
   812  
   813  // Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit
   814  func (o *CiliumAPI) Init() {
   815  	if len(o.handlers) == 0 {
   816  		o.initHandlerCache()
   817  	}
   818  }
   819  
   820  // RegisterConsumer allows you to add (or override) a consumer for a media type.
   821  func (o *CiliumAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) {
   822  	o.customConsumers[mediaType] = consumer
   823  }
   824  
   825  // RegisterProducer allows you to add (or override) a producer for a media type.
   826  func (o *CiliumAPI) RegisterProducer(mediaType string, producer runtime.Producer) {
   827  	o.customProducers[mediaType] = producer
   828  }