pub struct AuditEntry {
pub id: String,
pub timestamp: DateTime<Utc>,
pub event_type: String,
pub actor: String,
pub resource: Option<String>,
pub action: String,
pub outcome: AuditOutcome,
pub metadata: Value,
}Expand description
Audit log entry.
Fields§
§id: StringUnique entry ID.
timestamp: DateTime<Utc>Timestamp of the event.
event_type: StringEvent type.
actor: StringActor (user or system).
resource: Option<String>Resource affected.
action: StringAction taken.
outcome: AuditOutcomeOutcome (success/failure).
metadata: ValueAdditional metadata.
Implementations§
Source§impl AuditEntry
impl AuditEntry
Sourcepub fn new(event_type: impl Into<String>, action: impl Into<String>) -> Self
pub fn new(event_type: impl Into<String>, action: impl Into<String>) -> Self
Creates a new audit entry for the current time.
Sourcepub fn with_actor(self, actor: impl Into<String>) -> Self
pub fn with_actor(self, actor: impl Into<String>) -> Self
Sets the actor.
Sourcepub fn with_resource(self, resource: impl Into<String>) -> Self
pub fn with_resource(self, resource: impl Into<String>) -> Self
Sets the resource.
Sourcepub const fn with_outcome(self, outcome: AuditOutcome) -> Self
pub const fn with_outcome(self, outcome: AuditOutcome) -> Self
Sets the outcome.
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Sets metadata.
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 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