forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabels.go
54 lines (43 loc) · 1.17 KB
/
labels.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package services
import (
"context"
config_proto "www.velocidex.com/golang/velociraptor/config/proto"
)
// The Label service is responsible for manipulating client's labels
// in a fast and efficient manner.
func GetLabeler(config_obj *config_proto.Config) Labeler {
org_manager, err := GetOrgManager()
if err != nil {
return nil
}
l, _ := org_manager.Services(config_obj.OrgId).Labeler()
return l
}
type Labeler interface {
// Get the last time any labeling operation modified the
// client's labels.
LastLabelTimestamp(
ctx context.Context,
config_obj *config_proto.Config,
client_id string) uint64
// Is the label set for this client.
IsLabelSet(
ctx context.Context,
config_obj *config_proto.Config,
client_id string, label string) bool
// Set the label
SetClientLabel(
ctx context.Context,
config_obj *config_proto.Config,
client_id, label string) error
// Remove the label from the client.
RemoveClientLabel(
ctx context.Context,
config_obj *config_proto.Config,
client_id, label string) error
// Gets all the labels in a client.
GetClientLabels(
ctx context.Context,
config_obj *config_proto.Config,
client_id string) []string
}