Overview
As of v48.1 of the IBM SOAR Python packages, resilient-sdk
now has an init
feature to create a settings file that can be referenced by other SDK subcommands. For an overview of the usage, see https://ibmresilient.github.io/resilient-python-api/pages/resilient-sdk/resilient-sdk.html#init
Example Use Case: create and use a settings file to fill in values for setup.py and license
To use init
to create a settings file, run resilient-sdk init
which creates a settings file with the default path: ~/.resilient/.sdk_settings.json.
Next, open this file and edit any fields. For example, manually supply the values for the license name, author, author email, url, long description in the codegen
section, as well as a full MIT license body:
"codegen": {
"setup": {
"license": "MIT",
"author": "Priya Sapra",
"author_email": "priya@example.com",
"url": "https://www.ibm.com",
"long_description": "Enter a long description, including the key features of the App. \\\nMultiple continuation lines are supported with a backslash. Line breaks are supported too:\n<br>- This will be rendered like a list\n<br>- once the App is installed in SOAR"
},
"license_content": "Copyright © IBM Corporation 2023\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions: \n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software. \n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE."
}
Note that the line breaks must be escaped.
With this settings file created at the default file path, ~/.resilient/.sdk_settings.json, codegen
can now reference it and fill in the provided values. To do this, run
resilient-sdk codegen -p my_app
The results will fill in the setup.py (note that escaped characters will get rendered) and it will create a LICENSE file under my_app/my_app/ with this example MIT license written out.
Alternatively, the --settings
option can be provided to specify a different file path to the settings JSON, if preferred.
To further simplify this process, utilize the optional arguments to provide specific file path, license name, author, author email, and url with the init
subcommand:
reslient-sdk init -f /Users/priya/my_app/.my_sdk_settings.json --license "MIT" --author "Priya Sapra" --author_email priya@example.com --url https://www.ibm.com
The resulting /Users/priya/my_app/.my_sdk_settings.json file will already have the codegen
values assigned, reducing the number of fields to manually update.
Other uses:
The --settings
flag can also be used with docgen
and validate
. For more information, please visit https://ibm.biz/soar-python-docs