INNER CODE UNIT · Python
get_retention
caipe-io/ai-platform-engineering · ai_platform_engineering/audit_service/main.py:399
async def get_retention(request: Request) -> dict[str, Any]:
store = request.app.state.audit_store
current_settings: Settings = request.app.state.audit_settings
if isinstance(store, LocalAuditStore):
return {
"backend": "local",
"retention_days": current_settings.local_retention_days,
"configurable": False,
"note": "Set AUDIT_SERVICE_LOCAL_RETENTION_DAYS and restart to change.",
}
if isinstance(store, S3AuditStore):
days = await asyncio.to_thread(store.get_s3_retention_days)
return {
"backend": "s3",
"retention_days": days,
"configurable": True,
"bucket": current_settings.s3_bucket,
"prefix": current_settings.s3_prefix,