Documentation ¶
Index ¶
- Variables
- func FormatAlerts(result []*ent.Alert) models.AddAlertsRequest
- func FormatDecisions(decisions []*ent.Decision) ([]*models.Decision, error)
- func FormatOneAlert(alert *ent.Alert) *models.Alert
- func PrometheusMiddleware() gin.HandlerFunc
- type Controller
- func (c *Controller) CreateAlert(gctx *gin.Context)
- func (c *Controller) CreateMachine(gctx *gin.Context)
- func (c *Controller) DeleteAlerts(gctx *gin.Context)
- func (c *Controller) DeleteDecisionById(gctx *gin.Context)
- func (c *Controller) DeleteDecisions(gctx *gin.Context)
- func (c *Controller) FindAlertByID(gctx *gin.Context)
- func (c *Controller) FindAlerts(gctx *gin.Context)
- func (c *Controller) GetDecision(gctx *gin.Context)
- func (c *Controller) HandleDBErrors(gctx *gin.Context, err error)
- func (c *Controller) StreamDecision(gctx *gin.Context)
Constants ¶
This section is empty.
Variables ¶
View Source
var ApilRouteHits = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_apil_route_calls", Help: "Number of calls to each route.", }, []string{"route", "method"}, )
prometheus
Functions ¶
func FormatAlerts ¶
func FormatAlerts(result []*ent.Alert) models.AddAlertsRequest
FormatAlerts : Format results from the database to be swagger model compliant
func PrometheusMiddleware ¶
func PrometheusMiddleware() gin.HandlerFunc
Types ¶
type Controller ¶
type Controller struct { Ectx context.Context DBClient *database.Client APIKeyHeader string Middlewares *middlewares.Middlewares Profiles []*csconfig.ProfileCfg CAPIChan chan []*models.Alert }
func New ¶
func New(dbClient *database.Client, ctx context.Context, profiles []*csconfig.ProfileCfg, capiChan chan []*models.Alert) (*Controller, error)
func (*Controller) CreateAlert ¶
func (c *Controller) CreateAlert(gctx *gin.Context)
CreateAlert : write received alerts in body to the database
func (*Controller) CreateMachine ¶
func (c *Controller) CreateMachine(gctx *gin.Context)
func (*Controller) DeleteAlerts ¶
func (c *Controller) DeleteAlerts(gctx *gin.Context)
DeleteAlerts : delete alerts from database based on the specified filter
func (*Controller) DeleteDecisionById ¶
func (c *Controller) DeleteDecisionById(gctx *gin.Context)
func (*Controller) DeleteDecisions ¶
func (c *Controller) DeleteDecisions(gctx *gin.Context)
func (*Controller) FindAlertByID ¶
func (c *Controller) FindAlertByID(gctx *gin.Context)
FindAlertByID return the alert assiocated to the ID
func (*Controller) FindAlerts ¶
func (c *Controller) FindAlerts(gctx *gin.Context)
FindAlerts : return alerts from database based on the specified filter
func (*Controller) GetDecision ¶
func (c *Controller) GetDecision(gctx *gin.Context)
func (*Controller) HandleDBErrors ¶
func (c *Controller) HandleDBErrors(gctx *gin.Context, err error)
func (*Controller) StreamDecision ¶
func (c *Controller) StreamDecision(gctx *gin.Context)
Click to show internal directories.
Click to hide internal directories.