Documentation
¶
Index ¶
- Variables
- func CalculatePrefix(gvr schema.GroupVersionResource, addGroup bool) string
- func NewApp() *fiber.App
- func NewAppWithConfig(cfg AppConfig) *fiber.App
- func QueryParser(c *fiber.Ctx, opts *store.ListOpts) (err error)
- func Return(c *fiber.Ctx, code int, body any) error
- func ReturnWithError(c *fiber.Ctx, err error) error
- func ReturnWithProblem(ctx *fiber.Ctx, problem problems.Problem, err error) error
- func SignalHandler(ctx context.Context) context.Context
- type AppConfig
- type CheckerFunc
- type Controller
- type ControllerOpts
- type PredefinedController
- func (r *PredefinedController) AddFilter(filter store.Filter)
- func (r *PredefinedController) AddPatch(patch store.Patch)
- func (r *PredefinedController) FindMatchHandler(ogFilters []store.Filter, ogPatches []store.Patch) func(c *fiber.Ctx) error
- func (r *PredefinedController) NewListHandler(ogFilters []store.Filter) func(c *fiber.Ctx) error
- func (r *PredefinedController) NewPatchHandler(ogPatches []store.Patch) func(c *fiber.Ctx) error
- func (r *PredefinedController) OnlyFilter() bool
- func (r *PredefinedController) OnlyFindMatch() bool
- func (r *PredefinedController) OnlyPatch() bool
- func (r *PredefinedController) Register(router fiber.Router, opts ControllerOpts)
- type ProbesController
- func (h *ProbesController) AddHealthyCheck(checker CheckerFunc)
- func (h *ProbesController) AddReadyCheck(checker CheckerFunc)
- func (h *ProbesController) HealthyCheck(c *fiber.Ctx) error
- func (h *ProbesController) ReadyCheck(c *fiber.Ctx) error
- func (h *ProbesController) Register(router fiber.Router, opts ControllerOpts)
- type ResourceController
- func (r *ResourceController) CreateOrUpdate(c *fiber.Ctx) error
- func (r *ResourceController) Delete(c *fiber.Ctx) error
- func (r *ResourceController) List(c *fiber.Ctx) error
- func (r *ResourceController) Patch(c *fiber.Ctx) error
- func (r *ResourceController) Read(c *fiber.Ctx) error
- func (r *ResourceController) Register(router fiber.Router, opts ControllerOpts)
- func (r *ResourceController) SetXInfoHeaders(c *fiber.Ctx)
- type Server
- type SimpleChecker
Constants ¶
This section is empty.
Variables ¶
View Source
var CustomCheck = func(check SimpleChecker) CheckerFunc { return func(c *fiber.Ctx) error { if check() { return nil } return ErrServiceUnavailable } }
View Source
var OkResponse = map[string]string{"status": "ok"}
Functions ¶
func CalculatePrefix ¶
func CalculatePrefix(gvr schema.GroupVersionResource, addGroup bool) string
func NewAppWithConfig ¶
func ReturnWithProblem ¶
Types ¶
type AppConfig ¶
type AppConfig struct {
fiber.Config
CtxLog logr.Logger
EnableLogging bool
EnableMetrics bool
EnableCors bool
Timeout time.Duration
}
func NewAppConfig ¶
func NewAppConfig() AppConfig
type CheckerFunc ¶
type Controller ¶
type Controller interface {
Register(fiber.Router, ControllerOpts)
}
type ControllerOpts ¶
type ControllerOpts struct {
Prefix string
AllowedMethods []string
Security security.SecurityOpts
}
func Default ¶
func Default() ControllerOpts
func ReadOnly ¶
func ReadOnly() ControllerOpts
func (*ControllerOpts) IsAllowed ¶
func (o *ControllerOpts) IsAllowed(method string) bool
type PredefinedController ¶
type PredefinedController struct {
Name string
ApiPrefix string
Store store.ObjectStore[*unstructured.Unstructured]
Filters []store.Filter
Patches []store.Patch
// contains filtered or unexported fields
}
func NewPredefinedController ¶
func NewPredefinedController(name string, store store.ObjectStore[*unstructured.Unstructured], log logr.Logger) *PredefinedController
func (*PredefinedController) AddFilter ¶
func (r *PredefinedController) AddFilter(filter store.Filter)
func (*PredefinedController) AddPatch ¶
func (r *PredefinedController) AddPatch(patch store.Patch)
func (*PredefinedController) FindMatchHandler ¶
func (*PredefinedController) NewListHandler ¶
func (*PredefinedController) NewPatchHandler ¶
func (*PredefinedController) OnlyFilter ¶
func (r *PredefinedController) OnlyFilter() bool
func (*PredefinedController) OnlyFindMatch ¶
func (r *PredefinedController) OnlyFindMatch() bool
func (*PredefinedController) OnlyPatch ¶
func (r *PredefinedController) OnlyPatch() bool
func (*PredefinedController) Register ¶
func (r *PredefinedController) Register(router fiber.Router, opts ControllerOpts)
type ProbesController ¶
type ProbesController struct {
ReadyChecks []CheckerFunc
HealthyChecks []CheckerFunc
}
func NewProbesController ¶
func NewProbesController() *ProbesController
func (*ProbesController) AddHealthyCheck ¶
func (h *ProbesController) AddHealthyCheck(checker CheckerFunc)
func (*ProbesController) AddReadyCheck ¶
func (h *ProbesController) AddReadyCheck(checker CheckerFunc)
func (*ProbesController) HealthyCheck ¶
func (h *ProbesController) HealthyCheck(c *fiber.Ctx) error
func (*ProbesController) ReadyCheck ¶
func (h *ProbesController) ReadyCheck(c *fiber.Ctx) error
func (*ProbesController) Register ¶
func (h *ProbesController) Register(router fiber.Router, opts ControllerOpts)
type ResourceController ¶
type ResourceController struct {
Store store.ObjectStore[*unstructured.Unstructured]
ApiPrefix string
// contains filtered or unexported fields
}
func NewResourceController ¶
func NewResourceController(store store.ObjectStore[*unstructured.Unstructured], log logr.Logger) *ResourceController
func (*ResourceController) CreateOrUpdate ¶
func (r *ResourceController) CreateOrUpdate(c *fiber.Ctx) error
func (*ResourceController) Register ¶
func (r *ResourceController) Register(router fiber.Router, opts ControllerOpts)
func (*ResourceController) SetXInfoHeaders ¶
func (r *ResourceController) SetXInfoHeaders(c *fiber.Ctx)
type Server ¶
func NewServerWithApp ¶
func (*Server) RegisterController ¶
func (s *Server) RegisterController(controller Controller, opts ControllerOpts)
type SimpleChecker ¶
type SimpleChecker func() bool
Click to show internal directories.
Click to hide internal directories.