Documentation ¶
Index ¶
Constants ¶
View Source
const AuditEventType = "AUDIT_EVENT"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActorType ¶
type ActorType string
ActorType is the type for the actor of a log entry, meaning the user or service that performed the action.
type AuditEventPayload ¶
type AuditLogPublisher ¶
type AuditLogPublisher struct {
// contains filtered or unexported fields
}
func NewAuditLogPublisher ¶
func NewAuditLogPublisher(conn *nats.Conn, logger log.Logger) (*AuditLogPublisher, error)
func (*AuditLogPublisher) Publish ¶
func (n *AuditLogPublisher) Publish(data *EventPayload) error
type DescriptionVariables ¶
type EventPayload ¶
type EventPayload struct { EventType string // AUDIT_EVENT Timestamp time.Time Data *AuditEventPayload }
func GenerateAuditEvent ¶
func GenerateAuditEvent(entry LogEntry, opts ...GeneratorOption) (*EventPayload, error)
func (*EventPayload) ToJSON ¶
func (e *EventPayload) ToJSON() ([]byte, error)
type GeneratorOption ¶
type GeneratorOption func(*GeneratorOptions) error
func WithActor ¶
func WithActor(actorType ActorType, actorID uuid.UUID, email string) GeneratorOption
func WithOrgID ¶
func WithOrgID(orgID uuid.UUID) GeneratorOption
type GeneratorOptions ¶
type LogEntry ¶
type LogEntry interface { // ActionType returns the type of the action performed. ActionType() string // ActionInfo returns the information about the action performed. ActionInfo() (json.RawMessage, error) // TargetType returns the type of the target of the action. TargetType() TargetType // TargetID returns the ID of the target of the action. TargetID() *uuid.UUID // Description returns a templatable string, see the DescriptionVariables struct. Description() string RequiresActor() bool }
LogEntry is the interface for all log entries. All events should implement this interface to be able to be logged.
type TargetType ¶
type TargetType string
TargetType is the type for the target of a log entry, aka the resource acted upon.
Click to show internal directories.
Click to hide internal directories.