Package: iap-cli
itential-iap-cliLightweight CLI tool to simplify the process of interacting with the Itential Automation Platform.This is an early alpha release. It is incomplete and will change.The CLI tool is built usingTyperandTyper-CLI. It usesiap-sdkfor any API calls to IAP.This package was written for Itential Automation Platform 2023.1.InstallationMake sure you have a supported version of Python installed, and then create and activate a virtual environment:python-mvenvvenvsource/venv/bin/activate
python-mpipinstall--upgradepipYou can install the iap_cli from Pypi as follows:pipinstalliap-cliOr you can install it from source as follows:gitclonehttps://github.com/awetomate/itential-iap-cli.gitcditential-iap-cli
python-mpipinstall-rrequirements.txt
python-mpipinstall-e.VerifyVerify that the CLI tool got installed correctly:iapversionIf the 'iap' command does not get recognised, try adding your current path to the Python path as follows:exportPYTHONPATH=`pwd`Install autocompletion for your shellInstall the autocompletion for your shell using the following command and then restart your terminal.iap--install-completionFirst Steps / SetupUse the --help optionUse the --help option to see all available command completions for the current position. In most cases, sending an incomplete command will also show the help page.
If you have the autocompletion installed, you can just hit TAB-TAB, which will keep autocompleting and showing the available options.iap--helpUsage: iap [OPTIONS] COMMAND [ARGS]...

 CLI tool for interacting with Itential.

╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                                                                                         │
│ --show-completion             Show completion for the current shell, to copy it or customize the installation.                                                  │
│ --help                        Show this message and exit.                                                                                                       │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ config                  Manage configurations for the Itential CLI app.                                                                                         │
│ get                     Get resources from your IAP server.                                                                                                     │
│ restart                 Restart resources in your IAP server.                                                                                                   │
│ version                                                                                                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯iapget--helpUsage: iap get [OPTIONS] COMMAND [ARGS]...

 Get resources from your IAP server.

╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                                                                                                     │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ adapters                       Get the health of all adapters for one or more servers.                                                                          │
│ applications                   Get the health of all applications for one more servers.                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯1. Configure username and passwordDefine the username and password that will be used to connect to the IAP servers. The credentials will be stored in a .env file in your user profile.
The CLI tool will use these credentials for all API calls.iapconfigaddcredentialsProvide the user credentials to use to authenticate with the Itential servers.
The credentials will be stored in the /Users/your_user/.iap_cli/.env file.
Username: your_username
Password:2. Add servers to your inventoryAdd servers and/or clusters to an inventory file. An inventory.json file will created in your user profile.Add individual server:iapconfigaddserverProvide a friendly name for the server (will be used for all CLI operations) and an FQDN/IP address.
The server will be stored in the /Users/your_user/.iap_cli/inventory.json file.
Server Friendly Name: dev1
Server FQDN or IP: iap1-dev.domain.comAdd a server cluster:iapconfigaddclusterProvide a friendly name for the cluster (will be used for all CLI operations) and a comma-separated list of FQDNs/IP addresses.
The cluster will be stored in the /Users/your_user/.iap_cli/inventory.json file.
Cluster Friendly Name: devAll
Server FQDNs or IP addresses: iap1-dev.domain.com,iap2-dev.domain.com,iap3-dev.domain.comThe commands above will create an inventory.json file that looks like this:{"dev1":"iap1-dev.domain.com","dev2":"iap2-dev.domain.com","dev3":"iap3-dev.domain.com","devAll":["iap1-dev.domain.com","iap2-dev.domain.com","iap3-dev.domain.com"]}If you have the autocompletion installed, you can just hit TAB-TAB, which will keep autocompleting and showing the available server/cluster names.iaprestartapplicationAGManagerdev
dev1dev2dev3devAllYou can also modify the inventory.json file directly.Available Operationsconfigoperationdescriptioniap config add credentialsCreates/updates a .env file to store the username and password to use for the API calls to IAPiap config add clusterCreates/updates an inventory.json file to store the server connections in.Cluster Friendly Name:Friendly/short name to identify the cluster. You will use this value for all CLI operations. E.g. devAll or PROD or cluster1Server FQDNs or IP addresses:A comma-separated string containing all server FQDNs or IP addresses. E.g. iap1-dev.domain.com,iap2-dev.domain.com,iap3-dev.domain.comiap config add serverCreates/updates an inventory.json file to store the server connections in.Server Friendly Name:Friendly/short name to identify the server. You will use this value for all CLI operations. E.g. dev1 or PROD1 or server1Server FQDNs or IP addresses:The FQDN or IP address of the server. E.g. iap1-dev.domain.comgetoperationdescriptioniap get adaptershostGet a list and health status for all adapters on the target server/clusterhost: Use the friendly name of the server/cluster as the target host.Examples:iap get adapters dev1iap get adapters devAlliap get applicationshostGet a list and health status for all applications on the target server/clusterhost: Use the friendly name of the server/cluster as the target host.Examples:iap get applications dev1iap get applications devAllIf you have the autocompletion installed, you can just hit TAB-TAB, which will keep autocompleting and showing the available server/cluster names.restartoperationdescriptioniap restart adapternamehostStart (if adapter is stopped) or restart an adapter in a server or a cluster of servers.name: Enter the name of the adapter to start/restart(case-sensitive!)host: Use the friendly name of the server/cluster as the target host.Examples:iap restart adapter ServiceNow devAlliap restart adapter Email dev1NOTE: the adapter name is case-sensitive!iap restart applicationnamehostStart (if application is stopped) or restart an application in a server or a cluster of servers.name: Enter the name of the application to start/restart. Use autocompletion or use --help to see the list of available application names.host: Use the friendly name of the server/cluster as the target host.Examples:iap restart application AGManager devAlliap restart application Jst dev1If you have the autocompletion installed, you can just hit TAB-TAB, which will keep autocompleting and showing the available server/cluster names and Application names (this does not work for adapter names).versionoperationdescriptioniap versionDisplays the CLI app version.