2026-03-13 17:33:39 +00:00
|
|
|
package platform
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
2026-03-13 18:31:43 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/config"
|
2026-03-13 17:33:39 +00:00
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/platform/event"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Envelope = event.Envelope
|
|
|
|
|
type Event = event.Event
|
|
|
|
|
|
|
|
|
|
const EventTypeHeartbeat = event.EventTypeHeartbeat
|
|
|
|
|
|
|
|
|
|
func SetEventChannel(chan_events chan<- Envelope) {
|
|
|
|
|
event.SetEventChannel(chan_events)
|
|
|
|
|
}
|
2026-03-13 18:31:43 +00:00
|
|
|
func SudoEvent(org_id int32, resource, type_, uri_path string) {
|
|
|
|
|
event_type := event.EventTypeFromString(type_)
|
2026-03-13 17:33:39 +00:00
|
|
|
go event.Send(event.Envelope{
|
|
|
|
|
Event: Event{
|
2026-03-13 18:31:43 +00:00
|
|
|
Resource: resource,
|
2026-03-13 17:33:39 +00:00
|
|
|
Time: time.Now(),
|
2026-03-13 18:31:43 +00:00
|
|
|
Type: event_type,
|
|
|
|
|
URI: config.MakeURLNidus(uri_path),
|
2026-03-13 17:33:39 +00:00
|
|
|
},
|
|
|
|
|
OrganizationID: org_id,
|
|
|
|
|
})
|
|
|
|
|
}
|