bridge

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bridge defines local interfaces for optional forgery extension integration. Herald defines its own slim interfaces (following the authsome bridge pattern) to avoid hard coupling to external packages. Bridge adapters in separate packages translate between these local types and the actual extension APIs.

Index

Constants

View Source
const (
	SeverityInfo     = "info"
	SeverityWarning  = "warning"
	SeverityCritical = "critical"
)

Severity constants.

View Source
const (
	OutcomeSuccess = "success"
	OutcomeFailure = "failure"
)

Outcome constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditEvent

type AuditEvent struct {
	Action     string            `json:"action"`
	Resource   string            `json:"resource"`
	ResourceID string            `json:"resource_id,omitempty"`
	ActorID    string            `json:"actor_id,omitempty"`
	Tenant     string            `json:"tenant,omitempty"`
	Outcome    string            `json:"outcome"`
	Severity   string            `json:"severity"`
	Category   string            `json:"category"`
	Metadata   map[string]string `json:"metadata,omitempty"`
	Reason     string            `json:"reason,omitempty"`
}

AuditEvent is a local representation of an audit event.

type Chronicle

type Chronicle interface {
	Record(ctx context.Context, event *AuditEvent) error
}

Chronicle is a local audit interface. Implementations record notification events to an audit trail backend (e.g., chronicle).

type ChronicleFunc

type ChronicleFunc func(ctx context.Context, event *AuditEvent) error

ChronicleFunc is an adapter to use a plain function as a Chronicle.

func (ChronicleFunc) Record

func (f ChronicleFunc) Record(ctx context.Context, event *AuditEvent) error

Record implements Chronicle.

type SlogChronicle

type SlogChronicle struct {
	Logger *slog.Logger
}

SlogChronicle is a standalone Chronicle stub that logs audit events to slog.

func NewSlogChronicle

func NewSlogChronicle(logger *slog.Logger) *SlogChronicle

NewSlogChronicle creates a Chronicle that logs to the given logger.

func (*SlogChronicle) Record

func (c *SlogChronicle) Record(_ context.Context, event *AuditEvent) error

Record implements Chronicle by logging the event.

Directories

Path Synopsis
Package chronicleadapter bridges Herald audit events to the Chronicle extension.
Package chronicleadapter bridges Herald audit events to the Chronicle extension.

Jump to

Keyboard shortcuts

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