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 75ed24e commit a39fa50
Show file tree
Hide file tree
Showing 13 changed files with 1,709 additions and 1,005 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 @@ -6777,6 +6777,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 @@ -6808,6 +6815,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 @@ -6839,6 +6853,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 @@ -6870,6 +6891,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 @@ -6901,6 +6929,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 @@ -6932,6 +6967,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) = ""
];
}

// CrownJewelCreate is emitted when a Access Graph CrownJewel is created.
Expand Down
25 changes: 25 additions & 0 deletions api/types/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2255,3 +2255,28 @@ func (m *CrownJewelUpdate) TrimToMaxSize(_ int) AuditEvent {
func (m *CrownJewelDelete) TrimToMaxSize(_ int) AuditEvent {
return m
}


Check failure on line 2259 in api/types/events/events.go

View workflow job for this annotation

GitHub Actions / Lint (Go)

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/gravitational/teleport) --custom-order (gci)

Check failure on line 2259 in api/types/events/events.go

View workflow job for this annotation

GitHub Actions / Lint (Go)

File is not `goimports`-ed (goimports)
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,250 changes: 1,266 additions & 984 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 @@ -727,6 +727,31 @@ func ToOneOf(in AuditEvent) (*OneOf, error) {
out.Event = &OneOf_CrownJewelDelete{
CrownJewelDelete: 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:
log.Errorf("Attempted to convert dynamic event of unknown type \"%v\" into protobuf event.", in.GetType())
unknown := &Unknown{}
Expand Down
Loading

0 comments on commit a39fa50

Please sign in to comment.