pub struct AuditEntry { /* private fields */ }Expand description
A single auditable event.
Audit entries are append-only. They are persisted in the
AuditSink and may be displayed by the TUI.
§Examples
use evault_core::model::{AuditAction, AuditEntry, VarId};
let entry = AuditEntry::for_var(VarId::new_v4(), AuditAction::Created);
assert_eq!(entry.action(), &AuditAction::Created);Implementations§
Source§impl AuditEntry
impl AuditEntry
Sourcepub fn for_var(var_id: VarId, action: AuditAction) -> Self
pub fn for_var(var_id: VarId, action: AuditAction) -> Self
Create a new audit entry referencing a single variable.
Sourcepub fn for_project(
project_id: ProjectId,
var_id: Option<VarId>,
action: AuditAction,
) -> Self
pub fn for_project( project_id: ProjectId, var_id: Option<VarId>, action: AuditAction, ) -> Self
Create a new audit entry referencing a project (and optionally a var).
Sourcepub fn with_note(self, note: impl Into<String>) -> Self
pub fn with_note(self, note: impl Into<String>) -> Self
Attach a free-form note (e.g. the command that was executed).
Sourcepub const fn from_parts(
id: AuditId,
action: AuditAction,
var_id: Option<VarId>,
project_id: Option<ProjectId>,
note: Option<String>,
at: OffsetDateTime,
) -> Self
pub const fn from_parts( id: AuditId, action: AuditAction, var_id: Option<VarId>, project_id: Option<ProjectId>, note: Option<String>, at: OffsetDateTime, ) -> Self
Rehydrate an AuditEntry from already-stored fields.
Sourcepub const fn action(&self) -> &AuditAction
pub const fn action(&self) -> &AuditAction
Returns the action recorded by this entry.
Sourcepub const fn project_id(&self) -> Option<ProjectId>
pub const fn project_id(&self) -> Option<ProjectId>
Returns the referenced project, if any.
Sourcepub const fn at(&self) -> OffsetDateTime
pub const fn at(&self) -> OffsetDateTime
Returns the timestamp the entry was recorded (UTC).
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 (const: unstable) · 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
Source§impl PartialEq for AuditEntry
impl PartialEq for AuditEntry
Source§fn eq(&self, other: &AuditEntry) -> bool
fn eq(&self, other: &AuditEntry) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for AuditEntry
impl Serialize for AuditEntry
impl Eq for AuditEntry
impl StructuralPartialEq for AuditEntry
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