The generate-outputs command generates context paths automatically for an integration, using an example file.
Generates outputs for an integration. This command generates context paths automatically from an example file directly into an integration YAML file. Also supports converting JSON format to Cortex XSOAR entry context YAML format.
Argument | Description |
---|---|
-c, --command | Command name (for example |
-j, --json | A JSON file path. If not specified, the script will wait for user input in the terminal. |
-p, --prefix | Output prefix such as |
-o, --output | Output file path. If not specified, prints to stdout. |
--interactive | If passed, then for each output field user are asked interactively to enter the description. By default, interactive mode is disabled. |
-d, --descriptions | A JSON or a path to a JSON file, mapping field names to their descriptions. |
-i, --input | Path of the YAML file (outputs are inserted here in place) - used for context from examples. |
-e, --examples | For integrations: The path for a file containing examples. Each command should be in a separate line or a comma-separated list of commands. For scripts: The script example surrounded by single quotes. For example: |
--insecure | Skip certificate validation when authorizing Cortex XSOAR or Cortex XSIAM. |
--ai | AI description generation - *Experimental* a new way to use GPT-like transformers to generate descriptions from context paths. |
The output of the command is written in the input file (in place).
demisto-sdk generate-outputs -i Packs/MyPack/Integrations/MyInt/MyInt.yml -e Packs/MyPack/Integrations/MyInt/command_example.txt
Before the command is run:
commands: ... name: guardicore-get-incident outputs: [] ...
After the command is run:
commands: ... name: guardicore-get-incident outputs: - contextPath: Guardicore.Incident._cls description: '' type: String - contextPath: Guardicore.Incident.affected_assets.ip description: '' type: String ...
demisto-sdk generate-outputs -c jira-get-ticket -p Jira.Ticket -j path/to/valid.json
If the valid.json file contains:
{ "id": 100, "title": "do something title", "created_at": "2019-01-01T00:00:00" }
The generate-outputs command prints to stdout:
arguments: [] name: jira-get-ticket outputs: - contextPath: Jira.Ticket.id description: '' type: Number - contextPath: Jira.Ticket.title description: '' type: String - contextPath: Jira.Ticket.created_at description: '' type: Date
To use the --ai
flag you need to register with ai21.com and obtain an API key. Replace KEYHERE
in the examples below with your API key. Don't share your key with anyone. Follow the terms and guidelines of the service: https://studio.ai21.com/terms-of-use https://studio.ai21.com/docs/responsible-use/
With JSON-to-Outputs
The --ai
flag can be used together with the --json
flag to add descriptions to the generated outputs from the json-to-outputs flow, such as: AI21_KEY=KEYHERE demisto-sdk generate-outputs --json test.json -c "test-command" -p "somePrefix" --ai -o out.yml
.
With examples
The --ai
flag can be used together with the --examples
flag to add descriptions to the generated outputs from the examples flow, such as: AI21_KEY=KEYHERE demisto-sdk generate-outputs --examples ./examples_test -i ~/examples.yml --ai
.
Standalone
You can also use the flag on a regular integration YAML file such as: AI21_KEY=KEYHERE demisto-sdk generate-outputs -i input.yml --ai -o outout.yml
.