Skip to main content

create

Function create 

Source
pub async fn create(
    pool: &PgPool,
    actor: &Actor,
    policy: &TargetPolicy,
    input: WebhookInput,
) -> AppResult<(Webhook, String)>
Expand description

Registers a webhook. Returns it and its secret – the only time the secret leaves the server.

§Invariants

  • Permission: administrator (403). Name, URL (target policy), events and project group are validated (400).
  • Locks: the webhooks table (SHARE ROW EXCLUSIVE), so concurrent creations cannot pass the limit; at the limit 409.
  • Data: the secret is generated here and returned once; the audit record holds the host of the URL, never the full URL.
  • Audit: webhook.create.
  • Notifications / webhooks: none.
  • Atomic: one transaction.