mongodb_atlas_admin/api/access_tracking/
mod.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4pub mod routes;
5
6#[derive(Debug, Serialize, Default)]
7pub struct AccessHistoryOptions {
8    #[serde(rename = "authResult")]
9    /// Flag that indicates whether the response returns the successful authentication attempts only.
10    pub auth_result: Option<bool>,
11    #[serde(rename = "ipAddress")]
12    /// One Internet Protocol address that attempted to authenticate with the database.
13    pub ip_address: Option<std::net::IpAddr>,
14    #[serde(rename = "nLogs")]
15    /// Maximum number of lines from the log to return.
16    /// Range [0 .. 20000], default 20000
17    pub n_logs: Option<i16>,
18    #[serde(flatten)]
19    pub interval: Option<AccessHistoryOptionsInterval>,
20}
21
22#[derive(Debug, Serialize)]
23pub struct AccessHistoryOptionsInterval {
24    // Date and time when MongoDB Cloud begins retrieving database history.
25    pub start: DateTime<Utc>,
26    /// Date and time when to stop retrieving database history.
27    pub end: DateTime<Utc>,
28}
29
30#[derive(Debug, Deserialize)]
31#[serde(rename_all = "camelCase")]
32pub struct AccessLog {
33    /// Flag that indicates whether the response should return successful authentication attempts only.
34    pub auth_result: bool,
35    /// Database against which someone attempted to authenticate.
36    pub auth_source: String,
37    /// Reason that the authentication failed. Null if authentication succeeded.
38    pub failure_reason: Option<String>,
39    /// Unique 24-hexadecimal character string that identifies the project.
40    pub group_id: String,
41    /// Human-readable label that identifies the hostname of the target node that received the authentication attempt.
42    pub hostname: String,
43    /// Internet Protocol address that attempted to authenticate with the database.
44    pub ip_address: std::net::IpAddr,
45    /// Text of the host log concerning the authentication attempt.
46    pub log_line: String,
47    /// Date and time when someone made this authentication attempt.
48    pub timestamp: DateTime<Utc>,
49    /// Username used to authenticate against the database.
50    pub username: String,
51}