santati (Rust)
The official Rust SDK for the Santati audit-log API: emit one audit event or a batch, list events with filters and cursor pagination, and iterate across pages. The crate is async and runs on Tokio.
Install
Quickstart
use ;
async
Options
| option | default | meaning |
|---|---|---|
api_key |
required | team API key (sat_sk_…); sent as Authorization: Api-Key <key> |
base_url |
https://api.santati.io |
trailing / removed; may carry a path prefix |
trail |
none | default trail for emits; never applied to reads |
timeout |
10s | per attempt |
max_retries |
2 | retries after the first attempt |
backoff(initial, max) |
250ms, 8s | exponential backoff bounds |
header(name, value) |
none | extra header on every request |
outbox(store) |
none | when set, emit queues into store instead of sending |
Building fails with a ValidationError (status None) for an empty api_key
(field api_key) or an Authorization header (field headers). Redirects are
never followed, and the SDK's own retry loop is the only retry: transport
failures, 500/502/503/504 and 429 (unless the code is quota_exceeded) are
retried with the identical request, honouring Retry-After when the server
sends one.
Outbox
Without an outbox, emit sends the event. With Builder::outbox, emit is
fire-and-forget: it validates like a plain emit, stores the envelope in the
outbox and returns at once with queued set and no event, without making a
request. A background task sends the outbox in batches; close stops it and
sends what is left (one pass; during an outage the rest stays in the store), so call it
before exiting.
use ;
async
MemoryOutbox is the in-process store (lost on exit). close() sends each batch once; if
the endpoint is down, what it could not send stays in the store and, in memory, is lost
with the process. Tune the worker with
batch_size, flush_interval, pre_send and post_send on the
builder. For a Redis Streams store, enable the optional redis feature
(santati = { version = "0.2", features = ["redis"] }) and pass
RedisOutbox::new(connection_manager) to Builder::outbox.
Errors
One Error enum with nine kinds, each carrying ErrorDetails:
use ErrorKind;
match client.events.list.await
ErrorKind is Validation, SchemaValidation, Auth, NotFound,
RateLimited, Server, Transport, Api or Outbox; error.status(),
error.code() and error.field() carry the server's side of the failure when
there is one. SchemaValidation is a 400, 413 or 422 whose code is
schema_validation_failed (the event broke the action's schema, named a
disallowed target type, or pinned an unusable schema_version); it is a
separate kind, so code matching Validation must match it too.
Notes
AuditEvent,EventActorandEventTargetare the generated read models, re-exported here so you never import the generated core directly.- The exact wire contract, error mapping and retry policy are normative in
docs/sdk-surface.md, and enforced by the shared vectors inconformance/.
License
Apache-2.0.