Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-db/src/audit-log-db.ts
2498 views
1
/**
2
* Copyright (c) 2024 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import { AuditLog } from "@gitpod/gitpod-protocol/lib/audit-log";
8
9
export const AuditLogDB = Symbol("AuditLogDB");
10
11
export interface AuditLogDB {
12
/**
13
* Records an audit log entry.
14
*
15
* @param logEntry
16
*/
17
recordAuditLog(logEntry: AuditLog): Promise<void>;
18
19
/**
20
* Lists audit logs.
21
*
22
* @param organizationId
23
* @param params
24
*/
25
listAuditLogs(
26
organizationId: string,
27
params?: {
28
from?: string;
29
to?: string;
30
actorId?: string;
31
action?: string;
32
pagination?: {
33
offset?: number;
34
// must not be larger than 250, default is 100
35
limit?: number;
36
};
37
},
38
): Promise<AuditLog[]>;
39
40
/**
41
* Purges audit logs older than the given date.
42
*
43
* @param before ISO 8601 date string
44
*/
45
purgeAuditLogs(before: string, organizationId?: string): Promise<number>;
46
}
47
48