lxAudit

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Actions
	Insert = "insert"
	Update = "update"
	Delete = "delete"

	// Timeout for cancel request
	DefaultTimeout = time.Second * 15

	// Route paths
	PathLogEntry   = "/v1/log"
	PathLogEntries = "/v1/bulk/log"
)

Variables

View Source
var (
	ErrAuditEntryType = errors.New("must be AuditEntry or []AuditEntry type")
	ErrRespContent    = errors.New("response shouldn't have any content")
	ErrStatus         = errors.New("status must have 200")
)

Errors

Functions

func NewQueue added in v1.7.0

func NewQueue(clientHost, auditHost, auditHostAuthKey string, logEntry *logrus.Entry, workerThrottle ...time.Duration) *queue

NewQueue create instance of queue Example: queue := lxAudit.NewQueue(

"test-host",
server.URL,
"<auth key for host>",
lxLog.GetLogger().WithFields(logrus.Fields{}),
10 * time.Millisecond)

optional workerThrottle is time.Sleep after job

func RequestAudit added in v1.7.0

func RequestAudit(elem interface{}, auditHost, auditAuthKey string, timeout ...time.Duration) error

RequestAudit send entry or entries to audit service. This function can also be used independently of the worker. Example: err := lxAudit.RequestAudit(...)

Types

type AuditEntries added in v1.7.0

type AuditEntries []AuditEntry

AuditEntries transport type for service

type AuditEntry added in v1.7.0

type AuditEntry struct {
	Host       string      `json:"host"`
	Collection string      `json:"collection"`
	Action     string      `json:"action"`
	User       interface{} `json:"user"`
	Data       interface{} `json:"data"`
}

AuditEntry transport type for service

type IAudit

type IAudit interface {
	Send(elem interface{})
	IsActive() bool
}

Directories

Path Synopsis
Package lxAuditMocks is a generated GoMock package.
Package lxAuditMocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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