diff --git a/events.proto b/events.proto index 0edb9e4..4a62ca1 100644 --- a/events.proto +++ b/events.proto @@ -17,14 +17,14 @@ service events { message Event { string ID = 1; // Event identifier google.protobuf.Timestamp Timestamp = 2; // When the event occurred - enum EventType { + enum EventSeverity { Normal = 0; // Default type is normal Warning = 1; // The event was a warning Error = 2; // The event was an error } - EventType Type = 3; // What type of event it is (e.g., Warning, Normal) - string Reason = 4; // The reason for the event (e.g., BackupSucceeded, ShellProvisioned) - string Message = 5; // Message contains the specific information about the event + EventSeverity Severity = 3; // What type of event it is (e.g., Warning, Normal) + string Type = 4; // The reason for the event (e.g., BackupSucceeded, ShellProvisioned) + string Message = 5; // Message contains the specific information about the event } /** diff --git a/internal/server/mock/events/server.go b/internal/server/mock/events/server.go index c74d372..2f1aa4c 100644 --- a/internal/server/mock/events/server.go +++ b/internal/server/mock/events/server.go @@ -19,22 +19,22 @@ var mockEvents = []*pb.Event{ { Timestamp: timestamppb.New(time.Date(2025, 3, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute)), ID: "ABCDXXXX", - Type: pb.Event_Normal, - Reason: "ConfigSet", + Severity: pb.Event_Normal, + Type: "ConfigSet", Message: "A config was set: api.key", }, { Timestamp: timestamppb.New(time.Date(2025, 2, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute)), ID: "ABCDYYYY", - Type: pb.Event_Warning, - Reason: "ErrorRate", + Severity: pb.Event_Warning, + Type: "ErrorRate", Message: "Elevated error rate has been detected", }, { Timestamp: timestamppb.New(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute)), ID: "ABCDZZZZ", - Type: pb.Event_Error, - Reason: "BackupFailed", + Severity: pb.Event_Error, + Type: "BackupFailed", Message: "The following backup failed with the ID: xxxxxxxxxxxxxxxxx", }, } diff --git a/pb/events.pb.go b/pb/events.pb.go index a9e8958..6ccb423 100644 --- a/pb/events.pb.go +++ b/pb/events.pb.go @@ -23,52 +23,52 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type Event_EventType int32 +type Event_EventSeverity int32 const ( - Event_Normal Event_EventType = 0 // Default type is normal - Event_Warning Event_EventType = 1 // The event was a warning - Event_Error Event_EventType = 2 // The event was an error + Event_Normal Event_EventSeverity = 0 // Default type is normal + Event_Warning Event_EventSeverity = 1 // The event was a warning + Event_Error Event_EventSeverity = 2 // The event was an error ) -// Enum value maps for Event_EventType. +// Enum value maps for Event_EventSeverity. var ( - Event_EventType_name = map[int32]string{ + Event_EventSeverity_name = map[int32]string{ 0: "Normal", 1: "Warning", 2: "Error", } - Event_EventType_value = map[string]int32{ + Event_EventSeverity_value = map[string]int32{ "Normal": 0, "Warning": 1, "Error": 2, } ) -func (x Event_EventType) Enum() *Event_EventType { - p := new(Event_EventType) +func (x Event_EventSeverity) Enum() *Event_EventSeverity { + p := new(Event_EventSeverity) *p = x return p } -func (x Event_EventType) String() string { +func (x Event_EventSeverity) String() string { return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) } -func (Event_EventType) Descriptor() protoreflect.EnumDescriptor { +func (Event_EventSeverity) Descriptor() protoreflect.EnumDescriptor { return file_events_proto_enumTypes[0].Descriptor() } -func (Event_EventType) Type() protoreflect.EnumType { +func (Event_EventSeverity) Type() protoreflect.EnumType { return &file_events_proto_enumTypes[0] } -func (x Event_EventType) Number() protoreflect.EnumNumber { +func (x Event_EventSeverity) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use Event_EventType.Descriptor instead. -func (Event_EventType) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use Event_EventSeverity.Descriptor instead. +func (Event_EventSeverity) EnumDescriptor() ([]byte, []int) { return file_events_proto_rawDescGZIP(), []int{0, 0} } @@ -79,11 +79,11 @@ type Event struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` // Event identifier - Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` // When the event occurred - Type Event_EventType `protobuf:"varint,3,opt,name=Type,proto3,enum=workflow.Event_EventType" json:"Type,omitempty"` // What type of event it is (e.g., Warning, Normal) - Reason string `protobuf:"bytes,4,opt,name=Reason,proto3" json:"Reason,omitempty"` // The reason for the event (e.g., BackupSucceeded, ShellProvisioned) - Message string `protobuf:"bytes,5,opt,name=Message,proto3" json:"Message,omitempty"` // Message contains the specific information about the event + ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` // Event identifier + Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` // When the event occurred + Severity Event_EventSeverity `protobuf:"varint,3,opt,name=Severity,proto3,enum=workflow.Event_EventSeverity" json:"Severity,omitempty"` // What type of event it is (e.g., Warning, Normal) + Type string `protobuf:"bytes,4,opt,name=Type,proto3" json:"Type,omitempty"` // The reason for the event (e.g., BackupSucceeded, ShellProvisioned) + Message string `protobuf:"bytes,5,opt,name=Message,proto3" json:"Message,omitempty"` // Message contains the specific information about the event } func (x *Event) Reset() { @@ -132,16 +132,16 @@ func (x *Event) GetTimestamp() *timestamppb.Timestamp { return nil } -func (x *Event) GetType() Event_EventType { +func (x *Event) GetSeverity() Event_EventSeverity { if x != nil { - return x.Type + return x.Severity } return Event_Normal } -func (x *Event) GetReason() string { +func (x *Event) GetType() string { if x != nil { - return x.Reason + return x.Type } return "" } @@ -257,35 +257,35 @@ var file_events_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 0x01, 0x0a, 0x05, 0x45, 0x76, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xef, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x38, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2d, 0x0a, - 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2f, - 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4e, - 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, - 0x6e, 0x67, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, 0x22, - 0x35, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, - 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x3d, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x06, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x77, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x4d, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, - 0x43, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, - 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x70, 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x39, 0x0a, + 0x08, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x1d, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x52, 0x08, + 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x33, 0x0a, 0x0d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, + 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61, + 0x6c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x01, + 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x11, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, + 0x6e, 0x74, 0x22, 0x3d, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x06, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x32, 0x4d, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x43, 0x0a, 0x04, 0x4c, + 0x69, 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1c, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -303,7 +303,7 @@ func file_events_proto_rawDescGZIP() []byte { var file_events_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_events_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_events_proto_goTypes = []interface{}{ - (Event_EventType)(0), // 0: workflow.Event.EventType + (Event_EventSeverity)(0), // 0: workflow.Event.EventSeverity (*Event)(nil), // 1: workflow.Event (*EventsListRequest)(nil), // 2: workflow.EventsListRequest (*EventsListResponse)(nil), // 3: workflow.EventsListResponse @@ -311,7 +311,7 @@ var file_events_proto_goTypes = []interface{}{ } var file_events_proto_depIdxs = []int32{ 4, // 0: workflow.Event.Timestamp:type_name -> google.protobuf.Timestamp - 0, // 1: workflow.Event.Type:type_name -> workflow.Event.EventType + 0, // 1: workflow.Event.Severity:type_name -> workflow.Event.EventSeverity 1, // 2: workflow.EventsListResponse.Events:type_name -> workflow.Event 2, // 3: workflow.events.List:input_type -> workflow.EventsListRequest 3, // 4: workflow.events.List:output_type -> workflow.EventsListResponse