1 | |
2 |
|
3 | import * as wmill from "windmill-client" |
4 |
|
5 | |
6 | wmill.OpenAPI.interceptors.response.use(async (response) => { |
7 | if (!response.ok) { |
8 | throw new Error(`${response.status} ${await response.text()}`) |
9 | } |
10 | return response |
11 | }) |
12 |
|
13 | |
14 | * List Audit Logs |
15 | * List the workspace's audit logs, optionally filtered by user, operation, resource and time range. Requires a workspace admin. |
16 | */ |
17 | export async function main( |
18 | username: string | undefined, |
19 | operation: string | undefined, |
20 | resource: string | undefined, |
21 | action_kind: "any" | "Create" | "Update" | "Delete" | "Execute" = "any", |
22 | after: string | undefined, |
23 | before: string | undefined, |
24 | page: number | undefined, |
25 | per_page: number | undefined |
26 | ) { |
27 | return await wmill.AuditService.listAuditLogs({ |
28 | workspace: wmill.getWorkspace(), |
29 | username: username || undefined, |
30 | operation: operation || undefined, |
31 | resource: resource || undefined, |
32 | actionKind: !action_kind || action_kind === "any" ? undefined : action_kind, |
33 | after: after || undefined, |
34 | before: before || undefined, |
35 | page: page ?? undefined, |
36 | perPage: per_page ?? undefined, |
37 | }) |
38 | } |
39 |
|