pub struct SecurityEvent {
pub id: String,
pub event_type: SecurityEventType,
pub timestamp: u64,
pub user: Option<String>,
pub ip_address: Option<String>,
pub resource: Option<String>,
pub description: String,
pub metadata: HashMap<String, String>,
}Expand description
A security event recorded by the system.
Fields§
§id: StringUnique event ID.
event_type: SecurityEventTypeType of security event.
timestamp: u64Timestamp when the event occurred (Unix milliseconds).
user: Option<String>User associated with the event (if known).
ip_address: Option<String>IP address associated with the event (if known).
resource: Option<String>Resource being accessed (table, endpoint, etc.).
description: StringDetailed description of the event.
metadata: HashMap<String, String>Additional metadata.
Implementations§
Source§impl SecurityEvent
impl SecurityEvent
Sourcepub fn new(
event_type: SecurityEventType,
description: &str,
counter: &AtomicU64,
) -> Self
pub fn new( event_type: SecurityEventType, description: &str, counter: &AtomicU64, ) -> Self
Create a new security event with an auto-generated ID from the given counter.
Sourcepub fn with_resource(self, resource: &str) -> Self
pub fn with_resource(self, resource: &str) -> Self
Set the resource being accessed.
Sourcepub fn with_metadata(self, key: &str, value: &str) -> Self
pub fn with_metadata(self, key: &str, value: &str) -> Self
Add metadata to the event.
Trait Implementations§
Source§impl Clone for SecurityEvent
impl Clone for SecurityEvent
Source§fn clone(&self) -> SecurityEvent
fn clone(&self) -> SecurityEvent
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 SecurityEvent
impl Debug for SecurityEvent
Source§impl<'de> Deserialize<'de> for SecurityEvent
impl<'de> Deserialize<'de> for SecurityEvent
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 SecurityEvent
impl RefUnwindSafe for SecurityEvent
impl Send for SecurityEvent
impl Sync for SecurityEvent
impl Unpin for SecurityEvent
impl UnsafeUnpin for SecurityEvent
impl UnwindSafe for SecurityEvent
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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