pub struct AuditLogger { /* private fields */ }Expand description
Audit logger
Implementations§
Source§impl AuditLogger
impl AuditLogger
Sourcepub fn new(config: AuditConfig) -> Self
pub fn new(config: AuditConfig) -> Self
Create a new audit logger
Sourcepub async fn log(&self, event: AuditEvent) -> Result<()>
pub async fn log(&self, event: AuditEvent) -> Result<()>
Log an audit event
Sourcepub fn should_log(&self, event_type: &AuditEventType) -> bool
pub fn should_log(&self, event_type: &AuditEventType) -> bool
Check if event should be logged based on sampling
Sourcepub async fn query_by_resource(
&self,
resource: &str,
start_time: Option<i64>,
end_time: Option<i64>,
) -> Result<Vec<AuditEvent>>
pub async fn query_by_resource( &self, resource: &str, start_time: Option<i64>, end_time: Option<i64>, ) -> Result<Vec<AuditEvent>>
Query events by resource
Sourcepub async fn query_by_subject(
&self,
subject: &str,
start_time: Option<i64>,
end_time: Option<i64>,
) -> Result<Vec<AuditEvent>>
pub async fn query_by_subject( &self, subject: &str, start_time: Option<i64>, end_time: Option<i64>, ) -> Result<Vec<AuditEvent>>
Query events by subject
Sourcepub async fn query_by_tenant(
&self,
tenant_id: &str,
start_time: Option<i64>,
end_time: Option<i64>,
) -> Result<Vec<AuditEvent>>
pub async fn query_by_tenant( &self, tenant_id: &str, start_time: Option<i64>, end_time: Option<i64>, ) -> Result<Vec<AuditEvent>>
Query events by tenant
Sourcepub async fn stats(&self) -> AuditStats
pub async fn stats(&self) -> AuditStats
Get audit statistics
Sourcepub async fn compliance_report(
&self,
tenant_id: Option<&str>,
) -> Result<ComplianceReport>
pub async fn compliance_report( &self, tenant_id: Option<&str>, ) -> Result<ComplianceReport>
Generate compliance report
Auto Trait Implementations§
impl Freeze for AuditLogger
impl !RefUnwindSafe for AuditLogger
impl Send for AuditLogger
impl Sync for AuditLogger
impl Unpin for AuditLogger
impl !UnwindSafe for AuditLogger
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> 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