pub struct AuditLogEntry {
pub id: Uuid,
pub timestamp: DateTime<Utc>,
pub event_type: AuditEventType,
pub user_id: Option<Uuid>,
pub organization_id: Option<Uuid>,
pub resource_type: Option<String>,
pub resource_id: Option<Uuid>,
pub ip_address: Option<String>,
pub user_agent: Option<String>,
pub metadata: Option<Value>,
pub success: bool,
pub error_message: Option<String>,
}Expand description
Audit log entry
Fields§
§id: UuidUnique ID for this audit entry
timestamp: DateTime<Utc>Timestamp of the event
event_type: AuditEventTypeType of event
user_id: Option<Uuid>User ID who performed the action (if authenticated)
organization_id: Option<Uuid>Organization ID (for multi-tenant isolation)
resource_type: Option<String>Resource type affected (e.g., “Building”, “Unit”)
resource_id: Option<Uuid>Resource ID affected
ip_address: Option<String>IP address of the client
user_agent: Option<String>User agent string
metadata: Option<Value>Additional metadata as JSON
success: boolSuccess or failure
error_message: Option<String>Error message if failed
Implementations§
Source§impl AuditLogEntry
impl AuditLogEntry
Sourcepub fn new(
event_type: AuditEventType,
user_id: Option<Uuid>,
organization_id: Option<Uuid>,
) -> Self
pub fn new( event_type: AuditEventType, user_id: Option<Uuid>, organization_id: Option<Uuid>, ) -> Self
Create a new audit log entry
Sourcepub fn with_resource(self, resource_type: &str, resource_id: Uuid) -> Self
pub fn with_resource(self, resource_type: &str, resource_id: Uuid) -> Self
Set resource information
Sourcepub fn with_client_info(
self,
ip_address: Option<String>,
user_agent: Option<String>,
) -> Self
pub fn with_client_info( self, ip_address: Option<String>, user_agent: Option<String>, ) -> Self
Set client information
Sourcepub fn with_metadata(self, metadata: Value) -> Self
pub fn with_metadata(self, metadata: Value) -> Self
Set metadata
Sourcepub fn with_error(self, error_message: String) -> Self
pub fn with_error(self, error_message: String) -> Self
Mark as failed with error message
Trait Implementations§
Source§impl Clone for AuditLogEntry
impl Clone for AuditLogEntry
Source§fn clone(&self) -> AuditLogEntry
fn clone(&self) -> AuditLogEntry
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 AuditLogEntry
impl Debug for AuditLogEntry
Source§impl<'de> Deserialize<'de> for AuditLogEntry
impl<'de> Deserialize<'de> for AuditLogEntry
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 AuditLogEntry
impl RefUnwindSafe for AuditLogEntry
impl Send for AuditLogEntry
impl Sync for AuditLogEntry
impl Unpin for AuditLogEntry
impl UnwindSafe for AuditLogEntry
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,
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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