pub struct AuditLog {
pub timestamp: DateTime<Utc>,
pub event_type: AuditEventType,
pub actor: String,
pub resource: String,
pub action: String,
pub result: AuditResult,
pub details: Option<Value>,
pub tenant_id: Option<String>,
pub request_id: Option<String>,
}Expand description
Audit log entry for security-relevant events
Fields§
§timestamp: DateTime<Utc>Event timestamp
event_type: AuditEventTypeEvent type
actor: StringActor (user ID or system)
resource: StringResource being accessed
action: StringAction performed
result: AuditResultResult (success/failure)
details: Option<Value>Additional details
tenant_id: Option<String>Tenant ID
request_id: Option<String>Request ID
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn new(
event_type: AuditEventType,
actor: impl Into<String>,
resource: impl Into<String>,
action: impl Into<String>,
) -> Self
pub fn new( event_type: AuditEventType, actor: impl Into<String>, resource: impl Into<String>, action: impl Into<String>, ) -> Self
Create a new audit log entry
Sourcepub fn with_result(self, result: AuditResult) -> Self
pub fn with_result(self, result: AuditResult) -> Self
Set the result
Sourcepub fn with_details(self, details: impl Serialize) -> Self
pub fn with_details(self, details: impl Serialize) -> Self
Set details
Sourcepub fn with_tenant(self, tenant: impl Into<String>) -> Self
pub fn with_tenant(self, tenant: impl Into<String>) -> Self
Set tenant
Sourcepub fn with_request_id(self, id: impl Into<String>) -> Self
pub fn with_request_id(self, id: impl Into<String>) -> Self
Set request ID
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuditLog
impl RefUnwindSafe for AuditLog
impl Send for AuditLog
impl Sync for AuditLog
impl Unpin for AuditLog
impl UnwindSafe for AuditLog
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.