pub struct AuditEvent {
pub ts: u128,
pub event_id: String,
pub principal: Option<String>,
pub source: AuditAuthSource,
pub tenant: Option<String>,
pub action: String,
pub resource: Option<String>,
pub outcome: Outcome,
pub detail: Value,
pub remote_addr: Option<String>,
pub correlation_id: Option<String>,
}Expand description
Structured audit event. Serialised as one JSONL row per call.
Fields§
§ts: u128§event_id: String§principal: Option<String>§source: AuditAuthSource§tenant: Option<String>§action: String§resource: Option<String>§outcome: Outcome§detail: Value§remote_addr: Option<String>§correlation_id: Option<String>Implementations§
Source§impl AuditEvent
impl AuditEvent
Sourcepub fn builder(action: impl Into<String>) -> AuditEventBuilder
pub fn builder(action: impl Into<String>) -> AuditEventBuilder
Convenience builder. The caller fills the required fields and chains the optional ones — keeps emit sites readable.
Sourcepub fn from_legacy(
action: &str,
principal: &str,
target: &str,
result: &str,
details: Value,
) -> AuditEvent
pub fn from_legacy( action: &str, principal: &str, target: &str, result: &str, details: Value, ) -> AuditEvent
Wrap a pre-structured-API call into the new schema. Used by the
back-compat record(action, principal, target, result, details)
path so existing emit sites keep compiling.
Sourcepub fn to_json_line(&self, prev_hash: Option<&str>) -> String
pub fn to_json_line(&self, prev_hash: Option<&str>) -> String
Render to a single JSONL line, optionally seeded with a
prev_hash for the tamper-evident chain.
Sourcepub fn parse_line(line: &str) -> Option<AuditEvent>
pub fn parse_line(line: &str) -> Option<AuditEvent>
Parse one JSONL line back into an AuditEvent. Returns None
for legacy lines (pre-restructuring) or malformed JSON; callers
in the query path use this to filter.
Trait Implementations§
Source§impl Clone for AuditEvent
impl Clone for AuditEvent
Source§fn clone(&self) -> AuditEvent
fn clone(&self) -> AuditEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuditEvent
impl RefUnwindSafe for AuditEvent
impl Send for AuditEvent
impl Sync for AuditEvent
impl Unpin for AuditEvent
impl UnsafeUnpin for AuditEvent
impl UnwindSafe for AuditEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request