pub struct AuditLogEntry {
pub id: String,
pub timestamp: DateTime<Utc>,
pub event_type: AuditEventType,
pub subject: Option<String>,
pub resource: Option<String>,
pub action: Option<String>,
pub result: AuditResult,
pub source_ip: Option<String>,
pub tenant_id: Option<String>,
pub metadata: HashMap<String, String>,
pub message: Option<String>,
}Expand description
Audit log entry.
Fields§
§id: StringEntry ID.
timestamp: DateTime<Utc>Timestamp.
event_type: AuditEventTypeEvent type.
subject: Option<String>Subject (user/service).
resource: Option<String>Resource.
action: Option<String>Action.
result: AuditResultResult (success/failure).
source_ip: Option<String>Source IP.
tenant_id: Option<String>Tenant ID.
metadata: HashMap<String, String>Additional metadata.
message: Option<String>Message.
Implementations§
Source§impl AuditLogEntry
impl AuditLogEntry
Sourcepub fn new(event_type: AuditEventType, result: AuditResult) -> Self
pub fn new(event_type: AuditEventType, result: AuditResult) -> Self
Create a new audit log entry.
Sourcepub fn with_subject(self, subject: String) -> Self
pub fn with_subject(self, subject: String) -> Self
Set subject.
Sourcepub fn with_resource(self, resource: String) -> Self
pub fn with_resource(self, resource: String) -> Self
Set resource.
Sourcepub fn with_action(self, action: String) -> Self
pub fn with_action(self, action: String) -> Self
Set action.
Sourcepub fn with_source_ip(self, ip: String) -> Self
pub fn with_source_ip(self, ip: String) -> Self
Set source IP.
Sourcepub fn with_tenant_id(self, tenant_id: String) -> Self
pub fn with_tenant_id(self, tenant_id: String) -> Self
Set tenant ID.
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
Add metadata.
Sourcepub fn with_message(self, message: String) -> Self
pub fn with_message(self, message: String) -> Self
Set 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 UnsafeUnpin 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,
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