Documentation
¶
Overview ¶
Package webhookwire assembles inbound webhooks for the HTTP composition root (#1870): the source store, the receiver mounted at /hooks/, the compactor, and the source service the admin API calls.
Everything a source writes lands in the managed-resources bucket, through a client on the managed-resources S3 connection, because the scratch catalog that reads a source's compacted windows -- which are managed resources -- has to read its raw segments as well. A deployment with no database, no managed resources store or no Trino toolkit has no webhooks.
Index ¶
- Constants
- type FormCommands
- type FormDeps
- type FormRunner
- type Webhooks
- func (w *Webhooks) AttachEventRuns(stored func(ctx context.Context, source string, events []whevent.Event))
- func (w *Webhooks) AttachForms(d FormDeps)
- func (w *Webhooks) AttachScriptRuns(p *platform.Platform)
- func (w *Webhooks) EnableAlerts(sender levelalert.Sender, base string)
- func (w *Webhooks) Mount(mux *http.ServeMux)
- func (w *Webhooks) MountAdmin(mux *http.ServeMux, p *platform.Platform, ...)
- func (w *Webhooks) Start(ctx context.Context)
- func (w *Webhooks) Stop()
Constants ¶
const EnvAlertInterval = "MCP_PLATFORM_WEBHOOK_ALERT_INTERVAL"
EnvAlertInterval overrides how often the webhook alerts are evaluated (default a minute), as a Go duration.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FormCommands ¶ added in v1.152.0
type FormCommands interface {
SetForms(f epcmd.FormSources)
}
FormCommands is the endpoint commands, whose endpoint_set makes a form's source through what they are handed.
type FormDeps ¶ added in v1.152.0
type FormDeps struct {
Runner FormRunner
Commands FormCommands
// Tokens is the run members' issuer, which answers platform.decrypt.
Tokens *scripttoken.Issuer
// Audit records each decrypt.
Audit middleware.AuditLogger
// Sealer encrypts and decrypts sensitive fields.
Sealer epcollect.Sealer
// Connections names where a source's tables can be created.
Connections func() []string
// MaxFileBytes is resources.managed.max_upload_bytes, the most a form's
// saved file may hold.
MaxFileBytes int64
}
FormDeps are what forms are attached through.
type FormRunner ¶ added in v1.152.0
FormRunner is the endpoint runner, which stores a form's accepted submissions through what it is handed.
type Webhooks ¶
type Webhooks struct {
// Service manages sources; the admin API mounts it.
Service *whadmin.Service
// contains filtered or unexported fields
}
Webhooks is the assembled feature. A nil *Webhooks is a deployment without webhooks, and every method on it does nothing.
func Build ¶
Build assembles webhooks from the platform. address is the main listener's, which names this replica. It returns nil when the deployment cannot hold a webhook source, and an error when the receiver's spool is configured and cannot be opened: an operator who asked for acknowledged events to be kept on disk is told at start, not answered without it.
func (*Webhooks) AttachEventRuns ¶ added in v1.152.0
func (w *Webhooks) AttachEventRuns(stored func(ctx context.Context, source string, events []whevent.Event))
AttachEventRuns has each event this replica stores -- posted, a form's submission, or a message an imap source filed -- told to stored once it is durable (#2332), which enqueues the runs of the automations that name its source. A nil Webhooks attaches nothing.
func (*Webhooks) AttachForms ¶ added in v1.152.0
AttachForms makes forms store their submissions in webhook sources (#2178): endpoint_set makes each form's source through the source service, and the runner stores each accepted submission through this replica's receiver, sealing sensitive fields first and saving its files as managed resources (#2333); platform.decrypt opens them for a run the form's decrypt_personas admit (#2179). A nil Webhooks attaches nothing, and the runner stores no submission, as before.
func (*Webhooks) AttachScriptRuns ¶ added in v1.152.0
AttachScriptRuns enqueues the runs of the automations that name a source for each event this replica stores (#2332), bounded per script by scripts.events.max_queued. A deployment with no database runs no script, and attaches nothing.
func (*Webhooks) EnableAlerts ¶ added in v1.147.0
func (w *Webhooks) EnableAlerts(sender levelalert.Sender, base string)
EnableAlerts builds the webhook alert evaluation (#2149), posting through sender and linking to the portal under base. Called before Start; a nil Webhooks does nothing.
func (*Webhooks) MountAdmin ¶ added in v1.146.0
func (w *Webhooks) MountAdmin( mux *http.ServeMux, p *platform.Platform, auth func(*platform.Platform) func(http.Handler) http.Handler, author func(*http.Request) string, )
MountAdmin registers the webhook source routes behind the admin API's authentication, when there are webhooks and the admin API is enabled.