Documentation ¶
Overview ¶
Package api contains the handlers and types that support nerd's REST API
Index ¶
- func StartupCheck(c *gin.Context)
- type Handler
- func (h *Handler) DeleteNet(c *gin.Context)
- func (h *Handler) DeleteSeries(c *gin.Context)
- func (h *Handler) Evaluate(c *gin.Context)
- func (h *Handler) ListNets(c *gin.Context)
- func (h *Handler) ListPoints(c *gin.Context)
- func (h *Handler) ListSeries(c *gin.Context)
- func (h *Handler) ListSeriesNets(c *gin.Context)
- func (h *Handler) ProcessEvent(c *gin.Context)
- func (h *Handler) ShowWelcomeMsg(c *gin.Context)
- func (h *Handler) Train(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartupCheck ¶
StartupCheck godoc @Summary Kubernetes startup probe endpoint @Description Will return a 200 as long as the API is up @Produce plain @Success 200 {object} types.SimpleRes @Router /health/startup [get]
Types ¶
type Handler ¶
type Handler struct { Conf config.Config NPS paramstores.NetParamStore PS pointstores.PointStore Router *gin.Engine TServ chan types.TrainRequest }
Handler holds the API's state
func (*Handler) DeleteNet ¶
DeleteNet godoc @Summary Network deletion endpoint @Description Will delete the net with the specified ID @Produce json @Param id path string true "Net ID" @Success 200 {object} types.SimpleRes @Failure 500 {object} types.SimpleRes "When there is an error deleting the net" @Router /nets/{id} [delete]
func (*Handler) DeleteSeries ¶
DeleteSeries godoc @Summary Series deletion endpoint @Description Will delete the series with the specified ID @Produce json @Param id path string true "Series ID" @Success 200 {object} types.SimpleRes @Failure 404 {object} types.SimpleRes "When the series doesn't exist" @Failure 500 {object} types.SimpleRes "When there is an error deleting the series" @Router /series/{id} [delete]
func (*Handler) Evaluate ¶
Evaluate godoc @Summary Input evaluation endpoint @Description Will return the output produced by the given net for the given input @Accept json @Produce json @Param id path string true "Net ID" @Success 200 {object} map[string]float32 @Failure 400 {object} types.SimpleRes "When the request body is formatted incorrectly" @Failure 404 {object} types.SimpleRes "When the provided net ID isn't found" @Failure 500 {object} types.SimpleRes "When there is an error loading the net or evaluating the inputs" @Router /nets/{id}/evaluate [post]
func (*Handler) ListNets ¶
ListNets godoc @Summary Nets endpoint @Description Will return the paginated list of neural nets in the system @Produce json @Param offset query int false "Offset to fetch" default(0) @Param limit query int false "How many networks to fetch, the service might return more in some cases" default(10) maximum(50) @Param seriesID query string false "Filter by series ID" @Success 200 {object} types.PagedRes @Failure 400 {object} types.SimpleRes "When the request params are formatted incorrectly" @Failure 500 {object} types.SimpleRes "When there is an error retrieving the list of nets" @Router /nets [get]
func (*Handler) ListPoints ¶
ListPoints godoc @Summary Retrieve points from series @Description Will return the last N points for the given series @Produce json @Param id path string true "Series ID" @Param limit query int false "How many points to fetch" default(10) maximum(500) @Success 200 {array} pointstores.Point @Failure 404 {object} types.SimpleRes "When the series doesn't exist" @Failure 500 {object} types.SimpleRes "When there is an error fetching the points" @Router /series/{id}/points [get]
func (*Handler) ListSeries ¶
ListSeries godoc @Summary Retrieve list of series @Description Will return the list of series in the system @Produce json @Success 200 {array} types.BriefSeries @Failure 500 {object} types.SimpleRes "When there is an error fetching the list of series" @Router /series [get]
func (*Handler) ListSeriesNets ¶ added in v0.4.0
ListSeriesNets godoc @Summary Alias for retrieving the nets for the given series @Description Will return the list of nets in the system trained with the given series @Produce json @Param id path string true "Series ID" @Param offset query int false "Offset to fetch" default(0) @Param limit query int false "How many networks to fetch, the service might return more in some cases" default(10) maximum(50) @Success 200 {object} types.PagedRes @Failure 400 {object} types.SimpleRes "When the request params are formatted incorrectly" @Failure 500 {object} types.SimpleRes "When there is an error fetching the list of nets" @Router /series/{id}/nets [get]
func (*Handler) ProcessEvent ¶ added in v0.3.0
ProcessEvent godoc @Summary Metric ingestion endpoint @Description Will process the provided metrics update @Accept json @Produce json @Success 202 {object} types.SimpleRes @Failure 400 {object} types.SimpleRes "When the request body is formatted incorrectly" @Failure 500 {object} types.SimpleRes "When there is an error processing the update" @Router /series/process [post]
func (*Handler) ShowWelcomeMsg ¶ added in v0.3.0
ShowWelcomeMsg is a simple handler method for showing a helpful message at the root of the HTTP server
func (*Handler) Train ¶
Train godoc @Summary Net training endpoint @Description Used for training new or existing networks with the points from an existing series @Accept json @Produce json @Success 200 {object} types.SimpleRes @Failure 400 {object} types.SimpleRes "When the request body is formatted incorrectly" @Failure 404 {object} types.SimpleRes "When the provided series ID isn't found" @Failure 500 {object} types.SimpleRes "When there is an error processing the request" @Router /nets [post]