Documentation
¶
Overview ¶
Package export provides pluggable audit log export with pagination.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalJSONFunc ¶
MarshalJSONFunc returns the current JSON marshaler for test inspection.
func OpenFileFunc ¶
func OpenFileFunc() func(string) (io.WriteCloser, error)
OpenFileFunc returns the current file opener for test inspection.
func SetMarshalJSONFunc ¶
SetMarshalJSONFunc replaces the JSON marshaler. Used by tests.
func SetOpenFileFunc ¶
func SetOpenFileFunc( fn func(string) (io.WriteCloser, error), )
SetOpenFileFunc replaces the file opener. Used by tests.
Types ¶
type Exporter ¶
type Exporter interface {
Open(ctx context.Context) error
Write(ctx context.Context, entry client.AuditEntry) error
Close(ctx context.Context) error
}
Exporter writes audit entries to a backend.
type Fetcher ¶
Fetcher retrieves a page of audit entries. Returns the entries, total count, and any error.
type FileExporter ¶
type FileExporter struct {
Path string
// contains filtered or unexported fields
}
FileExporter writes audit entries as JSON lines to a file.
func NewFileExporter ¶
func NewFileExporter( path string, ) *FileExporter
NewFileExporter creates a new FileExporter for the given path.
func (*FileExporter) Close ¶
func (e *FileExporter) Close( _ context.Context, ) error
Close flushes the buffer and closes the file.
func (*FileExporter) Open ¶
func (e *FileExporter) Open( _ context.Context, ) error
Open creates the output file and prepares for writing.
func (*FileExporter) Write ¶
func (e *FileExporter) Write( _ context.Context, entry client.AuditEntry, ) error
Write marshals an audit entry to JSON and writes it as a single line.
type ProgressFunc ¶
ProgressFunc is called after each batch with the running exported count and total.