mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
add simple webhook feature for peer, interface and user events (#398)
This commit is contained in:
@@ -410,6 +410,8 @@ func (m Manager) CreateInterface(ctx context.Context, in *domain.Interface) (*do
|
||||
return nil, fmt.Errorf("creation failure: %w", err)
|
||||
}
|
||||
|
||||
m.bus.Publish(app.TopicInterfaceCreated, *in)
|
||||
|
||||
return in, nil
|
||||
}
|
||||
|
||||
@@ -433,6 +435,8 @@ func (m Manager) UpdateInterface(ctx context.Context, in *domain.Interface) (*do
|
||||
return nil, nil, fmt.Errorf("update failure: %w", err)
|
||||
}
|
||||
|
||||
m.bus.Publish(app.TopicInterfaceUpdated, *in)
|
||||
|
||||
return in, existingPeers, nil
|
||||
}
|
||||
|
||||
@@ -490,6 +494,8 @@ func (m Manager) DeleteInterface(ctx context.Context, id domain.InterfaceIdentif
|
||||
return fmt.Errorf("post-delete hooks failed: %w", err)
|
||||
}
|
||||
|
||||
m.bus.Publish(app.TopicInterfaceDeleted, *existingInterface)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -549,7 +555,6 @@ func (m Manager) saveInterface(ctx context.Context, iface *domain.Interface) (
|
||||
return nil, fmt.Errorf("post-save hooks failed: %w", err)
|
||||
}
|
||||
|
||||
m.bus.Publish(app.TopicInterfaceUpdated, iface)
|
||||
m.bus.Publish(app.TopicAuditInterfaceChanged, domain.AuditEventWrapper[audit.InterfaceEvent]{
|
||||
Ctx: ctx,
|
||||
Event: audit.InterfaceEvent{
|
||||
|
Reference in New Issue
Block a user