Documentation ¶
Index ¶
- Variables
- func SetContextWithActor(ctx context.Context, actor Actor) context.Context
- func SetContextWithMetadata(ctx context.Context, md map[string]string) context.Context
- func SetContextWithService(ctx context.Context, p *Service) context.Context
- type Actor
- type EventName
- type Filter
- type Log
- type Logger
- type NoopRepository
- type Option
- type Publisher
- type Repository
- type Service
- type Target
- type WriteOnlyRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidDetail = fmt.Errorf("invalid audit details") ErrInvalidID = fmt.Errorf("group id is invalid") )
Functions ¶
func SetContextWithActor ¶
func SetContextWithMetadata ¶
Types ¶
type EventName ¶
type EventName string
const ( UserCreatedEvent EventName = "app.user.created" UserUpdatedEvent EventName = "app.user.updated" UserDeletedEvent EventName = "app.user.deleted" UserListedEvent EventName = "app.user.listed" ServiceUserCreatedEvent EventName = "app.serviceuser.created" ServiceUserDeletedEvent EventName = "app.serviceuser.deleted" GroupCreatedEvent EventName = "app.group.created" GroupUpdatedEvent EventName = "app.group.updated" GroupDeletedEvent EventName = "app.group.deleted" RoleCreatedEvent EventName = "app.role.created" RoleUpdatedEvent EventName = "app.role.updated" RoleDeletedEvent EventName = "app.role.deleted" PermissionCreatedEvent EventName = "app.permission.created" PermissionUpdatedEvent EventName = "app.permission.updated" PermissionDeletedEvent EventName = "app.permission.deleted" PermissionCheckedEvent EventName = "app.permission.checked" BillingEntitlementCheckedEvent EventName = "app.billing.entitlement.checked" PolicyCreatedEvent EventName = "app.policy.created" PolicyDeletedEvent EventName = "app.policy.deleted" OrgCreatedEvent EventName = "app.organization.created" OrgUpdatedEvent EventName = "app.organization.updated" OrgDeletedEvent EventName = "app.organization.deleted" OrgMemberCreatedEvent EventName = "app.organization.member.created" OrgMemberDeletedEvent EventName = "app.organization.member.deleted" ProjectCreatedEvent EventName = "app.project.created" ProjectUpdatedEvent EventName = "app.project.updated" ProjectDeletedEvent EventName = "app.project.deleted" ResourceCreatedEvent EventName = "app.resource.created" ResourceUpdatedEvent EventName = "app.resource.updated" ResourceDeletedEvent EventName = "app.resource.deleted" )
type Log ¶
type Log struct { ID string OrgID string Source string Action string Actor Actor Target Target Metadata map[string]string CreatedAt time.Time }
Log is a struct that represents an audit log
type NoopRepository ¶ added in v0.8.35
type NoopRepository struct{}
func NewNoopRepository ¶ added in v0.8.35
func NewNoopRepository() *NoopRepository
func (NoopRepository) Create ¶ added in v0.8.35
func (r NoopRepository) Create(ctx context.Context, log *Log) error
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func GetService ¶
GetService returns the audit service from the context if set otherwise it returns a new service with a write only repository
func NewService ¶
func NewService(source string, repository Repository, opts ...Option) *Service
type WriteOnlyRepository ¶
type WriteOnlyRepository struct {
// contains filtered or unexported fields
}
func NewWriteOnlyRepository ¶
func NewWriteOnlyRepository(writer io.Writer) *WriteOnlyRepository
func (WriteOnlyRepository) Create ¶
func (r WriteOnlyRepository) Create(ctx context.Context, log *Log) error
Click to show internal directories.
Click to hide internal directories.