server

package
v0.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

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 ErrServiceUnavailable = problems.Builder().Status(fiber.StatusServiceUnavailable).Title("Service Unavailable").Build()
View Source
var OkResponse = map[string]string{"status": "ok"}

Functions

func CalculatePrefix

func CalculatePrefix(gvr schema.GroupVersionResource, addGroup bool) string

func NewApp

func NewApp() *fiber.App

func NewAppWithConfig

func NewAppWithConfig(cfg AppConfig) *fiber.App

func QueryParser

func QueryParser(c *fiber.Ctx, opts *store.ListOpts) (err error)

func Return

func Return(c *fiber.Ctx, code int, body any) error

func ReturnWithError

func ReturnWithError(c *fiber.Ctx, err error) error

func ReturnWithProblem

func ReturnWithProblem(ctx *fiber.Ctx, problem problems.Problem, err error) error

func SignalHandler

func SignalHandler(ctx context.Context) context.Context

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 CheckerFunc func(c *fiber.Ctx) error

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 (*PredefinedController) AddFilter

func (r *PredefinedController) AddFilter(filter store.Filter)

func (*PredefinedController) AddPatch

func (r *PredefinedController) AddPatch(patch store.Patch)

func (*PredefinedController) FindMatchHandler

func (r *PredefinedController) FindMatchHandler(ogFilters []store.Filter, ogPatches []store.Patch) func(c *fiber.Ctx) error

func (*PredefinedController) NewListHandler

func (r *PredefinedController) NewListHandler(ogFilters []store.Filter) func(c *fiber.Ctx) error

func (*PredefinedController) NewPatchHandler

func (r *PredefinedController) NewPatchHandler(ogPatches []store.Patch) func(c *fiber.Ctx) error

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 (*ResourceController) CreateOrUpdate

func (r *ResourceController) CreateOrUpdate(c *fiber.Ctx) error

func (*ResourceController) Delete

func (r *ResourceController) Delete(c *fiber.Ctx) error

func (*ResourceController) List

func (r *ResourceController) List(c *fiber.Ctx) error

func (*ResourceController) Patch

func (r *ResourceController) Patch(c *fiber.Ctx) error

func (*ResourceController) Read

func (r *ResourceController) Read(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

type Server struct {
	App *fiber.App
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func NewServerWithApp

func NewServerWithApp(app *fiber.App) *Server

func (*Server) RegisterController

func (s *Server) RegisterController(controller Controller, opts ControllerOpts)

func (*Server) Start

func (s *Server) Start(addr string) error

type SimpleChecker

type SimpleChecker func() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL