mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
0b612eedab
- New route `/api/v1/kolide/results/{id}` with upgrade to websocket connection - Query results pushed over websocket as they are received from pubsub - Target totals updates pushed over websocket every second - New datastore method to support retrieiving target totals - Websocket package includes helpers and patterns for communicating over websockets
35 lines
953 B
Go
35 lines
953 B
Go
package kolide
|
|
|
|
import (
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
type TargetSearchResults struct {
|
|
Hosts []Host
|
|
Labels []Label
|
|
}
|
|
|
|
type TargetService interface {
|
|
// SearchTargets will accept a search query, a slice of IDs of hosts to omit,
|
|
// and a slice of IDs of labels to omit, and it will return a set of targets
|
|
// (hosts and label) which match the supplied search query.
|
|
SearchTargets(ctx context.Context, query string, selectedHostIDs []uint, selectedLabelIDs []uint) (*TargetSearchResults, error)
|
|
|
|
// CountHostsInTargets returns the count of hosts in the selected
|
|
// targets. The first return uint is the total number of hosts in the
|
|
// targets. The second return uint is the total online hosts.
|
|
CountHostsInTargets(ctx context.Context, hostIDs []uint, labelIDs []uint) (total uint, online uint, err error)
|
|
}
|
|
|
|
type TargetType int
|
|
|
|
const (
|
|
TargetLabel TargetType = iota
|
|
TargetHost
|
|
)
|
|
|
|
type Target struct {
|
|
Type TargetType
|
|
TargetID uint
|
|
}
|