pub struct SecurityEvent {Show 14 fields
pub event_id: String,
pub event_type: SecurityEventType,
pub severity: SecuritySeverity,
pub timestamp: DateTime<Utc>,
pub user_id: Option<String>,
pub session_id: Option<String>,
pub api_key_id: Option<String>,
pub client_ip: Option<String>,
pub user_agent: Option<String>,
pub method: Option<String>,
pub description: String,
pub metadata: HashMap<String, String>,
pub country: Option<String>,
pub city: Option<String>,
}
Expand description
Security event details
Fields§
§event_id: String
Unique event identifier
event_type: SecurityEventType
Event type
severity: SecuritySeverity
Event severity
timestamp: DateTime<Utc>
Event timestamp
user_id: Option<String>
User/session context
session_id: Option<String>
§api_key_id: Option<String>
§client_ip: Option<String>
Request context
user_agent: Option<String>
§method: Option<String>
§description: String
Event details
metadata: HashMap<String, String>
§country: Option<String>
Geographic information (if available)
city: Option<String>
Implementations§
Source§impl SecurityEvent
impl SecurityEvent
Sourcepub fn new(
event_type: SecurityEventType,
severity: SecuritySeverity,
description: String,
) -> Self
pub fn new( event_type: SecurityEventType, severity: SecuritySeverity, description: String, ) -> Self
Create a new security event
Sourcepub fn with_user_context(self, auth_context: &AuthContext) -> Self
pub fn with_user_context(self, auth_context: &AuthContext) -> Self
Add user context to event
Sourcepub fn with_session_context(self, session: &Session) -> Self
pub fn with_session_context(self, session: &Session) -> Self
Add session context to event
Sourcepub fn with_request_context(
self,
client_ip: Option<String>,
user_agent: Option<String>,
method: Option<String>,
) -> Self
pub fn with_request_context( self, client_ip: Option<String>, user_agent: Option<String>, method: Option<String>, ) -> Self
Add request context to event
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
Add metadata to 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 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