auditv1

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(dsn string)

Init configures the DefaultClient for the provided dsn. Errors will be logged..

func SetupClient

func SetupClient(l *zap.Logger, t *auditpb.Target) (err error)

SetupClient configures the DefaultClient for t.

func TargetFromDSN

func TargetFromDSN(dsn string) (*auditpb.Target, error)

func Write

func Write(event *auditpb.Event)

Write event asynchronously to DefaultClient. Errors are logged including event.

func WriteEvents

func WriteEvents(ctx context.Context, async bool, events []*auditpb.Event) (err error)

WriteEvents to DefaultClient. Failures contained in err will contain event.

Types

type Client

type Client struct {
	// Target to send Events to.
	Target *auditpb.Target

	// Audit communicates with the AuditAPI.
	Audit auditpb.AuditAPIClient

	// Log prints informational messages.
	Log *zap.SugaredLogger
}

Client sends events to the Audit API.

var (
	// DefaultClient for sending Events.
	DefaultClient *Client
)

func NewClient

func NewClient(logger *zap.Logger, target *auditpb.Target) (*Client, error)

NewClient returns a client that sends to input.

func (*Client) Write

func (c *Client) Write(event *auditpb.Event)

Write event asynchronously to Audit API. Errors are logged including event.

func (*Client) WriteEvents

func (c *Client) WriteEvents(ctx context.Context, async bool, events []*auditpb.Event) (err error)

WriteEvents to Audit API. Failures contained in err will contain event.

type Error

type Error struct {
	// Message relating to failure.
	Message string

	// Events that failed to be written.
	Events []*auditpb.Event
}

Error encountered when writing an Event. Contains original Event for posterity.

func (*Error) Error

func (e *Error) Error() string

Error returns the reason for the failure as well as the original Event.

Jump to

Keyboard shortcuts

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