Crate stackable_webhook

Source
Expand description

Utility types and functions to easily create ready-to-use webhook servers which can handle different tasks, for example CRD conversions. All webhook servers use HTTPS by default. This library is fully compatible with the [tracing] crate and emits debug level tracing data.

Most users will only use the top-level exported generic WebhookServer which enables complete control over the [Router] which handles registering routes and their handler functions.

use stackable_webhook::{WebhookServer, WebhookOptions};
use axum::Router;

let router = Router::new();
let (server, cert_rx) = WebhookServer::new(router, WebhookOptions::default())
    .await
    .expect("failed to create WebhookServer");

For some usages, complete end-to-end WebhookServer implementations exist. One such implementation is the ConversionWebhookServer.

This library additionally also exposes lower-level structs and functions to enable complete control over these details if needed.

Re-exports§

pub use crate::options::WebhookOptions;

Modules§

constants
Contains various constant definitions, mostly for default ports and IP addresses.
options
Contains available options to configure the WebhookServer.
servers
Contains high-level ready-to-use webhook server implementations for specific purposes.
tls
This module contains structs and functions to easily create a TLS termination server, which can be used in combination with an Axum [Router].

Structs§

WebhookServer
A ready-to-use webhook server.

Enums§

WebhookError

Traits§

WebhookHandler
A generic webhook handler receiving a request and sending back a response.

Type Aliases§

Result
A result type alias with the WebhookError type as the default error type.