Documentation ¶
Index ¶
- func Chapter(w http.ResponseWriter, req *http.Request)
- func Config(w http.ResponseWriter, req *http.Request)
- func Dashboard(w http.ResponseWriter, req *http.Request)
- func Docs(w http.ResponseWriter, req *http.Request)
- func FormatOutput(outputFormat string, textTemplate string, output interface{}) (string, error)
- func GetOutputFormat(req *http.Request) string
- func Healthz(w http.ResponseWriter, req *http.Request)
- func History(w http.ResponseWriter, req *http.Request)
- func Home(w http.ResponseWriter, req *http.Request)
- func IsValidUUID(u string) bool
- func LogPingRequest(req *http.Request, heartbeatName string)
- func LogRequest(req *http.Request)
- func NotFound(w http.ResponseWriter, req *http.Request)
- func ParseTemplates(name string, templates []string, data any, w http.ResponseWriter)
- func Ping(w http.ResponseWriter, req *http.Request)
- func PingFail(w http.ResponseWriter, req *http.Request)
- func PingHelp(w http.ResponseWriter, req *http.Request)
- func Status(w http.ResponseWriter, req *http.Request)
- func Version(w http.ResponseWriter, req *http.Request)
- func WriteOutput(w http.ResponseWriter, statusCode int, outputFormat string, output interface{}, ...)
- type HeartbeatStatus
- type ResponseStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chapter ¶
func Chapter(w http.ResponseWriter, req *http.Request)
Chapter is the handler for the documentation chapters
func Config ¶
func Config(w http.ResponseWriter, req *http.Request)
Config returns the configuration of the heartbeats server
func Dashboard ¶
func Dashboard(w http.ResponseWriter, req *http.Request)
HandlerDashboard is the handler for the /dashboard endpoint
func Docs ¶
func Docs(w http.ResponseWriter, req *http.Request)
Docs is the handler for the docs page
func FormatOutput ¶
FormatOutput formats the output according to outputFormat
func GetOutputFormat ¶
CheckOutput checks if the output format is supported
func Healthz ¶
func Healthz(w http.ResponseWriter, req *http.Request)
Healthz is the handler for the /healthz endpoint
func History ¶
func History(w http.ResponseWriter, req *http.Request)
HandlerHistory is the handler for the /history endpoint
func Home ¶
func Home(w http.ResponseWriter, req *http.Request)
Home is the handler for the / endpoint
func IsValidUUID ¶
IsValidUUID checks if the given string is a valid UUID
func LogPingRequest ¶
func NotFound ¶
func NotFound(w http.ResponseWriter, req *http.Request)
NotFound is the handler for the 404 page
func ParseTemplates ¶
func ParseTemplates(name string, templates []string, data any, w http.ResponseWriter)
ParseBaseTemplates parses the templates for docs and writes the output to the response writer
func Ping ¶
func Ping(w http.ResponseWriter, req *http.Request)
Ping is the handler for the /ping/<heartbeat> endpoint
func PingFail ¶
func PingFail(w http.ResponseWriter, req *http.Request)
PingFail is the handler for the /ping/<heartbeat>/fail endpoint
func PingHelp ¶
func PingHelp(w http.ResponseWriter, req *http.Request)
PingHelp is the handler for the /ping endpoint
func Status ¶
func Status(w http.ResponseWriter, req *http.Request)
Status is the handler for the /status endpoint
func Version ¶
func Version(w http.ResponseWriter, req *http.Request)
Version is the handler for the /version endpoint
func WriteOutput ¶
func WriteOutput(w http.ResponseWriter, statusCode int, outputFormat string, output interface{}, textTemplate string)
WriteOutput writes the output to the response writer
- w is the response writer - statusCode is the HTTP status code - outputFormat is the format of the output (json, yaml, yml, txt, text) - output is the data to render the template with - textTmpl is the template to use for the text output
Types ¶
type HeartbeatStatus ¶
type HeartbeatStatus struct { Name string `json:"name"` Status string `json:"status"` LastPing time.Time `json:"lastPing"` }
HeartbeatStatus represents a heartbeat status
type ResponseStatus ¶
ResponseStatus represents a response