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