MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / WithActor

Function WithActor

app/controlplane/pkg/auditor/logentry.go:186–212  ·  view source on GitHub ↗
(actorType ActorType, actorID uuid.UUID, email, name string)

Source from the content-addressed store, hash-verified

184}
185
186func WithActor(actorType ActorType, actorID uuid.UUID, email, name string) GeneratorOption {
187 return func(a *GeneratorOptions) error {
188 if actorType == "" {
189 return errors.New("actor type is required")
190 }
191
192 if actorType == ActorTypeUser && email == "" {
193 return errors.New("email is required")
194 }
195
196 a.ActorType = actorType
197 // Only set actorID if it is not the zero value
198 if actorID != uuid.Nil {
199 a.ActorID = &actorID
200 }
201 // Only set email if it is not empty
202 if email != "" {
203 a.ActorEmail = email
204 }
205
206 if name != "" {
207 a.ActorName = name
208 }
209
210 return nil
211 }
212}
213
214func WithOrgID(orgID uuid.UUID) GeneratorOption {
215 return func(a *GeneratorOptions) error {

Callers 12

DispatchMethod · 0.92
TestCASBackendEventsFunction · 0.92
TestUserEventsFunction · 0.92
TestOrganizationEventsFunction · 0.92
TestGroupEventsFunction · 0.92
TestCASArtifactEventsFunction · 0.92
TestProjectEventsFunction · 0.92
TestWorkflowEventsFunction · 0.92
TestAPITokenEventsFunction · 0.92
DispatchMethod · 0.92
systemActorFunction · 0.70

Calls

no outgoing calls

Tested by 10

TestCASBackendEventsFunction · 0.74
TestUserEventsFunction · 0.74
TestOrganizationEventsFunction · 0.74
TestGroupEventsFunction · 0.74
TestCASArtifactEventsFunction · 0.74
TestProjectEventsFunction · 0.74
TestWorkflowEventsFunction · 0.74
TestAPITokenEventsFunction · 0.74
systemActorFunction · 0.56