Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResourceID ¶ added in v0.8.15
func ResourceTarget ¶ added in v0.8.15
func ResourceType ¶ added in v0.8.15
func ResourceType[T Auditable](tgt T) database.ResourceType
Types ¶
type Auditable ¶
type Auditable interface { database.APIKey | database.Organization | database.OrganizationMember | database.Template | database.TemplateVersion | database.User | database.Workspace | database.GitSSHKey | database.Group }
Auditable is mostly a marker interface. It contains a definitive list of all auditable types. If you want to audit a new type, first define it in AuditableResources, then add it to this interface.
type Auditor ¶ added in v0.8.11
type Differ ¶ added in v0.8.11
Differ is used so the enterprise version can implement the diff function in the Auditor feature interface. Only types in the same package as the interface can implement unexported methods.
type Map ¶
Map is a map of changed fields in an audited resource. It maps field names to the old and new value for that field.
type MockAuditor ¶ added in v0.8.15
func NewMock ¶ added in v0.8.15
func NewMock() *MockAuditor
type OldNew ¶ added in v0.8.11
OldNew is a pair of values representing the old value and the new value.
type Request ¶ added in v0.8.11
type Request[T Auditable] struct { Old T New T // contains filtered or unexported fields }
func InitRequest ¶ added in v0.8.11
func InitRequest[T Auditable](w http.ResponseWriter, p *RequestParams) (*Request[T], func())
InitRequest initializes an audit log for a request. It returns a function that should be deferred, causing the audit log to be committed when the handler returns.