Skip to main content

asana/model/
audit_log_event.rs

1use serde::{Serialize, Deserialize};
2use super::{
3    AuditLogEventActor, AuditLogEventContext, AuditLogEventDetails, AuditLogEventResource,
4};
5/**An object representing a single event within an Asana domain.
6
7Every audit log event is comprised of an `event_type`, `actor`, `resource`, and `context`. Some events will include additional metadata about the event under `details`. See our [currently supported list of events](/docs/audit-log-events#supported-audit-log-events) for more details.*/
8#[derive(Debug, Clone, Serialize, Deserialize, Default)]
9pub struct AuditLogEvent {
10    ///The entity that triggered the event. Will typically be a user.
11    pub actor: AuditLogEventActor,
12    ///The context from which this event originated.
13    pub context: AuditLogEventContext,
14    ///The time the event was created.
15    pub created_at: chrono::DateTime<chrono::Utc>,
16    ///Event specific details. The schema will vary depending on the `event_type`.
17    pub details: AuditLogEventDetails,
18    ///The category that this `event_type` belongs to.
19    pub event_category: String,
20    ///The type of the event.
21    pub event_type: String,
22    ///Globally unique identifier of the `AuditLogEvent`, as a string.
23    pub gid: String,
24    ///The primary object that was affected by this event.
25    pub resource: AuditLogEventResource,
26}
27impl std::fmt::Display for AuditLogEvent {
28    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
29        write!(f, "{}", serde_json::to_string(self).unwrap())
30    }
31}