Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handlers ¶
func Handlers(lock *sync.RWMutex, cfg *config.APIMode, shutdown chan os.Signal, logger *logrus.Logger, storedSpecs database.DBOpenAPILoader, AllowedIPCache *allowiplist.AllowedIPsType, waf coraza.WAF) fasthttp.RequestHandler
func NewHandlerUpdater ¶ added in v0.7.3
func NewHandlerUpdater(lock *sync.RWMutex, logger *logrus.Logger, sqlLiteStorage database.DBOpenAPILoader, cfg *config.APIMode, api *fasthttp.Server, shutdown chan os.Signal, health *Health, allowedIPCache *allowiplist.AllowedIPsType, waf coraza.WAF) updater.Updater
NewHandlerUpdater function defines configuration updater controller
Types ¶
type App ¶ added in v0.7.1
type App struct { Routers map[int]*router.Mux Log *logrus.Logger // contains filtered or unexported fields }
App is the entrypoint into our application and what configures our context object for each of our http handlers. Feel free to add any configuration data/logic on this App struct
func NewApp ¶ added in v0.7.1
func NewApp(lock *sync.RWMutex, passOPTIONS bool, storedSpecs database.DBOpenAPILoader, shutdown chan os.Signal, logger *logrus.Logger, mw ...web.Middleware) *App
NewApp creates an App value that handle a set of routes for the set of application.
func (*App) APIModeMainHandler ¶ added in v0.7.3
func (a *App) APIModeMainHandler(ctx *fasthttp.RequestCtx)
APIModeMainHandler routes request to the appropriate handler according to the OpenAPI specification schema ID
func (*App) Handle ¶ added in v0.7.1
func (a *App) Handle(schemaID int, method string, path string, handler router.Handler, mw ...web.Middleware) error
Handle is our mechanism for mounting Handlers for a given HTTP verb and path pair, this makes for really easy, convenient routing.
func (*App) SignalShutdown ¶ added in v0.7.1
func (a *App) SignalShutdown()
SignalShutdown is used to gracefully shutdown the app when an integrity issue is identified.
type Health ¶
type Health struct { Build string Logger *logrus.Logger OpenAPIDB database.DBOpenAPILoader }
func (*Health) Liveness ¶
func (h *Health) Liveness(ctx *fasthttp.RequestCtx) error
Liveness returns simple status info if the service is alive. If the app is deployed to a Kubernetes cluster, it will also return pod, node, and namespace details via the Downward API. The Kubernetes environment variables need to be set within your Pod/Deployment manifest.
type RequestValidator ¶ added in v0.7.1
type RequestValidator struct { CustomRoute *loader.CustomRoute OpenAPIRouter *loader.Router Log *logrus.Logger Cfg *config.APIMode ParserPool *fastjson.ParserPool SchemaID int }
func (*RequestValidator) Handler ¶ added in v0.7.1
func (s *RequestValidator) Handler(ctx *fasthttp.RequestCtx) error
Handler validates request and respond with 200, 403 (with error) or 500 status code
type Specification ¶ added in v0.7.3
type Specification struct {
// contains filtered or unexported fields
}
func (*Specification) Find ¶ added in v0.7.3
func (s *Specification) Find(rctx *router.Context, schemaID int, method, path string) (router.Handler, error)
Find function searches for the handler by path and method
func (*Specification) Load ¶ added in v0.7.3
func (s *Specification) Load() (database.DBOpenAPILoader, error)
Load function reads DB file and returns it
func (*Specification) Run ¶ added in v0.7.3
func (s *Specification) Run()
Run function performs update of the specification
func (*Specification) Shutdown ¶ added in v0.7.3
func (s *Specification) Shutdown() error
Shutdown function stops update process
func (*Specification) Start ¶ added in v0.7.3
func (s *Specification) Start() error
Start function starts update process every ConfigurationUpdatePeriod