/
flipt.proto
535 lines (470 loc) · 12.3 KB
/
flipt.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
syntax = "proto3";
package flipt;
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
option go_package = "go.flipt.io/flipt/rpc/flipt";
message EvaluationRequest {
string request_id = 1;
string flag_key = 2;
string entity_id = 3;
map<string, string> context = 4;
string namespace_key = 5;
}
message BatchEvaluationRequest {
string request_id = 1;
repeated EvaluationRequest requests = 2;
bool exclude_not_found = 3;
string namespace_key = 4;
}
message BatchEvaluationResponse {
string request_id = 1;
repeated EvaluationResponse responses = 2;
double request_duration_millis = 3;
}
message EvaluationResponse {
string request_id = 1;
string entity_id = 2;
map<string, string> request_context = 3;
bool match = 4;
string flag_key = 5;
string segment_key = 6 [deprecated = true];
google.protobuf.Timestamp timestamp = 7;
string value = 8;
double request_duration_millis = 9;
string attachment = 10;
EvaluationReason reason = 11;
string namespace_key = 12;
repeated string segment_keys = 13;
}
enum EvaluationReason {
UNKNOWN_EVALUATION_REASON = 0;
FLAG_DISABLED_EVALUATION_REASON = 1;
FLAG_NOT_FOUND_EVALUATION_REASON = 2;
MATCH_EVALUATION_REASON = 3;
ERROR_EVALUATION_REASON = 4;
}
message Namespace {
string key = 1;
string name = 2;
string description = 3;
bool protected = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
message NamespaceList {
repeated Namespace namespaces = 1;
string next_page_token = 2;
int32 total_count = 3;
}
message GetNamespaceRequest {
string key = 1;
string reference = 2;
}
message ListNamespaceRequest {
int32 limit = 1;
int32 offset = 2 [deprecated = true];
string page_token = 3;
string reference = 4;
}
message CreateNamespaceRequest {
string key = 1;
string name = 2;
string description = 3;
}
message UpdateNamespaceRequest {
string key = 1;
string name = 2;
string description = 3;
}
message DeleteNamespaceRequest {
string key = 1;
}
enum FlagType {
VARIANT_FLAG_TYPE = 0;
BOOLEAN_FLAG_TYPE = 1;
}
message Flag {
string key = 1;
string name = 2;
string description = 3;
bool enabled = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
repeated Variant variants = 7;
string namespace_key = 8;
FlagType type = 9;
}
message FlagList {
repeated Flag flags = 1;
string next_page_token = 2;
int32 total_count = 3;
}
message GetFlagRequest {
string key = 1;
string namespace_key = 2;
string reference = 3;
}
message ListFlagRequest {
int32 limit = 1;
int32 offset = 2 [deprecated = true];
string page_token = 3;
string namespace_key = 4;
string reference = 5;
}
message CreateFlagRequest {
string key = 1;
string name = 2;
string description = 3;
bool enabled = 4;
string namespace_key = 5;
FlagType type = 6;
}
message UpdateFlagRequest {
string key = 1;
string name = 2;
string description = 3;
bool enabled = 4;
string namespace_key = 5;
}
message DeleteFlagRequest {
string key = 1;
string namespace_key = 2;
}
message Variant {
string id = 1;
string flag_key = 2;
string key = 3;
string name = 4;
string description = 5;
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
string attachment = 8;
string namespace_key = 9;
}
message CreateVariantRequest {
string flag_key = 1;
string key = 2;
string name = 3;
string description = 4;
string attachment = 5;
string namespace_key = 6;
}
message UpdateVariantRequest {
string id = 1;
string flag_key = 2;
string key = 3;
string name = 4;
string description = 5;
string attachment = 6;
string namespace_key = 7;
}
message DeleteVariantRequest {
string id = 1;
string flag_key = 2;
string namespace_key = 3;
}
enum MatchType {
ALL_MATCH_TYPE = 0;
ANY_MATCH_TYPE = 1;
}
message Segment {
string key = 1;
string name = 2;
string description = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5;
repeated Constraint constraints = 6;
MatchType match_type = 7;
string namespace_key = 8;
}
message SegmentList {
repeated Segment segments = 1;
string next_page_token = 2;
int32 total_count = 3;
}
message GetSegmentRequest {
string key = 1;
string namespace_key = 2;
string reference = 3;
}
message ListSegmentRequest {
int32 limit = 1;
int32 offset = 2 [deprecated = true];
string page_token = 3;
string namespace_key = 4;
string reference = 5;
}
message CreateSegmentRequest {
string key = 1;
string name = 2;
string description = 3;
MatchType match_type = 4;
string namespace_key = 5;
}
message UpdateSegmentRequest {
string key = 1;
string name = 2;
string description = 3;
MatchType match_type = 4;
string namespace_key = 5;
}
message DeleteSegmentRequest {
string key = 1;
string namespace_key = 2;
}
enum ComparisonType {
UNKNOWN_COMPARISON_TYPE = 0;
STRING_COMPARISON_TYPE = 1;
NUMBER_COMPARISON_TYPE = 2;
BOOLEAN_COMPARISON_TYPE = 3;
DATETIME_COMPARISON_TYPE = 4;
ENTITY_ID_COMPARISON_TYPE = 5;
}
message Constraint {
string id = 1;
string segment_key = 2;
ComparisonType type = 3;
string property = 4;
string operator = 5;
string value = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
string namespace_key = 9;
string description = 10;
}
message CreateConstraintRequest {
string segment_key = 1;
ComparisonType type = 2;
string property = 3;
string operator = 4;
string value = 5;
string namespace_key = 6;
string description = 7;
}
message UpdateConstraintRequest {
string id = 1;
string segment_key = 2;
ComparisonType type = 3;
string property = 4;
string operator = 5;
string value = 6;
string namespace_key = 7;
string description = 8;
}
message DeleteConstraintRequest {
string id = 1;
string segment_key = 2;
string namespace_key = 3;
}
enum RolloutType {
UNKNOWN_ROLLOUT_TYPE = 0;
SEGMENT_ROLLOUT_TYPE = 1;
THRESHOLD_ROLLOUT_TYPE = 2;
}
enum SegmentOperator {
OR_SEGMENT_OPERATOR = 0;
AND_SEGMENT_OPERATOR = 1;
}
message Rollout {
string id = 1;
string namespace_key = 2;
string flag_key = 3;
RolloutType type = 4;
int32 rank = 5;
string description = 6;
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
oneof rule {
RolloutSegment segment = 20;
RolloutThreshold threshold = 21;
}
}
message RolloutSegment {
string segment_key = 1 [deprecated = true];
bool value = 2;
repeated string segment_keys = 3;
SegmentOperator segment_operator = 4;
}
message RolloutThreshold {
float percentage = 1;
bool value = 2;
}
message RolloutList {
repeated Rollout rules = 1;
string next_page_token = 2;
int32 total_count = 3;
}
message ListRolloutRequest {
string namespace_key = 1;
string flag_key = 2;
int32 limit = 3;
string page_token = 4;
string reference = 5;
}
message GetRolloutRequest {
string id = 1;
string namespace_key = 2;
string flag_key = 3;
string reference = 4;
}
message CreateRolloutRequest {
string namespace_key = 1;
string flag_key = 2;
int32 rank = 3;
string description = 4;
oneof rule {
RolloutSegment segment = 20;
RolloutThreshold threshold = 21;
}
}
message UpdateRolloutRequest {
string id = 1;
string namespace_key = 2;
string flag_key = 3;
string description = 4;
oneof rule {
RolloutSegment segment = 20;
RolloutThreshold threshold = 21;
}
}
message DeleteRolloutRequest {
string id = 1;
string namespace_key = 2;
string flag_key = 3;
}
message OrderRolloutsRequest {
string flag_key = 1;
string namespace_key = 2;
repeated string rollout_ids = 3;
}
message Rule {
string id = 1;
string flag_key = 2;
string segment_key = 3;
repeated Distribution distributions = 4;
int32 rank = 5;
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
string namespace_key = 8;
repeated string segment_keys = 9;
SegmentOperator segment_operator = 10;
}
message RuleList {
repeated Rule rules = 1;
string next_page_token = 2;
int32 total_count = 3;
}
message ListRuleRequest {
int32 limit = 1;
int32 offset = 2 [deprecated = true];
string flag_key = 3;
string page_token = 4;
string namespace_key = 5;
string reference = 6;
}
message GetRuleRequest {
string id = 1;
string flag_key = 2;
string namespace_key = 3;
string reference = 4;
}
message CreateRuleRequest {
string flag_key = 1;
string segment_key = 2 [deprecated = true];
int32 rank = 3;
string namespace_key = 4;
repeated string segment_keys = 5;
SegmentOperator segment_operator = 6;
}
message UpdateRuleRequest {
string id = 1;
string flag_key = 2;
string segment_key = 3 [deprecated = true];
string namespace_key = 4;
repeated string segment_keys = 5;
SegmentOperator segment_operator = 6;
}
message DeleteRuleRequest {
string id = 1;
string flag_key = 2;
string namespace_key = 3;
}
message OrderRulesRequest {
string flag_key = 1;
repeated string rule_ids = 2;
string namespace_key = 3;
}
message Distribution {
string id = 1;
string rule_id = 2;
string variant_id = 3;
float rollout = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}
message CreateDistributionRequest {
string flag_key = 1;
string rule_id = 2;
string variant_id = 3;
float rollout = 4;
string namespace_key = 5;
}
message UpdateDistributionRequest {
string id = 1;
string flag_key = 2;
string rule_id = 3;
string variant_id = 4;
float rollout = 5;
string namespace_key = 6;
}
message DeleteDistributionRequest {
string id = 1;
string flag_key = 2;
string rule_id = 3;
string variant_id = 4;
string namespace_key = 5;
}
service Flipt {
rpc Evaluate(EvaluationRequest) returns (EvaluationResponse) {
option deprecated = true;
}
rpc BatchEvaluate(BatchEvaluationRequest) returns (BatchEvaluationResponse) {
option deprecated = true;
}
rpc GetNamespace(GetNamespaceRequest) returns (Namespace) { }
rpc ListNamespaces(ListNamespaceRequest) returns (NamespaceList) {}
rpc CreateNamespace(CreateNamespaceRequest) returns (Namespace) {}
rpc UpdateNamespace(UpdateNamespaceRequest) returns (Namespace) {}
rpc DeleteNamespace(DeleteNamespaceRequest) returns (google.protobuf.Empty) {}
rpc GetFlag(GetFlagRequest) returns (Flag) {}
rpc ListFlags(ListFlagRequest) returns (FlagList) {}
rpc CreateFlag(CreateFlagRequest) returns (Flag) {}
rpc UpdateFlag(UpdateFlagRequest) returns (Flag) {}
rpc DeleteFlag(DeleteFlagRequest) returns (google.protobuf.Empty) {}
rpc CreateVariant(CreateVariantRequest) returns (Variant) {}
rpc UpdateVariant(UpdateVariantRequest) returns (Variant) {}
rpc DeleteVariant(DeleteVariantRequest) returns (google.protobuf.Empty) {}
rpc GetRule(GetRuleRequest) returns (Rule) {}
rpc ListRules(ListRuleRequest) returns (RuleList) {}
rpc CreateRule(CreateRuleRequest) returns (Rule) {}
rpc UpdateRule(UpdateRuleRequest) returns (Rule) {}
rpc OrderRules(OrderRulesRequest) returns (google.protobuf.Empty) {}
rpc DeleteRule(DeleteRuleRequest) returns (google.protobuf.Empty) {}
rpc GetRollout(GetRolloutRequest) returns (Rollout) {}
rpc ListRollouts(ListRolloutRequest) returns (RolloutList) {}
rpc CreateRollout(CreateRolloutRequest) returns (Rollout) {}
rpc UpdateRollout(UpdateRolloutRequest) returns (Rollout) {}
rpc DeleteRollout(DeleteRolloutRequest) returns (google.protobuf.Empty) {}
rpc OrderRollouts(OrderRolloutsRequest) returns (google.protobuf.Empty) {}
rpc CreateDistribution(CreateDistributionRequest) returns (Distribution) {}
rpc UpdateDistribution(UpdateDistributionRequest) returns (Distribution) {}
rpc DeleteDistribution(DeleteDistributionRequest) returns (google.protobuf.Empty) {}
rpc GetSegment(GetSegmentRequest) returns (Segment) {}
rpc ListSegments(ListSegmentRequest) returns (SegmentList) {}
rpc CreateSegment(CreateSegmentRequest) returns (Segment) {}
rpc UpdateSegment(UpdateSegmentRequest) returns (Segment) {}
rpc DeleteSegment(DeleteSegmentRequest) returns (google.protobuf.Empty) {}
rpc CreateConstraint(CreateConstraintRequest) returns (Constraint) {}
rpc UpdateConstraint(UpdateConstraintRequest) returns (Constraint) {}
rpc DeleteConstraint(DeleteConstraintRequest) returns (google.protobuf.Empty) {}
}