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
- func TransformToEventData(l *Log) map[string]interface{}
- type Actor
- type EventName
- type Filter
- type Log
- type Logger
- type NoopRepository
- type NoopWebhookService
- type Option
- type Publisher
- type Repository
- type Service
- type Target
- type WebhookService
- 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 ¶
func SetContextWithService ¶
func TransformToEventData ¶ added in v0.11.0
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" GroupMemberRemovedEvent EventName = "app.group.members.removed" 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" OrgDisabledEvent EventName = "app.organization.disabled" 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 NoopWebhookService ¶ added in v0.11.0
type NoopWebhookService struct{}
func NewNoopWebhookService ¶ added in v0.11.0
func NewNoopWebhookService() *NoopWebhookService
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, webhookService WebhookService, opts ...Option) *Service
type WebhookService ¶ added in v0.11.0
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.