pub struct AuditEvent {
pub id: String,
pub timestamp: SystemTime,
pub event_type: AuditEventType,
pub severity: AuditSeverity,
pub key: Option<String>,
pub old_value: Option<Value>,
pub new_value: Option<Value>,
pub user_context: Option<String>,
pub metadata: HashMap<String, String>,
pub error_message: Option<String>,
pub source: Option<String>,
}
Expand description
Comprehensive audit event record
Fields§
§id: String
Unique event ID
timestamp: SystemTime
Timestamp when the event occurred
event_type: AuditEventType
Type of operation that triggered this event
severity: AuditSeverity
Severity level of the event
key: Option<String>
Configuration key that was accessed/modified
old_value: Option<Value>
Previous value (for modifications)
new_value: Option<Value>
New value (for modifications)
user_context: Option<String>
User or system context that triggered the event
metadata: HashMap<String, String>
Additional contextual information
error_message: Option<String>
Error message (for failures)
source: Option<String>
Source location (file path, line number, etc.)
Implementations§
Source§impl AuditEvent
impl AuditEvent
Sourcepub fn new(event_type: AuditEventType, severity: AuditSeverity) -> Self
pub fn new(event_type: AuditEventType, severity: AuditSeverity) -> Self
Create a new audit event with minimal required fields
Sourcepub fn with_old_value(self, value: Value) -> Self
pub fn with_old_value(self, value: Value) -> Self
Set the old value (for modifications)
Sourcepub fn with_new_value(self, value: Value) -> Self
pub fn with_new_value(self, value: Value) -> Self
Set the new value (for modifications)
Sourcepub fn with_user_context(self, context: impl Into<String>) -> Self
pub fn with_user_context(self, context: impl Into<String>) -> Self
Set the user context
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata key-value pair
Sourcepub fn with_error(self, message: impl Into<String>) -> Self
pub fn with_error(self, message: impl Into<String>) -> Self
Set error message
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Set source location
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AuditEvent
impl Debug for AuditEvent
Auto Trait Implementations§
impl Freeze for AuditEvent
impl RefUnwindSafe for AuditEvent
impl Send for AuditEvent
impl Sync for AuditEvent
impl Unpin 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