Documentation ¶
Overview ¶
Package api provides the Cilium useful helpers for the external API
Index ¶
Constants ¶
const ( // CiliumGroupName is the cilium's unix group name. CiliumGroupName = "cilium" // SocketFileMode is the default file mode for the sockets. SocketFileMode os.FileMode = 0660 // ClientTimeout specifies timeout to be used by clients ClientTimeout = 90 * time.Second )
Variables ¶
var ( ErrUnknownWildcard = fmt.Errorf("Unsupported API wildcard") ErrUnknownFlag = fmt.Errorf("Unknown API flag") )
Functions ¶
func DisableAPIs ¶
func DisableAPIs(paths PathSet, addMiddleware func(method, path string, builder middleware.Builder))
DisableAPIs configures the API middleware for all of the paths in the provided PathSet such that those APIs will be administratively disabled at runtime.
func SetDefaultPermissions ¶
SetDefaultPermissions sets the given socket's group to `CiliumGroupName` and mode to `SocketFileMode`.
Types ¶
type APIError ¶
type APIError struct {
// contains filtered or unexported fields
}
APIError is the error representation for the API.
func (*APIError) WriteResponse ¶
func (a *APIError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)
WriteResponse to the client.
type APIPanicHandler ¶
APIPanicHandler recovers from API panics and logs encountered panics
func (*APIPanicHandler) ServeHTTP ¶
func (h *APIPanicHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request)
ServeHTTP implements the http.Handler interface. It recovers from panics of all next handlers and logs them
type AdminDisableHandler ¶
type AdminDisableHandler struct {
// contains filtered or unexported fields
}
func NewAdminDisableHandler ¶
func NewAdminDisableHandler(name string) *AdminDisableHandler
func (*AdminDisableHandler) ServeHTTP ¶
func (a *AdminDisableHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request)
type PathSet ¶
PathSet is a set of APIs in the form of a map of canonical pascalized flag name to MethodPath, for example: "GetEndpointID": {"GET", "/endpoint/{id}"}
func AllowedFlagsToDeniedPaths ¶
AllowedFlagsToDeniedPaths parses the input API specification and the provided commandline flags, and returns the PathSet that should be administratively disabled using a subsequent call to DisableAPIs().