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 7, 2024
1 parent e8dd714 commit 7abde91
Show file tree
Hide file tree
Showing 11 changed files with 1,780 additions and 1,075 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 @@ -6977,6 +6977,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 @@ -7008,6 +7015,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 @@ -7039,6 +7053,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 @@ -7070,6 +7091,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 @@ -7101,6 +7129,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 @@ -7132,6 +7167,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 @@ -2328,3 +2328,27 @@ func (m *SFTPSummary) TrimToMaxSize(maxSize int) AuditEvent {

return out
}

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,401 changes: 1,342 additions & 1,059 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 @@ -765,6 +765,31 @@ func ToOneOf(in AuditEvent) (*OneOf, error) {
out.Event = &OneOf_SFTPSummary{
SFTPSummary: 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 7abde91

Please sign in to comment.