blob: 128371be121f3741c2d39df2edb8930f7a631319 [file] [log] [blame]
avm9996383f8f292021-08-24 18:26:52 +02001syntax = "proto3";
2
3import "api_proto/common.proto";
4import "google/protobuf/timestamp.proto";
5
6option go_package = "gomodules.avm99963.com/twpt-server/api_proto";
7
8message Feature {
9 int32 id = 1;
10 string codename = 2;
11 enum Type {
12 TYPE_UNKNOWN = 0;
13 TYPE_EXPERIMENT = 1;
14 TYPE_OPTION = 2;
Adrià Vilanova Martínezdc5d29f2023-04-15 17:22:13 +020015 TYPE_INTERNAL_KILL_SWITCH = 3;
avm9996383f8f292021-08-24 18:26:52 +020016 TYPE_DEPRECATED = 10;
17 }
18 Type type = 3;
19}
20
21message KillSwitch {
22 int32 id = 1;
23 Feature feature = 2;
24 string min_version = 3;
25 string max_version = 4;
26 repeated Environment.Browser browsers = 5;
27 bool active = 6;
28}
29
30message KillSwitchAuthorizedUser {
31 int32 id = 1;
32 string google_uid = 2;
33 string email = 3;
34 enum AccessLevel {
35 ACCESS_LEVEL_NONE = 0;
Adrià Vilanova Martínezc147b6a2021-09-01 17:25:38 +020036 ACCESS_LEVEL_ACTIVATOR = 5; // The user may enable/disable kill switches.
37 ACCESS_LEVEL_ADMIN = 10; // The user may perform any action.
avm9996383f8f292021-08-24 18:26:52 +020038 }
39 AccessLevel access_level = 4;
40}
41
42message KillSwitchTransformation {
Adrià Vilanova Martínez25e12112021-08-25 13:48:06 +020043 KillSwitch old = 1;
44 KillSwitch new = 2;
45}
46
47message AuthorizedUserTransformation {
48 KillSwitchAuthorizedUser old = 1;
49 KillSwitchAuthorizedUser new = 2;
avm9996383f8f292021-08-24 18:26:52 +020050}
51
52// Log entry which describes an action which has taken place.
53message KillSwitchAuditLogEntry {
54 // Timestamp in which the action was taken.
55 google.protobuf.Timestamp timestamp = 1;
56
57 // User who/which performed the action.
58 KillSwitchAuthorizedUser user = 2;
59
60 message KillSwitchEnabled {
Adrià Vilanova Martínez25e12112021-08-25 13:48:06 +020061 KillSwitch kill_switch = 1;
avm9996383f8f292021-08-24 18:26:52 +020062 }
63
64 message KillSwitchDisabled {
65 KillSwitchTransformation transformation = 1;
66 }
67
Adrià Vilanova Martínez25e12112021-08-25 13:48:06 +020068 message AuthorizedUserAdded {
69 KillSwitchAuthorizedUser user = 1;
70 }
71
72 message AuthorizedUserUpdated {
73 AuthorizedUserTransformation transformation = 1;
74 }
75
76 message AuthorizedUserDeleted {
77 KillSwitchAuthorizedUser old_user = 1;
78 }
79
avm9996383f8f292021-08-24 18:26:52 +020080 // Description of the action taken
81 oneof description {
82 KillSwitchEnabled kill_switch_enabled = 3;
83 KillSwitchDisabled kill_switch_disabled = 4;
Adrià Vilanova Martínez25e12112021-08-25 13:48:06 +020084 AuthorizedUserAdded authorized_user_added = 5;
85 AuthorizedUserUpdated authorized_user_updated = 6;
86 AuthorizedUserDeleted authorized_user_deleted = 7;
avm9996383f8f292021-08-24 18:26:52 +020087 }
88}