auditrecord

package
v0.74.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIdempotencyKeyConflict = errors.New("audit record already exists for the given idempotency key")
	ErrInvalidUUID            = errors.New("invalid syntax of uuid")
	ErrNotFound               = errors.New("audit record not found")
)
View Source
var SuperUserActorMetadataKey = "is_super_user"

Functions

This section is empty.

Types

type Actor

type Actor struct {
	ID       string
	Type     string
	Name     string
	Metadata metadata.Metadata
}

type AuditRecord

type AuditRecord struct {
	ID             string
	Event          string
	Actor          Actor
	Resource       Resource
	Target         *Target
	OccurredAt     time.Time
	OrgID          string
	RequestID      *string
	CreatedAt      time.Time
	Metadata       metadata.Metadata
	IdempotencyKey string
}

type Repository

type Repository interface {
	Create(ctx context.Context, auditRecord AuditRecord) (AuditRecord, error)
	GetByIdempotencyKey(ctx context.Context, idempotencyKey string) (AuditRecord, error)
}

type Resource

type Resource struct {
	ID       string
	Type     string
	Name     string
	Metadata metadata.Metadata
}

type Service

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

func NewService

func NewService(repository Repository, userService UserService, serviceUserService ServiceUserService) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, auditRecord AuditRecord) (AuditRecord, bool, error)

type ServiceUserService

type ServiceUserService interface {
	Get(ctx context.Context, id string) (serviceuser.ServiceUser, error)
}

type Target

type Target struct {
	ID       string
	Type     string
	Name     string
	Metadata metadata.Metadata
}

type UserService

type UserService interface {
	GetByID(ctx context.Context, id string) (userpkg.User, error)
	IsSudo(ctx context.Context, id string, permissionName string) (bool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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