-
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/kms/api-key-service/internal/audit"
|
||||
"github.com/kms/api-key-service/internal/domain"
|
||||
)
|
||||
|
||||
@ -319,3 +320,33 @@ type MetricsProvider interface {
|
||||
// RecordDuration records the duration of an operation
|
||||
RecordDuration(ctx context.Context, name string, duration time.Duration, labels map[string]string)
|
||||
}
|
||||
|
||||
// AuditRepository defines the interface for audit event storage operations
|
||||
type AuditRepository interface {
|
||||
// Create stores a new audit event
|
||||
Create(ctx context.Context, event *audit.AuditEvent) error
|
||||
|
||||
// Query retrieves audit events based on filter criteria
|
||||
Query(ctx context.Context, filter *audit.AuditFilter) ([]*audit.AuditEvent, error)
|
||||
|
||||
// GetStats returns aggregated statistics for audit events
|
||||
GetStats(ctx context.Context, filter *audit.AuditStatsFilter) (*audit.AuditStats, error)
|
||||
|
||||
// DeleteOldEvents removes audit events older than the specified time
|
||||
DeleteOldEvents(ctx context.Context, olderThan time.Time) (int, error)
|
||||
|
||||
// GetByID retrieves a specific audit event by its ID
|
||||
GetByID(ctx context.Context, eventID uuid.UUID) (*audit.AuditEvent, error)
|
||||
|
||||
// GetByRequestID retrieves all audit events for a specific request
|
||||
GetByRequestID(ctx context.Context, requestID string) ([]*audit.AuditEvent, error)
|
||||
|
||||
// GetBySession retrieves all audit events for a specific session
|
||||
GetBySession(ctx context.Context, sessionID string) ([]*audit.AuditEvent, error)
|
||||
|
||||
// GetByActor retrieves audit events for a specific actor
|
||||
GetByActor(ctx context.Context, actorID string, limit, offset int) ([]*audit.AuditEvent, error)
|
||||
|
||||
// GetByResource retrieves audit events for a specific resource
|
||||
GetByResource(ctx context.Context, resourceType, resourceID string, limit, offset int) ([]*audit.AuditEvent, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user