pub struct AuditEntry {Show 17 fields
pub id: i64,
pub created_at: i64,
pub event: String,
pub outcome: String,
pub profile: String,
pub actor_kind: String,
pub actor_id: Option<String>,
pub account_id: Option<String>,
pub order_id: Option<String>,
pub cert_serial: Option<String>,
pub identifiers: Vec<String>,
pub client_ip: Option<String>,
pub client_ptr: Option<String>,
pub user_agent: Option<String>,
pub request_id: Option<String>,
pub reason: Option<String>,
pub detail: Option<String>,
}Expand description
One stored audit row.
event and actor_kind come back as the strings they were stored as rather
than as AuditEvent/ActorKind: a CHECK constraint written before a
future variant existed is exactly the thing that would make a read of an
older database fail, and a listing that renders an unrecognised event name
is a better outcome than one that refuses to load. AuditEntry::event
parses it for the callers that want the enum.
Fields§
§id: i64§created_at: i64§event: String§outcome: String§profile: String§actor_kind: String§actor_id: Option<String>§account_id: Option<String>§order_id: Option<String>§cert_serial: Option<String>§identifiers: Vec<String>§client_ip: Option<String>§client_ptr: Option<String>§user_agent: Option<String>§request_id: Option<String>§reason: Option<String>§detail: Option<String>Implementations§
Source§impl AuditEntry
impl AuditEntry
Sourcepub fn event(&self) -> Option<AuditEvent>
pub fn event(&self) -> Option<AuditEvent>
The parsed event, or None for a value this build does not know — see
the struct comment.
Sourcepub async fn insert(
record: AuditRecord,
database: &Database,
) -> Result<i64, Error>
pub async fn insert( record: AuditRecord, database: &Database, ) -> Result<i64, Error>
Appends one row, returning its assigned id.
outcome is taken from AuditEvent::outcome rather than the caller,
so the two columns cannot disagree — there is one definition of which
events are failures and this is the only place it is read.
Sourcepub async fn find_by_id(
id: i64,
database: &Database,
) -> Result<Option<Self>, Error>
pub async fn find_by_id( id: i64, database: &Database, ) -> Result<Option<Self>, Error>
One row by id — what acme-proxy audit show <id> reads.
Sourcepub async fn search(
query: &AuditQuery,
database: &Database,
) -> Result<(Vec<Self>, i64), Error>
pub async fn search( query: &AuditQuery, database: &Database, ) -> Result<(Vec<Self>, i64), Error>
One page of rows matching query, newest first, plus the total the same
predicate matches unpaged.
Sourcepub async fn count_older_than(
cutoff: i64,
database: &Database,
) -> Result<i64, Error>
pub async fn count_older_than( cutoff: i64, database: &Database, ) -> Result<i64, Error>
How many rows are older than cutoff — what the purge prompt names
before deleting anything.
Sourcepub async fn cleanup(cutoff: i64, database: &Database) -> Result<u64, Error>
pub async fn cleanup(cutoff: i64, database: &Database) -> Result<u64, Error>
Deletes every row older than cutoff, returning how many went.
The only statement in the crate that removes an audit row, and it takes
an absolute cutoff rather than a duration so the CLI’s --older-than
and the audit.retention_days sweep run the identical delete.
Trait Implementations§
Source§impl Clone for AuditEntry
impl Clone for AuditEntry
Source§fn clone(&self) -> AuditEntry
fn clone(&self) -> AuditEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto 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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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> ⓘ
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 more