-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoo.proto
105 lines (88 loc) · 1.79 KB
/
moo.proto
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
syntax = "proto3";
option go_package = "github.com/ebauman/moo/pkg/rpc";
// protoc --go_out=plugins=grpc:pkg/rpc --go_opt=paths=source_relative moo.proto
service Moo {
rpc GetAgentStatus(AgentID) returns (StatusResponse) {}
rpc RegisterAgent(Agent) returns (RegisterResponse) {}
rpc GetManifestURL(AgentID) returns (ManifestResponse) {}
rpc ListAgents(ListRequest) returns (AgentListResponse) {}
}
service Rules {
rpc ListRules(Empty) returns (RuleList) {}
rpc AddRule(Rule) returns (AddResponse) {}
rpc DeleteRule(RuleIndex) returns (DeleteResponse) {}
}
message AgentListResponse {
repeated Agent Agents = 1;
}
message ListRequest {
Status Status = 1;
}
message Empty {
}
message AgentID {
string ID = 1;
}
enum Status{
Unknown = 0; // initial
Accepted = 1; // yay!
Held = 2; // hold off
Denied = 3; // go away
Pending = 4; // hang on
Error = 5; // uh oh
}
message StatusResponse {
Status Status = 1;
string Message = 2;
int32 HoldTime = 3;
int32 PendingTime = 4;
int32 ErrorTime = 5;
}
message Agent {
string ID = 1;
string Secret = 2;
string IP = 3;
Status Status = 4;
string ManifestUrl = 5;
string StatusMessage = 6;
bool completed = 7;
string LastContact = 8;
string ClusterName = 9;
bool UseExisting = 10;
}
message RegisterResponse {
bool Success = 1;
}
message ManifestResponse {
bool Success = 1;
string URL = 2;
}
enum RuleType {
SourceIP = 0;
SharedSecret = 1;
ClusterName = 2;
All = 3;
}
enum RuleAction {
Hold = 0;
Accept = 1;
Deny = 2;
}
message Rule {
RuleType Type = 1;
RuleAction Action = 2;
int32 Priority = 3;
string Regex = 4;
}
message RuleList {
repeated Rule Rules = 1;
}
message AddResponse {
bool Success = 1;
}
message DeleteResponse {
bool Success = 1;
}
message RuleIndex {
int32 Index = 1;
}