Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultEnums provides default enum values if config file is not found // Generic default event types - customize via enums.yaml for your project DefaultEnums = AuditEnums{ EventTypes: []string{ "MANAGEMENT_EVENT", "USER_MANAGEMENT", "DATA_FETCH", }, EventActions: []string{ "CREATE", "READ", "UPDATE", "DELETE", }, ActorTypes: []string{ "SERVICE", "ADMIN", "MEMBER", "SYSTEM", }, TargetTypes: []string{ "SERVICE", "RESOURCE", }, } )
Functions ¶
func GetEnvOrDefault ¶
GetEnvOrDefault returns the environment variable value or a default This is a utility function for reading environment variables with defaults
Types ¶
type AuditEnums ¶
type AuditEnums struct {
EventTypes []string `yaml:"eventTypes"`
EventActions []string `yaml:"eventActions"`
ActorTypes []string `yaml:"actorTypes"`
TargetTypes []string `yaml:"targetTypes"`
// contains filtered or unexported fields
}
AuditEnums represents the enum configuration for audit service All enum values are configurable via YAML for maximum reusability
func GetDefaultEnums ¶
func GetDefaultEnums() *AuditEnums
GetDefaultEnums creates a new AuditEnums instance with default values Slices are copied to avoid sharing references with the global DefaultEnums
func LoadEnums ¶
func LoadEnums(configPath string) (*AuditEnums, error)
LoadEnums loads enum configuration from YAML file If the file is not found or cannot be read, returns default enums
func (*AuditEnums) InitializeMaps ¶
func (e *AuditEnums) InitializeMaps()
InitializeMaps converts slices to maps for O(1) validation lookups Uses sync.Once to ensure thread-safe initialization that happens only once This is called automatically by LoadEnums, but can be called manually for testing
func (*AuditEnums) IsValidActorType ¶
func (e *AuditEnums) IsValidActorType(actorType string) bool
IsValidActorType checks if the given actor type is valid
func (*AuditEnums) IsValidEventAction ¶
func (e *AuditEnums) IsValidEventAction(action string) bool
IsValidEventAction checks if the given event action is valid
func (*AuditEnums) IsValidEventType ¶
func (e *AuditEnums) IsValidEventType(eventType string) bool
IsValidEventType checks if the given event type is valid
func (*AuditEnums) IsValidTargetType ¶
func (e *AuditEnums) IsValidTargetType(targetType string) bool
IsValidTargetType checks if the given target type is valid
type Config ¶
type Config struct {
Enums AuditEnums `yaml:"enums"`
}
Config holds the audit service configuration