Skip to content

Commit

Permalink
Add audit logs for auto update resources (#48218)
Browse files Browse the repository at this point in the history
  • Loading branch information
vapopov committed Nov 8, 2024
1 parent 7e9688f commit 34a9b14
Show file tree
Hide file tree
Showing 12 changed files with 1,766 additions and 1,061 deletions.
42 changes: 42 additions & 0 deletions api/proto/teleport/legacy/types/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6921,6 +6921,13 @@ message AutoUpdateConfigCreate {
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the creation was successful.
Status Status = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateConfigUpdate is emitted when an auto update config is updated.
Expand Down Expand Up @@ -6952,6 +6959,13 @@ message AutoUpdateConfigUpdate {
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateConfigDelete is emitted when an auto update config is deleted.
Expand Down Expand Up @@ -6983,6 +6997,13 @@ message AutoUpdateConfigDelete {
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the deletion was successful.
Status Status = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateVersionCreate is emitted when an auto update version is created.
Expand Down Expand Up @@ -7014,6 +7035,13 @@ message AutoUpdateVersionCreate {
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the creation was successful.
Status Status = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateVersionUpdate is emitted when an auto update version is updated.
Expand Down Expand Up @@ -7045,6 +7073,13 @@ message AutoUpdateVersionUpdate {
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// ResourceMetadata is a common resource event metadata
ResourceMetadata Resource = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// AutoUpdateVersionDelete is emitted when an auto update version is deleted.
Expand Down Expand Up @@ -7076,6 +7111,13 @@ message AutoUpdateVersionDelete {
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];

// Status indicates whether the deletion was successful.
Status Status = 5 [
(gogoproto.nullable) = false,
(gogoproto.embed) = true,
(gogoproto.jsontag) = ""
];
}

// StaticHostUserCreate is emitted when a static host user is created.
Expand Down
24 changes: 24 additions & 0 deletions api/types/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2302,3 +2302,27 @@ func (m *UserTaskUpdate) TrimToMaxSize(_ int) AuditEvent {
func (m *UserTaskDelete) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *AutoUpdateConfigCreate) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *AutoUpdateConfigUpdate) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *AutoUpdateConfigDelete) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *AutoUpdateVersionCreate) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *AutoUpdateVersionUpdate) TrimToMaxSize(_ int) AuditEvent {
return m
}

func (m *AutoUpdateVersionDelete) TrimToMaxSize(_ int) AuditEvent {
return m
}
2,371 changes: 1,327 additions & 1,044 deletions api/types/events/events.pb.go

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions api/types/events/oneof.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,31 @@ func ToOneOf(in AuditEvent) (*OneOf, error) {
out.Event = &OneOf_UserTaskDelete{
UserTaskDelete: e,
}
case *AutoUpdateConfigCreate:
out.Event = &OneOf_AutoUpdateConfigCreate{
AutoUpdateConfigCreate: e,
}
case *AutoUpdateConfigUpdate:
out.Event = &OneOf_AutoUpdateConfigUpdate{
AutoUpdateConfigUpdate: e,
}
case *AutoUpdateConfigDelete:
out.Event = &OneOf_AutoUpdateConfigDelete{
AutoUpdateConfigDelete: e,
}

case *AutoUpdateVersionCreate:
out.Event = &OneOf_AutoUpdateVersionCreate{
AutoUpdateVersionCreate: e,
}
case *AutoUpdateVersionUpdate:
out.Event = &OneOf_AutoUpdateVersionUpdate{
AutoUpdateVersionUpdate: e,
}
case *AutoUpdateVersionDelete:
out.Event = &OneOf_AutoUpdateVersionDelete{
AutoUpdateVersionDelete: e,
}
default:
slog.ErrorContext(context.Background(), "Attempted to convert dynamic event of unknown type into protobuf event.", "event_type", in.GetType())
unknown := &Unknown{}
Expand Down
Loading

0 comments on commit 34a9b14

Please sign in to comment.