v1

package
v1.0.0-rc Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

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 FormatDecisions

func FormatDecisions(decisions []*ent.Decision) ([]*models.Decision, error)

func FormatOneAlert

func FormatOneAlert(alert *ent.Alert) *models.Alert

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)

Jump to

Keyboard shortcuts

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