Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDispatcherClosed = errors.New("webhook dispatcher closed") ErrQueueFull = errors.New("webhook queue full") )
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher sends webhook events asynchronously. When OutboxDir is configured, Enqueue only succeeds after the signed delivery record is durably written.
func NewDispatcher ¶
func NewDispatcher(options Options, logger *zap.Logger) *Dispatcher
NewDispatcher creates a new dispatcher.
func (*Dispatcher) Enqueue ¶
func (d *Dispatcher) Enqueue(event Event) (string, error)
Enqueue sends an event to the dispatcher queue and returns its event ID.
func (*Dispatcher) Identity ¶
func (d *Dispatcher) Identity() (string, string)
Identity returns the current identity context.
func (*Dispatcher) SetConfig ¶
func (d *Dispatcher) SetConfig(url, secret string)
SetConfig updates the webhook target configuration.
func (*Dispatcher) SetIdentity ¶
func (d *Dispatcher) SetIdentity(sandboxID, teamID string)
SetIdentity sets the sandbox and team identifiers.
type Event ¶
type Event struct {
EventID string `json:"event_id"`
EventType EventType `json:"event_type"`
Timestamp time.Time `json:"timestamp"`
SandboxID string `json:"sandbox_id"`
TeamID string `json:"team_id"`
Payload any `json:"payload"`
}
Event represents a webhook event payload.
type EventType ¶
type EventType string
EventType defines the webhook event type.
const ( // Sandbox events EventTypeSandboxReady EventType = "sandbox.ready" EventTypeSandboxKilled EventType = "sandbox.killed" EventTypeSandboxPaused EventType = "sandbox.paused" EventTypeSandboxResumed EventType = "sandbox.resumed" // Process events EventTypeProcessStarted EventType = "process.started" EventTypeProcessExited EventType = "process.exited" EventTypeProcessCrashed EventType = "process.crashed" // File system events EventTypeFileModified EventType = "file.modified" // Agent events EventTypeAgentEvent EventType = "agent.event" )
Click to show internal directories.
Click to hide internal directories.