audit

package
v0.0.0-...-d1bd25e Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown = "Unknown"

	MetricAuditLogRecordsTotal       = "otel_audit_log_records_total"
	MetricAuditLogSendErrorsTotal    = "otel_audit_log_send_errors_total"
	MetricAuditLogConnectionDegraded = "otel_audit_log_connection_degraded"
)

Variables

This section is empty.

Functions

func CreateConn

func CreateConn(connectSocket bool) (createConn audit.CreateConn)

func CreateOtelAuditMsg

func CreateOtelAuditMsg(ctx context.Context, r *http.Request, categoryDescription string, accessLevel string, callerIdentities map[msgs.CallerIdentityType][]msgs.CallerIdentityEntry) msgs.Msg

func GetOperationType

func GetOperationType(method string) msgs.OperationType

Types

type AuditClient

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

func NewOtelAuditClient

func NewOtelAuditClient(ctx context.Context, createConn audit.CreateConn, registerer prometheus.Registerer, options ...base.Option) (*AuditClient, error)

NewOtelAuditClient creates an audit client that wraps the given connection factory with best-effort fallback. If the connection fails, it falls back to a no-op connection and sets the degraded gauge. Non-connection errors from the underlying audit library are returned to the caller.

func (*AuditClient) Send

func (c *AuditClient) Send(ctx context.Context, msg msgs.Msg, options ...base.SendOption) error

type Client

type Client interface {
	Send(ctx context.Context, msg msgs.Msg, options ...base.SendOption) error
}

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter wraps http.ResponseWriter to capture the status code for audit logging.

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) StatusCode

func (w *ResponseWriter) StatusCode() int

StatusCode returns the HTTP status code that was written. Returns http.StatusOK if WriteHeader was never called.

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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