Documentation
¶
Overview ¶
Package web provides HTTP handlers for the trustwatch web UI and API.
Index ¶
- func HealthzHandler(getSnapshot SnapshotFunc, maxAge time.Duration) http.HandlerFunc
- func HistoryHandler(hs *history.Store) http.HandlerFunc
- func ReadyzHandler(getSnapshot SnapshotFunc, maxAge time.Duration) http.HandlerFunc
- func SnapshotHandler(getSnapshot SnapshotFunc) http.HandlerFunc
- func TrendHandler(hs *history.Store) http.HandlerFunc
- func UIHandler(getSnapshot SnapshotFunc, opts ...func(*UIConfig)) http.HandlerFunc
- func WithHistoryEnabled() func(*UIConfig)
- type SnapshotFunc
- type UIConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HealthzHandler ¶
func HealthzHandler(getSnapshot SnapshotFunc, maxAge time.Duration) http.HandlerFunc
HealthzHandler returns 200 when a scan has completed within maxAge, 503 otherwise. A zero maxAge disables staleness checks (always healthy if any scan completed).
func HistoryHandler ¶ added in v0.2.0
func HistoryHandler(hs *history.Store) http.HandlerFunc
HistoryHandler returns the most recent snapshot summaries as JSON.
func ReadyzHandler ¶ added in v0.3.0
func ReadyzHandler(getSnapshot SnapshotFunc, maxAge time.Duration) http.HandlerFunc
ReadyzHandler returns JSON readiness detail. Returns 200 when scan is fresh, 503 when stale or no scan completed.
func SnapshotHandler ¶
func SnapshotHandler(getSnapshot SnapshotFunc) http.HandlerFunc
SnapshotHandler returns the full snapshot as JSON. Accepts optional query params: ?source=, ?severity=, ?namespace= (comma-separated).
func TrendHandler ¶ added in v0.2.0
func TrendHandler(hs *history.Store) http.HandlerFunc
TrendHandler returns trend data points for a specific finding as JSON.
func UIHandler ¶
func UIHandler(getSnapshot SnapshotFunc, opts ...func(*UIConfig)) http.HandlerFunc
UIHandler serves the problems web UI, filtering to critical+warn only.
func WithHistoryEnabled ¶ added in v0.2.0
func WithHistoryEnabled() func(*UIConfig)
WithHistoryEnabled marks that the /api/v1/trend endpoint is available.
Types ¶
type SnapshotFunc ¶
SnapshotFunc returns the current snapshot.