pub struct AuditEntry {Show 13 fields
pub entry_id: Uuid,
pub timestamp: DateTime<Utc>,
pub event_type: AuditEventType,
pub level: AuditLogLevel,
pub actor: ActorType,
pub resource_id: Option<String>,
pub details: HashMap<String, Value>,
pub before_state: Option<Value>,
pub after_state: Option<Value>,
pub result: AuditResult,
pub ip_address: Option<String>,
pub session_id: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
A single audit log entry.
Fields§
§entry_id: UuidUnique identifier for this audit entry
timestamp: DateTime<Utc>Timestamp when the event occurred (UTC, millisecond precision)
event_type: AuditEventTypeType of event
level: AuditLogLevelSeverity level
actor: ActorTypeActor who performed the action
resource_id: Option<String>Target resource identifier (e.g., episode ID)
details: HashMap<String, Value>Event-specific details
before_state: Option<Value>State before modification (if applicable)
after_state: Option<Value>State after modification (if applicable)
result: AuditResultResult of the operation
ip_address: Option<String>IP address of the actor (if available)
session_id: Option<String>Session identifier (if available)
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl AuditEntry
impl AuditEntry
Sourcepub fn new(event_type: AuditEventType, actor: ActorType) -> Self
pub fn new(event_type: AuditEventType, actor: ActorType) -> Self
Create a new audit entry with the current timestamp.
Sourcepub fn with_level(self, level: AuditLogLevel) -> Self
pub fn with_level(self, level: AuditLogLevel) -> Self
Set the log level.
Sourcepub fn with_resource_id(self, id: impl Into<String>) -> Self
pub fn with_resource_id(self, id: impl Into<String>) -> Self
Set the resource ID.
Sourcepub fn with_detail(
self,
key: impl Into<String>,
value: impl Serialize,
) -> Result<Self>
pub fn with_detail( self, key: impl Into<String>, value: impl Serialize, ) -> Result<Self>
Add a detail field.
Sourcepub fn with_before_state(self, state: impl Serialize) -> Result<Self>
pub fn with_before_state(self, state: impl Serialize) -> Result<Self>
Set the before state.
Sourcepub fn with_after_state(self, state: impl Serialize) -> Result<Self>
pub fn with_after_state(self, state: impl Serialize) -> Result<Self>
Set the after state.
Sourcepub fn with_result(self, result: AuditResult) -> Self
pub fn with_result(self, result: AuditResult) -> Self
Set the operation result.
Sourcepub fn with_ip_address(self, ip: impl Into<String>) -> Self
pub fn with_ip_address(self, ip: impl Into<String>) -> Self
Set the IP address.
Sourcepub fn with_session_id(self, session: impl Into<String>) -> Self
pub fn with_session_id(self, session: impl Into<String>) -> Self
Set the session ID.
Trait Implementations§
Source§impl Clone for AuditEntry
impl Clone for AuditEntry
Source§fn clone(&self) -> AuditEntry
fn clone(&self) -> AuditEntry
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 AuditEntry
impl Debug for AuditEntry
Source§impl<'de> Deserialize<'de> for AuditEntry
impl<'de> Deserialize<'de> for AuditEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AuditEntry
impl RefUnwindSafe for AuditEntry
impl Send for AuditEntry
impl Sync for AuditEntry
impl Unpin for AuditEntry
impl UnsafeUnpin for AuditEntry
impl UnwindSafe for AuditEntry
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> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.