Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 1 | syntax = "proto2"; |
| 2 | |
| 3 | // The types of message notification sent from Moblab. |
| 4 | enum MessageType { |
Michael Tang | e8bc959 | 2017-07-06 10:59:32 -0700 | [diff] [blame] | 5 | MSG_UNKNOWN = 0; |
| 6 | MSG_MOBLAB_HEARTBEAT = 1; |
| 7 | MSG_MOBLAB_REMOTE_EVENT = 2; |
| 8 | MSG_MOBLAB_ALERT = 3; |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 9 | } |
| 10 | |
Michael Tang | e8bc959 | 2017-07-06 10:59:32 -0700 | [diff] [blame] | 11 | // The common pubsub notification attribute names. |
| 12 | enum MessageAttribute { |
| 13 | ATTR_INVALID = 0; |
| 14 | ATTR_MESSAGE_TYPE = 1; |
| 15 | ATTR_MESSAGE_VERSION = 2; |
| 16 | ATTR_MOBLAB_MAC_ADDRESS = 3; |
| 17 | ATTR_MOBLAB_ID = 4; |
| 18 | } |
| 19 | |
| 20 | // Timestamp is not defined in proto2. We need to define it by ourselves. |
| 21 | // It represents a point in time independent of any time zone |
| 22 | // or calendar, represented as seconds and fractions of seconds at |
| 23 | // nanosecond resolution. |
| 24 | // Clone from https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto. |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 25 | message Timestamp { |
Michael Tang | e8bc959 | 2017-07-06 10:59:32 -0700 | [diff] [blame] | 26 | optional int64 seconds = 1; |
| 27 | // Non-negative fractions of a second at nanosecond resolution. |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 28 | optional int64 nanos = 2 [default = 0]; |
| 29 | } |
| 30 | |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 31 | message Heartbeat { |
| 32 | optional Timestamp timestamp = 1; |
| 33 | } |
| 34 | |
| 35 | // The remote event notification message. |
| 36 | message RemoteEventMessage { |
| 37 | // EventType is an enumeration of event types sent to cloud console. |
| 38 | // Any new event type should be added here. |
Michael Tang | e8bc959 | 2017-07-06 10:59:32 -0700 | [diff] [blame] | 39 | enum Type { |
| 40 | EVENT_UNKNOWN = 0; |
| 41 | EVENT_MOBLAB_BOOT_COMPLETE = 1; |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 42 | } |
| 43 | |
Michael Tang | e8bc959 | 2017-07-06 10:59:32 -0700 | [diff] [blame] | 44 | optional Type type = 1 [default = EVENT_UNKNOWN]; |
| 45 | optional string data = 2; |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | // Moblab alerts |
| 49 | message Alert { |
| 50 | enum AlertLevel { |
Michael Tang | e8bc959 | 2017-07-06 10:59:32 -0700 | [diff] [blame] | 51 | ALERT_UNSPECIFIED = 0; |
| 52 | ALERT_CRITICAL = 1; |
| 53 | ALERT_MAJOR = 2; |
| 54 | ALERT_MINOR = 3; |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 55 | } |
Michael Tang | e8bc959 | 2017-07-06 10:59:32 -0700 | [diff] [blame] | 56 | optional AlertLevel level = 1; |
Michael Tang | 0f553bd | 2017-06-16 17:38:45 -0700 | [diff] [blame] | 57 | optional string data = 2; |
| 58 | optional Timestamp timestamp = 3; |
| 59 | optional string source_application = 4; |
| 60 | optional string source_component = 5; |
| 61 | } |