Skip to content

Commit 64e7371

Browse files
authored
fix+docs: Fix cli docs autogen and update autogenerated docs (TracecatHQ#319)
1 parent 8282bd6 commit 64e7371

File tree

70 files changed

+5660
-1926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+5660
-1926
lines changed

cli/tracecat_cli/dev.py

+26-26
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import shutil
66
import subprocess
77
import tempfile
8+
from collections import defaultdict
89
from itertools import chain
910
from pathlib import Path
1011
from typing import Any
@@ -418,6 +419,10 @@ def generate_udf_docs():
418419
## Integrations
419420
Note that the fully qualified namespace for each Integration UDF is prefixed with `integrations.`.
420421
{integrations_secrets_table}
422+
423+
## ETL Actions
424+
Note that the fully qualified namespace for each ETL UDF is prefixed with `etl.`.
425+
{etl_secrets_table}
421426
"""
422427

423428

@@ -434,31 +439,22 @@ def generate_secret_tables(
434439
registry.init()
435440

436441
# Table of core UDFs required secrets
437-
core_udfs_secrets = []
438-
integrations_secrets = []
442+
secrets = defaultdict(list)
439443
# Get UDF -> Secrets mapping
440-
for key, udf in registry.filter():
441-
match key.split("."):
442-
case ["integrations", *stem, func]:
443-
integrations_secrets.append(
444-
(
445-
".".join(stem) if stem else "-",
446-
func,
447-
", ".join(wrap(s.name, "`") for s in udf.secrets)
448-
if udf.secrets
449-
else "-",
450-
)
451-
)
452-
case ["core", *stem, func]:
453-
core_udfs_secrets.append(
454-
(
455-
".".join(stem) if stem else "-",
456-
func,
457-
", ".join(wrap(s.name, "`") for s in udf.secrets)
458-
if udf.secrets
459-
else "-",
460-
)
461-
)
444+
blacklist = {"example"}
445+
for key, udf in registry:
446+
top_level_ns, *stem, func = key.split(".")
447+
if top_level_ns in blacklist:
448+
continue
449+
secrets[top_level_ns].append(
450+
(
451+
".".join(stem) if stem else "-",
452+
func,
453+
", ".join(wrap(s.name, "`") for s in udf.secrets)
454+
if udf.secrets
455+
else "-",
456+
)
457+
)
462458

463459
# Get all secrets -> secret keys
464460
api_credentials = set()
@@ -475,10 +471,14 @@ def generate_secret_tables(
475471
header=("Secret Name", "Secret Keys"), rows=list(api_credentials)
476472
),
477473
core_udfs_secrets_table=create_markdown_table(
478-
header=("Sub-namespace", "Function", "Secrets"), rows=core_udfs_secrets
474+
header=("Sub-namespace", "Function", "Secrets"), rows=secrets["core"]
479475
),
480476
integrations_secrets_table=create_markdown_table(
481-
header=("Sub-namespace", "Function", "Secrets"), rows=integrations_secrets
477+
header=("Sub-namespace", "Function", "Secrets"),
478+
rows=secrets["integrations"],
479+
),
480+
etl_secrets_table=create_markdown_table(
481+
header=("Sub-namespace", "Function", "Secrets"), rows=secrets["etl"]
482482
),
483483
)
484484

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /auth/login
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /auth/logout
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /auth/oauth/authorize
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /auth/oauth/callback
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /auth/register
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /auth/forgot-password
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /auth/reset-password
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /auth/request-verify-token
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /auth/verify
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /health
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /webhooks/{path}/{secret}/wait
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: delete /secrets/{secret_id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /secrets/{secret_id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /users/search
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /users/me
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: delete /users/{id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: patch /users/me
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: patch /users/{id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /users/{id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /validate-workflow
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /workflow-executions/{execution_id}/cancel
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /workflow-executions
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /workflow-executions/{execution_id}/history
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /workflow-executions/{execution_id}/terminate
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /workflows/{workflow_id}/definition
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /workspaces/{workspace_id}/memberships
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /workspaces
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: delete /workspaces/{workspace_id}/memberships/{user_id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: delete /workspaces/{workspace_id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /workspaces/{workspace_id}/memberships/{user_id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /workspaces/{workspace_id}
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /workspaces/{workspace_id}/memberships
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /workspaces
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: get /workspaces/search
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: patch /workspaces/{workspace_id}
3+
---

docs/integrations/secrets_cheatsheet.mdx

+40-12
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,36 @@ description: A cheatsheet of all the secrets required by the UDFs and integratio
66
The secret keys required by each secret are listed below.
77
| Secret Name | Secret Keys |
88
| --- | --- |
9-
| `wiz` | `WIZ_API_URL`, `WIZ_AUTH_URL`, `WIZ_CLIENT_ID`, `WIZ_CLIENT_SECRET` |
10-
| `elastic` | `ELASTIC_API_KEY`, `ELASTIC_API_URL` |
11-
| `microsoft_defender_cloud` | `MICROSOFT_GRAPH_CLIENT_ID`, `MICROSOFT_GRAPH_CLIENT_SECRET`, `MICROSOFT_GRAPH_TENANT_ID` |
12-
| `datadog` | `DD_API_KEY`, `DD_APP_KEY`, `DD_REGION` |
139
| `aws_guardduty` | `AWS_ACCESS_KEY_ID`, `AWS_REGION`, `AWS_SECRET_ACCESS_KEY` |
14-
| `sentinel_one` | `SENTINEL_ONE_API_TOKEN`, `SENTINEL_ONE_BASE_URL` |
1510
| `microsoft_defender_endpoint` | `MICROSOFT_GRAPH_CLIENT_ID`, `MICROSOFT_GRAPH_CLIENT_SECRET`, `MICROSOFT_GRAPH_TENANT_ID` |
11+
| `okta` | `OKTA_API_TOKEN`, `OKTA_BASE_URL` |
1612
| `crowdstrike` | `CROWDSTRIKE_CLIENT_ID`, `CROWDSTRIKE_CLIENT_SECRET` |
17-
| `virustotal` | `VIRUSTOTAL_API_KEY` |
13+
| `slack` | `SLACK_BOT_TOKEN` |
14+
| `microsoft_defender_cloud` | `MICROSOFT_GRAPH_CLIENT_ID`, `MICROSOFT_GRAPH_CLIENT_SECRET`, `MICROSOFT_GRAPH_TENANT_ID` |
15+
| `datadog` | `DD_API_KEY`, `DD_APP_KEY`, `DD_REGION` |
1816
| `resend_api_key` | `RESEND_API_KEY` |
1917
| `openai` | `OPENAI_API_KEY` |
20-
| `slack_chatops` | `SLACK_BOT_TOKEN` |
18+
| `virustotal` | `VIRUSTOTAL_API_KEY` |
19+
| `sentinel_one` | `SENTINEL_ONE_API_TOKEN`, `SENTINEL_ONE_BASE_URL` |
20+
| `wiz` | `WIZ_API_URL`, `WIZ_AUTH_URL`, `WIZ_CLIENT_ID`, `WIZ_CLIENT_SECRET` |
21+
| `elastic` | `ELASTIC_API_KEY`, `ELASTIC_API_URL` |
22+
| `ldap` | `LDAP_BIND_DN`, `LDAP_BIND_PASS` |
2123

2224
## Core Actions
2325
Note that the fully qualified namespace for each Core Action UDF is prefixed with `core.`.
2426
| Sub-namespace | Function | Secrets |
2527
| --- | --- | --- |
26-
| extraction | extract_emails | - |
27-
| extraction | extract_ipv4_addresses | - |
28+
| - | send_email_smtp | - |
2829
| - | open_case | - |
2930
| condition | regex | - |
3031
| condition | compare | - |
3132
| condition | membership | - |
32-
| - | send_email | `resend_api_key` |
3333
| - | http_request | - |
3434
| - | ai_action | `openai` |
3535
| transform | reshape | - |
36+
| transform | filter | - |
37+
| transform | build_reference_table | - |
38+
| workflow | execute | - |
3639

3740
## Integrations
3841
Note that the fully qualified namespace for each Integration UDF is prefixed with `integrations.`.
@@ -41,18 +44,43 @@ Note that the fully qualified namespace for each Integration UDF is prefixed wit
4144
| aws.guardduty | list_guardduty_alerts | `aws_guardduty` |
4245
| microsoft_defender | list_defender_cloud_alerts | `microsoft_defender_cloud` |
4346
| wiz | list_wiz_alerts | `wiz` |
44-
| chat.slack | post_slack_message | `slack_chatops` |
45-
| chat.slack | list_slack_users | `slack_chatops` |
47+
| chat.slack | post_slack_message | `slack` |
48+
| chat.slack | list_slack_conversations | `slack` |
49+
| chat.slack | list_slack_users | `slack` |
50+
| chat.slack | tag_slack_users | `slack` |
4651
| crowdstrike | list_crowdstrike_alerts | `crowdstrike` |
4752
| crowdstrike | list_crowdstrike_detects | `crowdstrike` |
4853
| crowdstrike | update_crowdstrike_alert_status | `crowdstrike` |
4954
| crowdstrike | update_crowdstrike_detect_status | `crowdstrike` |
5055
| microsoft_defender | list_defender_endpoint_alerts | `microsoft_defender_endpoint` |
5156
| sentinel_one | list_sentinelone_alerts | `sentinel_one` |
5257
| sentinel_one | update_sentinelone_alert_status | `sentinel_one` |
58+
| sentinel_one | get_sentinelone_agents_by_username | `sentinel_one` |
59+
| sentinel_one | get_sentinelone_agents_by_hostname | `sentinel_one` |
60+
| sentinel_one | isolate_sentinelone_agent | `sentinel_one` |
61+
| sentinel_one | unisolate_sentinelone_agent | `sentinel_one` |
62+
| sentinel_one | get_sentinel_one_firewall_rule | `sentinel_one` |
63+
| sentinel_one | update_sentinel_one_firewall_rule | `sentinel_one` |
64+
| email.resend | send_email_resend | `resend_api_key` |
5365
| virustotal | analyze_url | `virustotal` |
5466
| virustotal | analyze_ip_address | `virustotal` |
5567
| virustotal | analyze_malware_sample | `virustotal` |
68+
| ldap | find_ldap_users | `ldap` |
69+
| ldap | disable_ad_user | `ldap` |
70+
| ldap | enable_ad_user | `ldap` |
71+
| okta | find_okta_users | `okta` |
72+
| okta | suspend_okta_user | `okta` |
73+
| okta | unsuspend_okta_user | `okta` |
74+
| okta | expire_okta_sessions | `okta` |
75+
| okta | list_okta_user_events | `okta` |
5676
| datadog | list_datadog_alerts | `datadog` |
5777
| elastic | list_elastic_alerts | `elastic` |
5878
| sinks | write_to_database | - |
79+
80+
## ETL Actions
81+
Note that the fully qualified namespace for each ETL UDF is prefixed with `etl.`.
82+
| Sub-namespace | Function | Secrets |
83+
| --- | --- | --- |
84+
| extraction | extract_emails | - |
85+
| extraction | extract_ipv4_addresses | - |
86+
| extraction | extract_urls | - |

docs/integrations/udfs/core_open_case.mdx

-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ _No secrets required._
3737
},
3838
"Tag": {
3939
"properties": {
40-
"is_ai_generated": {
41-
"default": false,
42-
"title": "Is Ai Generated",
43-
"type": "boolean"
44-
},
4540
"tag": {
4641
"title": "Tag",
4742
"type": "string"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: Send Email (SMTP)
3+
description: core.send_email_smtp
4+
---
5+
6+
Perform a send email action using SMTP.
7+
8+
This is the [JSONSchema7](https://json-schema.org/draft-07/json-schema-release-notes) definition for the `core.send_email_smtp` integration.
9+
10+
11+
## Secrets
12+
_No secrets required._
13+
14+
## Inputs
15+
16+
<CodeGroup>
17+
```json JSONSchema7 Definition
18+
{
19+
"additionalProperties": false,
20+
"properties": {
21+
"body": {
22+
"title": "Body",
23+
"type": "string"
24+
},
25+
"recipients": {
26+
"items": {
27+
"type": "string"
28+
},
29+
"title": "Recipients",
30+
"type": "array"
31+
},
32+
"sender": {
33+
"default": "[email protected]",
34+
"title": "Sender",
35+
"type": "string"
36+
},
37+
"subject": {
38+
"title": "Subject",
39+
"type": "string"
40+
}
41+
},
42+
"required": [
43+
"recipients",
44+
"subject",
45+
"body"
46+
],
47+
"title": "CoreSendEmailSmtp",
48+
"type": "object"
49+
}
50+
```
51+
52+
</CodeGroup>
53+
54+
## Response
55+
56+
<CodeGroup>
57+
```json JSONSchema7 Definition
58+
{
59+
"type": "object"
60+
}
61+
```
62+
63+
</CodeGroup>

0 commit comments

Comments
 (0)