pub struct AuditQueryBuilder { /* private fields */ }Expand description
A fluent builder for AuditQuery.
Starts from the Default query (no filters, descending timestamp).
§Example
use auth_framework::audit::*;
use std::time::{Duration, SystemTime};
let query = AuditQuery::builder()
.event_types(vec![AuditEventType::LoginFailure])
.limit(50)
.build();
assert_eq!(query.limit, Some(50));Implementations§
Source§impl AuditQueryBuilder
impl AuditQueryBuilder
Sourcepub fn event_types(self, types: Vec<AuditEventType>) -> Self
pub fn event_types(self, types: Vec<AuditEventType>) -> Self
Filter by event types.
Sourcepub fn risk_level(self, level: RiskLevel) -> Self
pub fn risk_level(self, level: RiskLevel) -> Self
Filter by minimum risk level.
Sourcepub fn outcome(self, outcome: EventOutcome) -> Self
pub fn outcome(self, outcome: EventOutcome) -> Self
Filter by outcome.
Sourcepub fn time_range(self, start: SystemTime, end: SystemTime) -> Self
pub fn time_range(self, start: SystemTime, end: SystemTime) -> Self
Filter by time range.
Sourcepub fn last_seconds(self, seconds: u64) -> Self
pub fn last_seconds(self, seconds: u64) -> Self
Convenience: filter to the last N seconds.
Sourcepub fn ip_address(self, ip: impl Into<String>) -> Self
pub fn ip_address(self, ip: impl Into<String>) -> Self
Filter by IP address.
Sourcepub fn resource_type(self, rt: impl Into<String>) -> Self
pub fn resource_type(self, rt: impl Into<String>) -> Self
Filter by resource type.
Sourcepub fn correlation_id(self, id: impl Into<String>) -> Self
pub fn correlation_id(self, id: impl Into<String>) -> Self
Filter by correlation ID.
Sourcepub fn sort_order(self, order: SortOrder) -> Self
pub fn sort_order(self, order: SortOrder) -> Self
Set the sort order.
Sourcepub fn build(self) -> AuditQuery
pub fn build(self) -> AuditQuery
Consume the builder and produce the AuditQuery.
Auto Trait Implementations§
impl Freeze for AuditQueryBuilder
impl RefUnwindSafe for AuditQueryBuilder
impl Send for AuditQueryBuilder
impl Sync for AuditQueryBuilder
impl Unpin for AuditQueryBuilder
impl UnsafeUnpin for AuditQueryBuilder
impl UnwindSafe for AuditQueryBuilder
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
Mutably borrows from an owned value. Read more
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 more