#[non_exhaustive]pub struct AuditRecord {
pub at: i64,
pub sub: PrincipalId,
pub act: Option<Actor>,
pub camp_id: Option<String>,
pub aud: String,
pub method: String,
pub scope: Vec<Scope>,
pub result: String,
pub request_id: String,
}Expand description
One audit record — verbatim with W159 §Audit journal.
Required fields: at, sub, aud, method, result, request_id.
scope MAY be empty (e.g. a call rejected before scope-matching). act
and camp_id are set when an agent acted on the subject’s behalf and/or
the call was scoped to a camp; both None for a direct user-principal
action with no camp context.
Mirrors the conditional-claim shape of McpClaims
so a verified token’s metadata can flow into the record without lossy
repackaging.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.at: i64Unix-seconds timestamp the action happened (kamaji’s local clock).
sub: PrincipalIdActing principal — the sub claim from the verified token.
act: Option<Actor>§camp_id: Option<String>§aud: StringTarget resource URI (the verified token’s aud).
method: StringFree-form method identifier (POST /cloud/deploy, mcp.tools/call, …)
— kamaji supplies a stable string per call shape.
scope: Vec<Scope>Scope list the call presented. Stored as a typed Vec<Scope> so a
future wildcard or unknown-scope ingest is rejected at parse time
(per composition rule 1 — no wildcards on the wire).
result: StringOutcome string kamaji produced (allow | deny | error is the
usual taxonomy, but cheers does not constrain it — see audit-reader
docs in F14 for the canonical vocabulary). Cheers is durable storage,
not the source of result semantics.
request_id: StringCorrelator into kamaji’s local JSONL — same id appears in both places so an operator can match a cheers row to kamaji’s source.
Implementations§
Source§impl AuditRecord
impl AuditRecord
Sourcepub fn new(
at: i64,
sub: PrincipalId,
act: Option<Actor>,
camp_id: Option<String>,
aud: impl Into<String>,
method: impl Into<String>,
scope: Vec<Scope>,
result: impl Into<String>,
request_id: impl Into<String>,
) -> Result<Self, AuditValidationError>
pub fn new( at: i64, sub: PrincipalId, act: Option<Actor>, camp_id: Option<String>, aud: impl Into<String>, method: impl Into<String>, scope: Vec<Scope>, result: impl Into<String>, request_id: impl Into<String>, ) -> Result<Self, AuditValidationError>
Construct + validate. Returns the same error variants the wire layer
surfaces as 400 audit_invalid.
Trait Implementations§
Source§impl Clone for AuditRecord
impl Clone for AuditRecord
Source§fn clone(&self) -> AuditRecord
fn clone(&self) -> AuditRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more