From 9bdf534b8c41d654329b9e7d6d284cd4d29eb6f9 Mon Sep 17 00:00:00 2001
From: Allen Li
Date: Tue, 2 Dec 2025 23:22:55 +0800
Subject: [PATCH] feat: add new actor type for dcr
---
eventstream.go | 10 ++++++++--
v3/eventstream.go | 12 +++++++++---
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/eventstream.go b/eventstream.go
index f5afb27..1eede60 100644
--- a/eventstream.go
+++ b/eventstream.go
@@ -35,8 +35,9 @@ const (
eventStreamStdout = "stdout"
eventStreamKafka = "kafka"
- actorTypeUser = "USER"
- actorTypeClient = "CLIENT"
+ actorTypeUser = "USER"
+ actorTypeClient = "CLIENT"
+ actorTypeAnonymous = "ANONYMOUS"
)
const (
@@ -541,6 +542,11 @@ func (auditLogBuilder *AuditLogBuilder) IsActorTypeUser(isActorTypeUser bool) *A
return auditLogBuilder
}
+func (auditLogBuilder *AuditLogBuilder) WithAnonymousActorType() *AuditLogBuilder {
+ auditLogBuilder.actorType = actorTypeAnonymous
+ return auditLogBuilder
+}
+
func (auditLogBuilder *AuditLogBuilder) ClientID(clientID string) *AuditLogBuilder {
auditLogBuilder.clientID = clientID
return auditLogBuilder
diff --git a/v3/eventstream.go b/v3/eventstream.go
index afc4e2e..9836158 100644
--- a/v3/eventstream.go
+++ b/v3/eventstream.go
@@ -35,8 +35,9 @@ const (
eventStreamStdout = "stdout"
eventStreamKafka = "kafka"
- actorTypeUser = "USER"
- actorTypeClient = "CLIENT"
+ actorTypeUser = "USER"
+ actorTypeClient = "CLIENT"
+ actorTypeAnonymous = "ANONYMOUS"
)
const (
@@ -77,7 +78,7 @@ type Event struct {
TargetNamespace string `json:"target_namespace,omitempty"`
Privacy bool `json:"privacy,omitempty"`
Topic string `json:"topic,omitempty"`
- SourceNamespace string `json:"sourceNamespace,omitempty"`
+ SourceNamespace string `json:"sourceNamespace,omitempty"`
AdditionalFields map[string]interface{} `json:"additional_fields,omitempty"`
Payload map[string]interface{} `json:"payload,omitempty"`
@@ -500,6 +501,11 @@ func (auditLogBuilder *AuditLogBuilder) IsActorTypeUser(isActorTypeUser bool) *A
return auditLogBuilder
}
+func (auditLogBuilder *AuditLogBuilder) WithAnonymousActorType() *AuditLogBuilder {
+ auditLogBuilder.actorType = actorTypeAnonymous
+ return auditLogBuilder
+}
+
func (auditLogBuilder *AuditLogBuilder) ClientID(clientID string) *AuditLogBuilder {
auditLogBuilder.clientID = clientID
return auditLogBuilder