2016-11-02 14:59:53 +00:00
|
|
|
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)
|
|
|
|
|
2016-11-18 17:23:44 +00:00
|
|
|
// 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.
|
2016-11-23 00:35:43 +00:00
|
|
|
CountHostsInTargets(ctx context.Context, hostIDs []uint, labelIDs []uint) (total uint, online uint, err error)
|
2016-11-02 14:59:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type TargetType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
TargetLabel TargetType = iota
|
|
|
|
TargetHost
|
|
|
|
)
|
|
|
|
|
|
|
|
type Target struct {
|
|
|
|
Type TargetType
|
|
|
|
TargetID uint
|
|
|
|
}
|