pub struct EventBuilder {
pub action: AuditAction,
pub actor: AuditActor,
pub target: AuditTarget,
pub outcome: AuditOutcome,
pub auth: Option<AuditAuth>,
pub session_id: Option<String>,
pub request_id: Option<String>,
pub error: Option<String>,
}Expand description
Builder for an audit event. Most call sites use one of the
convenience helpers ([emit_store], [emit_recall], etc.) but the
builder is public so unusual flows (consolidate-many, deferred
import) can fill in custom targets.
Fields§
§action: AuditAction§actor: AuditActor§target: AuditTarget§outcome: AuditOutcome§auth: Option<AuditAuth>§session_id: Option<String>§request_id: Option<String>§error: Option<String>Implementations§
Source§impl EventBuilder
impl EventBuilder
Sourcepub fn new(action: AuditAction, actor: AuditActor, target: AuditTarget) -> Self
pub fn new(action: AuditAction, actor: AuditActor, target: AuditTarget) -> Self
Build a default-shaped event for action. Caller fills in the
remaining fields.
Sourcepub fn outcome(self, outcome: AuditOutcome) -> Self
pub fn outcome(self, outcome: AuditOutcome) -> Self
Override outcome (default = Allow).
Sourcepub fn error(self, msg: impl Into<String>) -> Self
pub fn error(self, msg: impl Into<String>) -> Self
Set the error string. Caps at 256 chars and strips newlines so a runaway error message can’t leak content or break the log line.
pub fn auth(self, auth: AuditAuth) -> Self
pub fn request_id(self, id: impl Into<String>) -> Self
Trait Implementations§
Source§impl Clone for EventBuilder
impl Clone for EventBuilder
Source§fn clone(&self) -> EventBuilder
fn clone(&self) -> EventBuilder
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 EventBuilder
impl RefUnwindSafe for EventBuilder
impl Send for EventBuilder
impl Sync for EventBuilder
impl Unpin for EventBuilder
impl UnsafeUnpin for EventBuilder
impl UnwindSafe for EventBuilder
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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 more