-
Notifications
You must be signed in to change notification settings - Fork 13
/
plugin.proto
125 lines (106 loc) · 3 KB
/
plugin.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
syntax = "proto3";
package hashicorp.sentinel.proto;
option go_package = "./;proto";
//-------------------------------------------------------------------
// Plugin Service
// Plugin is the RPC service that must be implemented by a valid plugin
// for Sentinel. Sentinel can then consume this plugin.
service Plugin {
rpc Configure(Configure.Request) returns (Configure.Response);
rpc Get(Get.MultiRequest) returns (Get.MultiResponse);
rpc Close(Close.Request) returns (Empty);
}
// Empty is just an empty message.
message Empty {}
// Configure are the structures for Plugin.Configure
message Configure {
message Request {
Value config = 3;
}
message Response {
uint64 instance_id = 1;
}
}
// Get are the structures for a Plugin.Get.
message Get {
// Request is a single request for a Get.
message Request {
message Key {
string key = 1;
repeated Value args = 2;
bool call = 3;
}
uint64 instance_id = 1;
uint64 exec_id = 2;
uint64 exec_deadline = 3;
repeated Key keys = 4;
uint64 key_id = 5;
map<string,Value> context = 6;
}
// Response is a single response for a Get.
message Response {
uint64 instance_id = 1;
uint64 key_id = 2;
repeated string keys = 3;
Value value = 4;
map<string,Value> context = 5;
bool callable = 6;
}
// MultiRequest allows multiple requests in a single Get.
message MultiRequest {
repeated Request requests = 1;
}
// MultiResponse allows multiple responses in a single Get.
message MultiResponse {
repeated Response responses = 1;
}
}
// Close contains the structures for Close RPC calls.
message Close {
message Request {
uint64 instance_id = 1;
}
}
//-------------------------------------------------------------------
// Sentinel Values
// Value represents a Sentinel value.
message Value {
// Type is an enum representing the type of the value. This isn't the
// full set of Sentinel types since some types cannot be sent via
// Protobufs such as rules or functions.
enum Type {
INVALID = 0;
UNDEFINED = 1;
NULL = 2;
BOOL = 3;
INT = 4;
FLOAT = 5;
STRING = 6;
LIST = 7;
MAP = 8;
}
message KV {
Value key = 1;
Value value = 2;
}
message Map {
repeated KV elems = 1;
}
message List {
repeated Value elems = 1;
}
// type is the type of this value
Type type = 1;
// value is the value only if the type is not UNDEFINED or NULL.
// If the value is UNDEFINED or NULL, then the value is known.
oneof value {
bool value_bool = 2;
int64 value_int = 3;
double value_float = 4;
string value_string = 5;
List value_list = 6;
Map value_map = 7;
}
}