Skip to content

Commit 59e5681

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Add the audit log entitlements to backend_info (#42087)
GitOrigin-RevId: 1442f24b8f7cebe6868b663fc231b93660a070cd
1 parent 50e29d6 commit 59e5681

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

crates/common/src/types/backend_info.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct BackendInfo {
2727
pub streaming_export_enabled: Option<bool>,
2828
pub provision_concurrency: Option<i32>,
2929
pub log_streaming_enabled: Option<bool>,
30+
pub audit_log_retention_days: Option<u64>,
3031
}
3132

3233
#[cfg(any(test, feature = "testing"))]
@@ -42,6 +43,7 @@ impl Default for BackendInfo {
4243
streaming_export_enabled: Some(false),
4344
provision_concurrency: Some(DEFAULT_PROVISION_CONCURRENCY),
4445
log_streaming_enabled: Some(false),
46+
audit_log_retention_days: Some(0),
4547
}
4648
}
4749
}

crates/model/src/backend_info/types.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub struct BackendInfoPersisted {
2727
pub streaming_export_enabled: bool,
2828
pub provision_concurrency: i32,
2929
pub log_streaming_enabled: bool,
30+
pub audit_log_retention_days: u64,
3031
}
3132

3233
impl From<BackendInfoPersisted> for BackendInfo {
@@ -41,6 +42,7 @@ impl From<BackendInfoPersisted> for BackendInfo {
4142
streaming_export_enabled: Some(bi.streaming_export_enabled),
4243
provision_concurrency: Some(bi.provision_concurrency),
4344
log_streaming_enabled: Some(bi.log_streaming_enabled),
45+
audit_log_retention_days: Some(bi.audit_log_retention_days),
4446
}
4547
}
4648
}
@@ -59,6 +61,7 @@ impl From<BackendInfo> for BackendInfoPersisted {
5961
.provision_concurrency
6062
.unwrap_or(DEFAULT_PROVISION_CONCURRENCY),
6163
log_streaming_enabled: bi.log_streaming_enabled.unwrap_or_default(),
64+
audit_log_retention_days: bi.audit_log_retention_days.unwrap_or_default(),
6265
}
6366
}
6467
}
@@ -85,6 +88,8 @@ pub struct SerializedBackendInfo {
8588
log_streaming_enabled: bool,
8689
project_name: Option<String>,
8790
project_slug: Option<String>,
91+
#[serde(default)]
92+
audit_log_retention_days: i64,
8893
}
8994

9095
impl From<BackendInfoPersisted> for SerializedBackendInfo {
@@ -104,6 +109,7 @@ impl From<BackendInfoPersisted> for SerializedBackendInfo {
104109
log_streaming_enabled: b.log_streaming_enabled,
105110
project_name: b.project_name,
106111
project_slug: b.project_slug,
112+
audit_log_retention_days: (b.audit_log_retention_days as i64),
107113
}
108114
}
109115
}
@@ -123,6 +129,7 @@ impl TryFrom<SerializedBackendInfo> for BackendInfoPersisted {
123129
let log_streaming_enabled = o.log_streaming_enabled;
124130
let project_name = o.project_name;
125131
let project_slug = o.project_slug;
132+
let audit_log_retention_days = o.audit_log_retention_days as u64;
126133

127134
Ok(Self {
128135
team,
@@ -134,6 +141,7 @@ impl TryFrom<SerializedBackendInfo> for BackendInfoPersisted {
134141
streaming_export_enabled,
135142
provision_concurrency,
136143
log_streaming_enabled,
144+
audit_log_retention_days,
137145
})
138146
}
139147
}
@@ -177,6 +185,7 @@ mod tests {
177185
streaming_export_enabled: false,
178186
provision_concurrency: 1740011963,
179187
log_streaming_enabled: true,
188+
audit_log_retention_days: 0,
180189
}
181190
);
182191
}

0 commit comments

Comments
 (0)