api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartupCheck

func StartupCheck(c *gin.Context)

StartupCheck godoc @Summary Kubernetes startup probe endpoint @Description Will return a 200 as long as the API is up @Produce plain @Success 200 {string} string @Router /health/startup [get]

Types

type Handler

type Handler struct {
	Conf   config.Config
	MLS    paramstores.NetParamStore
	PS     pointstores.PointStore
	Router *gin.Engine
	TServ  chan types.TrainRequest
}

Handler holds the API's state

func New

func New(tServ chan types.TrainRequest, conf config.Config) (*Handler, error)

New initializes the Gin rest api and returns a handler

func (*Handler) AddPoint

func (h *Handler) AddPoint(c *gin.Context)

AddPoint godoc @Summary Metric ingestion endpoint @Description Will return the output produced by the given net for the given input @Accept json @Produce json @Success 202 @Failure 400 {object} types.APIError "When the request body is formatted incorrectly" @Failure 500 {object} types.APIError "When there is an error processing the update" @Router /series/process [post]

func (*Handler) DeleteNet

func (h *Handler) DeleteNet(c *gin.Context)

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 @Failure 500 {object} types.APIError "When there is an error deleting the net" @Router /nets/{id} [delete]

func (*Handler) DeleteSeries

func (h *Handler) DeleteSeries(c *gin.Context)

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 @Failure 404 {object} types.APIError "When the series doesn't exist" @Failure 500 {object} types.APIError "When there is an error deleting the series" @Router /series/{id} [delete]

func (*Handler) Evaluate

func (h *Handler) Evaluate(c *gin.Context)

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.APIError "When the request body is formatted incorrectly" @Failure 404 {object} types.APIError "When the provided net ID isn't found" @Failure 500 {object} types.APIError "When there is an error loading the net or evaluating the inputs" @Router /nets/{id}/evaluate [post]

func (*Handler) ListNets

func (h *Handler) ListNets(c *gin.Context)

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) @Success 200 {object} types.PagedRes @Failure 400 {object} types.APIError "When the request params are formatted incorrectly" @Failure 500 {object} types.APIError "When there is an error retrieving the list of nets" @Router /nets [get]

func (*Handler) ListPoints

func (h *Handler) ListPoints(c *gin.Context)

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.APIError "When the series doesn't exist" @Failure 500 {object} types.APIError "When there is an error fetching the points" @Router /series/{id}/points [get]

func (*Handler) ListSeries

func (h *Handler) ListSeries(c *gin.Context)

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.APIError "When there is an error fetching the list of series" @Router /series [get]

func (*Handler) Train

func (h *Handler) Train(c *gin.Context)

Train godoc @Summary Net train endpoint @Description Used for training new or existing networks with the points from an existing series @Accept json @Success 200 @Failure 400 {object} types.APIError "When the request body is formatted incorrectly" @Failure 404 {object} types.APIError "When the provided series ID isn't found" @Failure 500 {object} types.APIError "When there is an error processing the request" @Router /nets [post]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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