CLI automation
This topic describes the CLI automation section, the information it provides, and how to perform an automated Transporter package execution.
The CLI automation section allows you to enable the Command Line Interface (CLI) Service and gives you all the necessary information and tools to create an automated and scheduled Transporter package execution via CLI.
To access the CLI automation section, access the System Administration area of the desired Platform and click on the CLI automation tile. This will take you to the CLI automation page.
In the CLI automation page, you can see information about the CLI Service at the top of the page and how to perform an automated execution of a package below the instructions.
Enabling the CLI service
To enable the CLI service, click on the "ENABLE SERVICE" button in the upper right corner. The following information is displayed:
- Status. This label displays the status of the CLI Service, which can be enabled or disabled
- Token Key. This label displays the token key needed as a parameter in the CLI command. The token key appears only when you enable the service
Disabling the CLI service also revokes the token key. A new token key is generated every time you disable and enable the service.
- User. This label displays the Account name of the user that has enabled the CLI service
- Created. This label displays the date and time when the CLI service was enabled in the following format: DD/MM/AAAA, HH:SS
Execute Transporter packages from command-line
You can execute Transporter packages by using the following command-line shells:
- MS Windows Powershell
- Windows Command Line (CMD)
- Unix Shell
Parameters
The parameters needed for the commands are listed in the table below. They are the same for all command-line shells.
Parameter | Details |
<hostname> |
URL of the target Platform |
<token_key> | Security token key that is randomly generated every time the CLI service is enabled |
<package_name> | Name of the Transporter package that will be executed by the script |
<target_dbName> | (Optional) Name of the target Data model that the Transporter package will overwrite |
If you do not provide the <target_dbName> parameter, the Transporter package will automatically update the target Data model specified in the package.
Execute a package from the MS Windows Powershell
To execute a package from the MS Windows Powershell, proceed as follows:
- Download the "Board-Transporter.psm1" module by clicking on the "DOWNLOAD MODULE" and import it by following these steps:
- Create a folder named "Board-Transporter" in one of your PS module paths.
To obtain the list of your PS Module Paths, use the command $Env:PSModulePath (for example: C:\Program Files\WindowsPowerShell\Modules\Board-Transporter) - Copy the downloaded Board-Transporter.psm1 file into the newly created folder named "Board-Transporter"
- From the MS Windows PowerShell, run the following import command: Import-Module Board-Transporter
- Create a folder named "Board-Transporter" in one of your PS module paths.
- Enter the following command in the MS Windows Powershell:
Board-Transporter -HostName "<hostname>" -Token "<token_key>" -PackageName "<package_name>" -TargetDbName "<target_dbName>"
Execute a package from the Windows Command Line
To execute a package from the Windows Command Line (CMD), enter the following command in the Windows CMD:
Curl -X POST "<hostname>/api/AutomationManager/executeCommand" -H "board_token_type: 0" -H "board_token_auth: <token_key>" -H "content-type: application/json" -d"{\"packageName\":\"<package_name>\",\"targetDb\":\"<target_dbName>\"}"
Execute a package from the Unix Shell
To execute a package from the Unix Shell, enter the following command in the Unix Shell:
Curl -X POST '<hostname>/api/AutomationManager/executeCommand' -H 'board_token_type: 0' -H 'board_token_auth: <token_key>' -H 'content-type: application/json' -d '{"packageName":"<package_name>","targetDb":"<target_dbName>"}'
You can create script files with the commands above and schedule their execution in order to create a fully automated Transporter package execution.
Make sure the Transporter package that will be executed via CLI is located in the target Platform.
If you disable and enable the CLI service again, you must update existing scripts with the newly generated token key.