-
Notifications
You must be signed in to change notification settings - Fork 13
/
schema.proto
193 lines (151 loc) · 7.11 KB
/
schema.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/**
* Flag evaluation API
*
* This proto forms the basis of a flag-evaluation API.
* It supports single and bulk evaluation RPCs, and flags of various types, as well as establishing a stream for getting notifications about changes in a flag definition.
* It supports the inclusion of a "context" with each evaluation, which may contain arbitrary attributes relevant to flag evaluation.
*/
syntax = "proto3";
package schema.v1;
import "google/protobuf/struct.proto";
option csharp_namespace = "OpenFeature.Flagd.Grpc";
option go_package = "schema/service/v1";
option java_package = "dev.openfeature.flagd.grpc";
option php_namespace = "OpenFeature\\Providers\\Flagd\\Schema\\Grpc";
option ruby_package = "OpenFeature::FlagD::Provider::Grpc";
// Request body for bulk flag evaluation, used by the ResolveAll rpc.
message ResolveAllRequest {
// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context
google.protobuf.Struct context = 1;
}
// Response body for bulk flag evaluation, used by the ResolveAll rpc.
message ResolveAllResponse {
// Object structure describing the evaluated flags for the provided context.
map<string, AnyFlag> flags = 1;
}
// A variant type flag response.
message AnyFlag {
// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details
string reason = 1;
// The variant name of the returned flag value.
string variant = 2;
// The response value of the boolean flag evaluation, will be unset in the case of error.
oneof value {
bool bool_value = 3;
string string_value = 4;
double double_value = 5;
google.protobuf.Struct object_value = 6;
}
}
// Request body for boolean flag evaluation, used by the ResolveBoolean rpc.
message ResolveBooleanRequest {
// Flag key of the requested flag.
string flag_key = 1;
// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context
google.protobuf.Struct context = 2;
}
// Response body for boolean flag evaluation. used by the ResolveBoolean rpc.
message ResolveBooleanResponse {
// The response value of the boolean flag evaluation, will be unset in the case of error.
bool value = 1;
// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details
string reason = 2;
// The variant name of the returned flag value.
string variant = 3;
// Metadata for this evaluation
google.protobuf.Struct metadata = 4;
}
// Request body for string flag evaluation, used by the ResolveString rpc.
message ResolveStringRequest {
// Flag key of the requested flag.
string flag_key = 1;
// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context
google.protobuf.Struct context = 2;
}
// Response body for string flag evaluation. used by the ResolveString rpc.
message ResolveStringResponse {
// The response value of the string flag evaluation, will be unset in the case of error.
string value = 1;
// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details
string reason = 2;
// The variant name of the returned flag value.
string variant = 3;
// Metadata for this evaluation
google.protobuf.Struct metadata = 4;
}
// Request body for float flag evaluation, used by the ResolveFloat rpc.
message ResolveFloatRequest {
// Flag key of the requested flag.
string flag_key = 1;
// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context
google.protobuf.Struct context = 2;
}
// Response body for float flag evaluation. used by the ResolveFloat rpc.
message ResolveFloatResponse {
// The response value of the float flag evaluation, will be empty in the case of error.
double value = 1;
// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details
string reason = 2;
// The variant name of the returned flag value.
string variant = 3;
// Metadata for this evaluation
google.protobuf.Struct metadata = 4;
}
// Request body for int flag evaluation, used by the ResolveInt rpc.
message ResolveIntRequest {
// Flag key of the requested flag.
string flag_key = 1;
// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context
google.protobuf.Struct context = 2;
}
// Response body for int flag evaluation. used by the ResolveInt rpc.
message ResolveIntResponse {
// The response value of the int flag evaluation, will be unset in the case of error.
int64 value = 1;
// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details
string reason = 2;
// The variant name of the returned flag value.
string variant = 3;
// Metadata for this evaluation
google.protobuf.Struct metadata = 4;
}
// Request body for object flag evaluation, used by the ResolveObject rpc.
message ResolveObjectRequest {
// Flag key of the requested flag.
string flag_key = 1;
// Object structure describing the EvaluationContext used in the flag evaluation, see https://openfeature.dev/docs/reference/concepts/evaluation-context
google.protobuf.Struct context = 2;
}
// Response body for object flag evaluation. used by the ResolveObject rpc.
message ResolveObjectResponse {
// The response value of the object flag evaluation, will be unset in the case of error.
//
// NOTE: This structure will need to be decoded from google/protobuf/struct.proto before it is returned to the SDK
google.protobuf.Struct value = 1;
// The reason for the given return value, see https://openfeature.dev/docs/specification/types#resolution-details
string reason = 2;
// The variant name of the returned flag value.
string variant = 3;
// Metadata for this evaluation
google.protobuf.Struct metadata = 4;
}
// Response body for the EventStream stream response
message EventStreamResponse {
// String key indicating the type of event that is being received, for example, provider_ready or configuration_change
string type = 1;
// Object structure for use when sending relevant metadata to provide context to the event.
// Can be left unset when it is not required.
google.protobuf.Struct data = 2;
}
// Empty stream request body
message EventStreamRequest {}
// Service defines the exposed rpcs of flagd
service Service {
rpc ResolveAll(ResolveAllRequest) returns (ResolveAllResponse) {}
rpc ResolveBoolean(ResolveBooleanRequest) returns (ResolveBooleanResponse) {}
rpc ResolveString(ResolveStringRequest) returns (ResolveStringResponse) {}
rpc ResolveFloat(ResolveFloatRequest) returns (ResolveFloatResponse) {}
rpc ResolveInt(ResolveIntRequest) returns (ResolveIntResponse) {}
rpc ResolveObject(ResolveObjectRequest) returns (ResolveObjectResponse) {}
rpc EventStream(EventStreamRequest) returns (stream EventStreamResponse) {}
}