Commit 11f1d64
Add an audit event reference generator (#60290)
* Add an audit event reference generator
Closes #5044
Closes #10350
This change adds a generator for audit event reference documentation
based on Web UI audit event formatters and, if available, test fixtures.
Previous attempts to generate an audit event reference drew from the
Teleport source using `AuditEvent` declarations (#13615) and naming
conventions (#38344), but inconsistencies within the source meant that
the resulting generator was inadequate. The Web UI source files
represent the most complete set of source data we have on audit event
schemas.
Implementation details:
- If an event includes a fixture, use that as an example of its schema.
For any event formatter with no test fixture, include the event, type,
code, and description in the reference guide using data from the
formatter, but don't include an example.
- If one event type includes multiple possible codes, document each code
in an H3 section.
- Ignore instances of the same code beyond the first occurrence.
Co-authored-by: Rafał Cieślak <[email protected]>
* Get rid of `any` in types
The events map did not define what types it stores, so TypeScript
defaulted it to Map<any, any>. After adjusting this type, it turned out
that there were many functions with worked on Event but were actually
given ReferencePageEventData, so I changed their signatures too.
Types usually start with upper case, hence ReferencePageEventData and
not referencePageEventData.
The `as` in `Object.keys(formatters) as Array<keyof Formatters>` was
not necessary, as TypeScript correctly infers the type here.
* Add more context to the README
* Add shorthand command to build and gen reference
* Check audit event reference docs in CI
Add Make targets for running and checking the audit event reference
docs. Add a step to the GitHub Actions job that runs Web UI linters to
check the audit event reference docs.
---------
Co-authored-by: Rafał Cieślak <[email protected]>1 parent 0044cb8 commit 11f1d64
File tree
11 files changed
+8043
-1
lines changed- .github/workflows
- docs/pages/reference
- web/packages
- build/vite
- teleport
- src/services/audit/gen-event-reference
11 files changed
+8043
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1982 | 1982 | | |
1983 | 1983 | | |
1984 | 1984 | | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
1985 | 2000 | | |
1986 | 2001 | | |
1987 | 2002 | | |
1988 | 2003 | | |
1989 | 2004 | | |
| 2005 | + | |
0 commit comments