* feat (events): Add new options needed for AuditConfig WithAuditWrapper and WithFilterOperations all for optional paramters when creating AuditConfig types. * refactor (event): Change EventerConfig.Sinks to a ptr We need to modify the SinkConfig.AuditConfig during the NewEventer factory, so we have to use a ptr not a ref. * feat (events): Add audit configuration types * feat (events): add audit config to sink configuration. * feat (events): add redact/encrypt node for audit events to Eventer Integrate the encrypt.Filter node from the eventlogger into the event.Eventer, so audit events can be redacted/encrypted based on data classifications. * test (events) Add test protobufs for events Add test protobufs along with a test service for testing the audit event encrypt node
26 lines
976 B
Go
26 lines
976 B
Go
package event
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// EventerConfig supplies all the configuration needed to create/config an Eventer.
|
|
type EventerConfig struct {
|
|
AuditEnabled bool `hcl:"audit_enabled"` // AuditEnabled specifies if audit events should be emitted.
|
|
ObservationsEnabled bool `hcl:"observations_enabled"` // ObservationsEnabled specifies if observation events should be emitted.
|
|
SysEventsEnabled bool `hcl:"sysevents_enabled"` // SysEventsEnabled specifies if sysevents should be emitted.
|
|
Sinks []*SinkConfig `hcl:"-"` // Sinks are all the configured sinks
|
|
}
|
|
|
|
// Validate will Validate the config. A config isn't required to have any
|
|
// sinks to be valid.
|
|
func (c *EventerConfig) Validate() error {
|
|
const op = "event.(EventerConfig).Validate"
|
|
for i, s := range c.Sinks {
|
|
if err := s.Validate(); err != nil {
|
|
return fmt.Errorf("%s: sink %d is invalid: %w", op, i, err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|