audit

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultSuccess = "success"
	ResultFailed  = "failed"
)

Variables

This section is empty.

Functions

func Record

func Record(ctx context.Context, r Recorder, ev Event) error

func RecordAsync

func RecordAsync(ctx context.Context, r Recorder, ev Event, limit chan struct{}, timeout time.Duration)

Types

type Event

type Event struct {
	Name       string               `json:"name"`
	Actor      *principal.Principal `json:"actor,omitempty"`
	Action     string               `json:"action"`
	Resource   string               `json:"resource"`
	Result     string               `json:"result"`
	Message    string               `json:"message,omitempty"`
	RequestID  string               `json:"request_id,omitempty"`
	TraceID    string               `json:"trace_id,omitempty"`
	ClientIP   string               `json:"client_ip,omitempty"`
	UserAgent  string               `json:"user_agent,omitempty"`
	Method     string               `json:"method,omitempty"`
	URI        string               `json:"uri,omitempty"`
	Operation  string               `json:"operation,omitempty"`
	StatusCode int                  `json:"status_code,omitempty"`
	Component  string               `json:"component,omitempty"`
	OrgID      string               `json:"org_id,omitempty"`
	ProjectID  string               `json:"project_id,omitempty"`
	StartedAt  time.Time            `json:"started_at"`
	FinishedAt time.Time            `json:"finished_at"`
	Duration   time.Duration        `json:"duration"`
	Metadata   map[string]string    `json:"metadata,omitempty"`
}

func Merge

func Merge(base, override Event) Event

func Normalize

func Normalize(ctx context.Context, base Event, err error) Event

type Options

type Options struct {
	Component    string
	Resolver     Resolver
	Async        bool
	AsyncLimit   int
	AsyncTimeout time.Duration
}

type Recorder

type Recorder interface {
	Record(ctx context.Context, event Event) error
}

type Resolver

type Resolver func(ctx context.Context, req any, reply any, err error) Event

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL