audits

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package audits provides the Managed Audit Logs client, mirroring the Node SDK's AuditsClient.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the audits client.

func New

func New(opts ...Option) *Client

New returns an audits client. Call Init to authenticate.

func (*Client) GetAudits

func (c *Client) GetAudits(ctx context.Context, params GetAuditsParams) (*GetAuditsResponse, error)

GetAudits fetches a page of audits for a tenant.

func (*Client) GetAuditsMetadata

func (c *Client) GetAuditsMetadata(ctx context.Context) (map[string]any, error)

GetAuditsMetadata fetches the audits entity metadata.

func (*Client) GetAuditsStats

func (c *Client) GetAuditsStats(ctx context.Context, tenantID string, filters map[string]string) (map[string]any, error)

GetAuditsStats fetches audit statistics for a tenant.

func (*Client) Init

func (c *Client) Init(ctx context.Context, clientID, accessKey string) error

Init authenticates with Frontegg using the audits client ID and access key.

func (*Client) SendAudit

func (c *Client) SendAudit(ctx context.Context, audit SendAuditParams) error

SendAudit posts a single audit entry for a tenant.

func (*Client) SetAuditsMetadata

func (c *Client) SetAuditsMetadata(ctx context.Context, metadata map[string]any) (map[string]any, error)

SetAuditsMetadata updates the audits entity metadata. The entityName is forced to "audits".

type GetAuditsParams

type GetAuditsParams struct {
	TenantID      string
	Filter        string
	SortBy        string
	SortDirection string
	Offset        int
	Count         int
	Filters       map[string]string
}

GetAuditsParams are the query parameters for GetAudits.

type GetAuditsResponse

type GetAuditsResponse struct {
	Data  []map[string]any `json:"data"`
	Total int              `json:"total"`
}

GetAuditsResponse is the paginated audits result.

type Option

type Option func(*Client)

Option configures a Client.

func WithConfig

func WithConfig(cfg config.Config) Option

WithConfig overrides the resolved service configuration.

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient sets the underlying *http.Client.

type SendAuditParams

type SendAuditParams struct {
	TenantID string
	Severity Severity
	Fields   map[string]any
}

SendAuditParams is the payload for SendAudit. TenantID and Severity are required; Fields carries any additional audit attributes.

type Severity

type Severity string

Severity is an audit severity level.

const (
	SeverityInfo     Severity = "Info"
	SeverityMedium   Severity = "Medium"
	SeverityHigh     Severity = "High"
	SeverityCritical Severity = "Critical"
	SeverityError    Severity = "Error"
)

Jump to

Keyboard shortcuts

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