Documentation
¶
Overview ¶
Package checklog defines the check audit log Entry entity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
ID id.CheckLogID `json:"id" db:"id"`
TenantID string `json:"tenant_id" db:"tenant_id"`
NamespacePath string `json:"namespace_path,omitempty" db:"namespace_path"`
AppID string `json:"app_id" db:"app_id"`
SubjectKind string `json:"subject_kind" db:"subject_kind"`
SubjectID string `json:"subject_id" db:"subject_id"`
Action string `json:"action" db:"action"`
ResourceType string `json:"resource_type" db:"resource_type"`
ResourceID string `json:"resource_id" db:"resource_id"`
Decision string `json:"decision" db:"decision"`
Reason string `json:"reason,omitempty" db:"reason"`
EvalTimeNs int64 `json:"eval_time_ns" db:"eval_time_ns"`
RequestIP string `json:"request_ip,omitempty" db:"request_ip"`
Metadata map[string]any `json:"metadata,omitempty" db:"metadata"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
Entry is a single authorization check audit record.
type QueryFilter ¶
type QueryFilter struct {
TenantID string `json:"tenant_id,omitempty"`
NamespacePath *string `json:"namespace_path,omitempty"`
NamespacePrefix string `json:"namespace_prefix,omitempty"`
SubjectKind string `json:"subject_kind,omitempty"`
SubjectID string `json:"subject_id,omitempty"`
Action string `json:"action,omitempty"`
ResourceType string `json:"resource_type,omitempty"`
ResourceID string `json:"resource_id,omitempty"`
Decision string `json:"decision,omitempty"`
After *time.Time `json:"after,omitempty"`
Before *time.Time `json:"before,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
QueryFilter contains filters for querying check logs.
type Store ¶
type Store interface {
// CreateCheckLog persists a new check log entry.
CreateCheckLog(ctx context.Context, e *Entry) error
// GetCheckLog retrieves a check log entry by ID.
GetCheckLog(ctx context.Context, logID id.CheckLogID) (*Entry, error)
// ListCheckLogs returns check log entries matching the filter.
ListCheckLogs(ctx context.Context, filter *QueryFilter) ([]*Entry, error)
// CountCheckLogs returns the number of entries matching the filter.
CountCheckLogs(ctx context.Context, filter *QueryFilter) (int64, error)
// PurgeCheckLogs removes check log entries older than the given time.
PurgeCheckLogs(ctx context.Context, before time.Time) (int64, error)
// DeleteCheckLogsByTenant removes all check logs for a tenant.
DeleteCheckLogsByTenant(ctx context.Context, tenantID string) error
}
Store defines persistence operations for check audit logs.
Click to show internal directories.
Click to hide internal directories.