auditcmd

package
v0.60.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditCleaner

type AuditCleaner interface {
	AuditLog
	Clear(ctx context.Context) error
}

AuditCleaner extends AuditLog with cleanup capabilities.

type AuditLog

type AuditLog interface {
	List(ctx context.Context) ([]jobs.AuditEvent, error)
}

AuditLog exposes read operations for recorded audit events.

type CleanupAuditCommand

type CleanupAuditCommand struct {
	DryRun bool `json:"dry_run,omitempty"`
}

CleanupAuditCommand removes recorded audit events. When DryRun is true only the event count is reported.

func (CleanupAuditCommand) Type

func (CleanupAuditCommand) Type() string

Type implements command.Message.

func (CleanupAuditCommand) Validate

func (CleanupAuditCommand) Validate() error

Validate satisfies command.Message.

type CleanupAuditHandler

type CleanupAuditHandler struct {
	// contains filtered or unexported fields
}

CleanupAuditHandler clears audit logs via the supplied cleaner implementation.

func NewCleanupAuditHandler

func NewCleanupAuditHandler(cleaner AuditCleaner, logger interfaces.Logger, opts ...CleanupHandlerOption) *CleanupAuditHandler

NewCleanupAuditHandler constructs a handler that delegates to the provided cleaner instance.

func (*CleanupAuditHandler) CLIHandler added in v0.3.0

func (h *CleanupAuditHandler) CLIHandler() any

CLIHandler exposes the cleanup handler to CLI integrations.

func (*CleanupAuditHandler) CLIOptions added in v0.3.0

func (h *CleanupAuditHandler) CLIOptions() command.CLIConfig

CLIOptions describes the CLI metadata for audit cleanup.

func (*CleanupAuditHandler) CronHandler

func (h *CleanupAuditHandler) CronHandler() func() error

CronHandler satisfies command.CronCommand by binding cleanup execution to a cron runner.

func (*CleanupAuditHandler) CronOptions

func (h *CleanupAuditHandler) CronOptions() command.HandlerConfig

CronOptions satisfies command.CronCommand by returning the configured cron metadata.

func (*CleanupAuditHandler) Execute

Execute satisfies command.Commander[CleanupAuditCommand].

type CleanupHandlerOption

type CleanupHandlerOption func(*cleanupHandlerConfig)

CleanupHandlerOption customises the cleanup handler.

func CleanupWithCronConfig

func CleanupWithCronConfig(config command.HandlerConfig) CleanupHandlerOption

CleanupWithCronConfig overrides the cron registration options for the cleanup handler.

func CleanupWithCronExpression

func CleanupWithCronExpression(expression string) CleanupHandlerOption

CleanupWithCronExpression overrides the cron expression for the cleanup handler.

func CleanupWithTimeout added in v0.3.0

func CleanupWithTimeout(timeout time.Duration) CleanupHandlerOption

CleanupWithTimeout overrides the default execution timeout.

type ExportAuditCommand

type ExportAuditCommand struct {
	MaxRecords *int `json:"max_records,omitempty"`
}

ExportAuditCommand retrieves recorded audit events and emits them through the logger.

func (ExportAuditCommand) Type

func (ExportAuditCommand) Type() string

Type implements command.Message.

func (ExportAuditCommand) Validate

func (m ExportAuditCommand) Validate() error

Validate ensures the command payload is well-formed.

type ExportAuditHandler

type ExportAuditHandler struct {
	// contains filtered or unexported fields
}

ExportAuditHandler logs recorded audit events up to the provided limit.

func NewExportAuditHandler

func NewExportAuditHandler(log AuditLog, logger interfaces.Logger, opts ...ExportHandlerOption) *ExportAuditHandler

NewExportAuditHandler constructs a handler wired to the provided audit log implementation.

func (*ExportAuditHandler) CLIHandler added in v0.3.0

func (h *ExportAuditHandler) CLIHandler() any

CLIHandler satisfies command.CLICommand by returning the handler.

func (*ExportAuditHandler) CLIOptions added in v0.3.0

func (h *ExportAuditHandler) CLIOptions() command.CLIConfig

CLIOptions describes the CLI metadata for audit export.

func (*ExportAuditHandler) Execute

Execute satisfies command.Commander[ExportAuditCommand].

type ExportHandlerOption added in v0.3.0

type ExportHandlerOption func(*ExportAuditHandler)

ExportHandlerOption customises the export handler.

func ExportWithTimeout added in v0.3.0

func ExportWithTimeout(timeout time.Duration) ExportHandlerOption

ExportWithTimeout overrides the default execution timeout.

type ReplayAuditCommand

type ReplayAuditCommand struct{}

ReplayAuditCommand triggers scheduler job replay through the worker pipeline.

func (ReplayAuditCommand) Type

func (ReplayAuditCommand) Type() string

Type implements command.Message.

func (ReplayAuditCommand) Validate

func (ReplayAuditCommand) Validate() error

Validate satisfies command.Message.

type ReplayAuditHandler

type ReplayAuditHandler struct {
	// contains filtered or unexported fields
}

ReplayAuditHandler runs pending scheduler jobs via the supplied worker.

func NewReplayAuditHandler

func NewReplayAuditHandler(worker Worker, logger interfaces.Logger, opts ...ReplayHandlerOption) *ReplayAuditHandler

NewReplayAuditHandler constructs a handler that delegates to the provided worker instance.

func (*ReplayAuditHandler) CLIHandler added in v0.3.0

func (h *ReplayAuditHandler) CLIHandler() any

CLIHandler satisfies command.CLICommand by returning the handler.

func (*ReplayAuditHandler) CLIOptions added in v0.3.0

func (h *ReplayAuditHandler) CLIOptions() command.CLIConfig

CLIOptions describes the CLI metadata for audit replay.

func (*ReplayAuditHandler) Execute

Execute satisfies command.Commander[ReplayAuditCommand].

type ReplayHandlerOption added in v0.3.0

type ReplayHandlerOption func(*ReplayAuditHandler)

ReplayHandlerOption customises the replay handler.

func ReplayWithTimeout added in v0.3.0

func ReplayWithTimeout(timeout time.Duration) ReplayHandlerOption

ReplayWithTimeout overrides the default execution timeout.

type Worker

type Worker interface {
	Process(ctx context.Context) error
}

Worker exposes the subset of jobs.Worker behaviour required by the audit commands.

Jump to

Keyboard shortcuts

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