Documentation ¶
Index ¶
- Constants
- Variables
- func BuildAlertRequestFromFilter(alerts *ent.AlertQuery, filter map[string][]string) (*ent.AlertQuery, error)
- func BuildDecisionRequestWithFilter(query *ent.DecisionQuery, filter map[string][]string) (*ent.DecisionQuery, error)
- func GetIpsFromIpRange(host string) (int64, int64, error)
- func IP2Int(ip net.IP) uint32
- func Int2ip(nn uint32) net.IP
- func IsIpv4(host string) bool
- func LastAddress(n *net.IPNet) net.IP
- type Client
- func (c *Client) CreateAlert(machineID string, alertList []*models.Alert) ([]string, error)
- func (c *Client) CreateAlertBulk(machineId string, alertList []*models.Alert) ([]string, error)
- func (c *Client) CreateBouncer(name string, ipAddr string, apiKey string) error
- func (c *Client) CreateMachine(machineID *string, password *strfmt.Password, ipAddress string, ...) (int, error)
- func (c *Client) DeleteAlertGraph(alertItem *ent.Alert) error
- func (c *Client) DeleteAlertGraphBatch(alertItems []*ent.Alert) (int, error)
- func (c *Client) DeleteAlertWithFilter(filter map[string][]string) (int, error)
- func (c *Client) DeleteBouncer(name string) error
- func (c *Client) DeleteDecisionById(decisionId int) error
- func (c *Client) DeleteDecisionsWithFilter(filter map[string][]string) (string, error)
- func (c *Client) DeleteWatcher(name string) error
- func (c *Client) FlushAlerts(MaxAge string, MaxItems int) error
- func (c *Client) FlushOrphans()
- func (c *Client) GetAlertByID(alertID int) (*ent.Alert, error)
- func (c *Client) IsMachineRegistered(machineID string) (bool, error)
- func (c *Client) ListBouncers() ([]*ent.Bouncer, error)
- func (c *Client) ListMachines() ([]*ent.Machine, error)
- func (c *Client) QueryAlertWithFilter(filter map[string][]string) ([]*ent.Alert, error)
- func (c *Client) QueryAllDecisionsWithFilters(filters map[string][]string) ([]*ent.Decision, error)
- func (c *Client) QueryDecisionWithFilter(filter map[string][]string) ([]*ent.Decision, error)
- func (c *Client) QueryExpiredDecisionsSinceWithFilters(since time.Time, filters map[string][]string) ([]*ent.Decision, error)
- func (c *Client) QueryExpiredDecisionsWithFilters(filters map[string][]string) ([]*ent.Decision, error)
- func (c *Client) QueryMachineByID(machineID string) (*ent.Machine, error)
- func (c *Client) QueryNewDecisionsSinceWithFilters(since time.Time, filters map[string][]string) ([]*ent.Decision, error)
- func (c *Client) QueryPendingMachine() ([]*ent.Machine, error)
- func (c *Client) SelectBouncer(apiKeyHash string) (*ent.Bouncer, error)
- func (c *Client) SoftDeleteDecisionByID(decisionID int) error
- func (c *Client) SoftDeleteDecisionsWithFilter(filter map[string][]string) (string, error)
- func (c *Client) StartFlushScheduler(config *csconfig.FlushDBCfg) (*gocron.Scheduler, error)
- func (c *Client) TotalAlerts() (int, error)
- func (c *Client) UpdateBouncerIP(ipAddr string, ID int) error
- func (c *Client) UpdateBouncerLastPull(lastPull time.Time, ID int) error
- func (c *Client) UpdateBouncerTypeAndVersion(bType string, version string, ID int) error
- func (c *Client) UpdateCommunityBlocklist(alertItem *models.Alert) (int, int, int, error)
- func (c *Client) UpdateMachineIP(ipAddr string, ID int) error
- func (c *Client) UpdateMachineLastPush(machineID string) error
- func (c *Client) UpdateMachineScenarios(scenarios string, ID int) error
- func (c *Client) UpdateMachineVersion(ipAddr string, ID int) error
- func (c *Client) ValidateMachine(machineID string) error
Constants ¶
View Source
const CapiMachineID = "CAPI"
Variables ¶
View Source
var ( UserExists = errors.New("user already exist") UserNotExists = errors.New("user doesn't exist") HashError = errors.New("unable to hash") InsertFail = errors.New("unable to insert row") QueryFail = errors.New("unable to query") UpdateFail = errors.New("unable to update") DeleteFail = errors.New("unable to delete") ItemNotFound = errors.New("object not found") ParseTimeFail = errors.New("unable to parse time") ParseDurationFail = errors.New("unable to parse duration") MarshalFail = errors.New("unable to marshal") UnmarshalFail = errors.New("unable to unmarshal") BulkError = errors.New("unable to insert bulk") ParseType = errors.New("unable to parse type") InvalidIPOrRange = errors.New("invalid ip address / range") InvalidFilter = errors.New("invalid filter") )
Functions ¶
func BuildAlertRequestFromFilter ¶ added in v1.0.0
func BuildAlertRequestFromFilter(alerts *ent.AlertQuery, filter map[string][]string) (*ent.AlertQuery, error)
func BuildDecisionRequestWithFilter ¶ added in v1.0.0
func BuildDecisionRequestWithFilter(query *ent.DecisionQuery, filter map[string][]string) (*ent.DecisionQuery, error)
func LastAddress ¶ added in v1.0.0
Stolen from : https://github.com/llimllib/ipaddress/ Return the final address of a net range. Convert to IPv4 if possible, otherwise return an ipv6
Types ¶
type Client ¶ added in v1.0.0
func (*Client) CreateAlert ¶ added in v1.0.0
func (*Client) CreateAlertBulk ¶ added in v1.0.0
func (*Client) CreateBouncer ¶ added in v1.0.0
func (*Client) CreateMachine ¶ added in v1.0.0
func (*Client) DeleteAlertGraph ¶ added in v1.0.0
func (*Client) DeleteAlertGraphBatch ¶ added in v1.2.1
func (*Client) DeleteAlertWithFilter ¶ added in v1.0.0
func (*Client) DeleteBouncer ¶ added in v1.0.0
func (*Client) DeleteDecisionById ¶ added in v1.0.0
func (*Client) DeleteDecisionsWithFilter ¶ added in v1.0.0
func (*Client) DeleteWatcher ¶ added in v1.0.0
func (*Client) FlushAlerts ¶ added in v1.0.0
func (*Client) FlushOrphans ¶ added in v1.1.0
func (c *Client) FlushOrphans()
func (*Client) GetAlertByID ¶ added in v1.0.0
func (*Client) IsMachineRegistered ¶ added in v1.0.0
func (*Client) ListBouncers ¶ added in v1.0.0
func (*Client) ListMachines ¶ added in v1.0.0
func (*Client) QueryAlertWithFilter ¶ added in v1.0.0
func (*Client) QueryAllDecisionsWithFilters ¶ added in v1.1.0
func (*Client) QueryDecisionWithFilter ¶ added in v1.0.0
func (*Client) QueryExpiredDecisionsSinceWithFilters ¶ added in v1.1.0
func (*Client) QueryExpiredDecisionsWithFilters ¶ added in v1.1.0
func (*Client) QueryMachineByID ¶ added in v1.0.0
func (*Client) QueryNewDecisionsSinceWithFilters ¶ added in v1.1.0
func (*Client) QueryPendingMachine ¶ added in v1.0.0
func (*Client) SelectBouncer ¶ added in v1.0.0
func (*Client) SoftDeleteDecisionByID ¶ added in v1.0.0
SoftDeleteDecisionByID set the expiration of a decision to now()
func (*Client) SoftDeleteDecisionsWithFilter ¶ added in v1.0.0
SoftDeleteDecisionsWithFilter updates the expiration time to now() for the decisions matching the filter
func (*Client) StartFlushScheduler ¶ added in v1.0.0
func (*Client) TotalAlerts ¶ added in v1.0.0
func (*Client) UpdateBouncerIP ¶ added in v1.0.0
func (*Client) UpdateBouncerLastPull ¶ added in v1.0.0
func (*Client) UpdateBouncerTypeAndVersion ¶ added in v1.0.0
func (*Client) UpdateCommunityBlocklist ¶ added in v1.2.0
We can't bulk both the alert and the decision at the same time. With new consensus, we want to bulk a single alert with a lot of decisions.
func (*Client) UpdateMachineIP ¶ added in v1.0.0
func (*Client) UpdateMachineLastPush ¶ added in v1.3.0
func (*Client) UpdateMachineScenarios ¶ added in v1.0.0
func (*Client) UpdateMachineVersion ¶ added in v1.0.0
func (*Client) ValidateMachine ¶ added in v1.0.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.