Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ syntax = "proto3";

package workflow;

import "google/protobuf/timestamp.proto";

option go_package = "./pb";

service events {
Expand All @@ -13,11 +15,16 @@ service events {
* Details that are captured as an event.
*/
message Event {
string ID = 1; // Event identifier
string Date = 2; // When the event occurred
string Type = 3; // What type of event occurred
string Source = 4; // The source of the event
string Details = 5; // Details related to the event
string ID = 1; // Event identifier
google.protobuf.Timestamp Timestamp = 2; // When the event occurred
enum EventType {
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
}

/**
Expand Down
34 changes: 18 additions & 16 deletions internal/server/mock/events/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"time"

"google.golang.org/protobuf/types/known/timestamppb"

"github.com/skpr/api/pb"
)

Expand All @@ -15,25 +17,25 @@ type Server struct {

var mockEvents = []*pb.Event{
{
Date: time.Date(2025, 3, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute).Format(time.RFC3339),
ID: "ABCD1234",
Type: "ShellEvent",
Source: "skpr-project-1",
Details: "Shell event triggered",
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",
Message: "A config was set: api.key",
},
{
Date: time.Date(2025, 2, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute).Format(time.RFC3339),
ID: "ABCD1234",
Type: "ShellEvent",
Source: "skpr-project-1",
Details: "Shell event triggered",
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",
Message: "Elevated error rate has been detected",
},
{
Date: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute).Format(time.RFC3339),
ID: "ABCD1234",
Type: "ShellEvent",
Source: "skpr-project-1",
Details: "Shell event triggered",
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",
Message: "The following backup failed with the ID: xxxxxxxxxxxxxxxxx",
},
}

Expand All @@ -42,7 +44,7 @@ func (s *Server) List(ctx context.Context, req *pb.EventsListRequest) (*pb.Event
if req.Environment == "" {
return nil, fmt.Errorf("environment not provided")
}

resp := &pb.EventsListResponse{
Events: mockEvents,
}
Expand Down
160 changes: 113 additions & 47 deletions pb/events.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.