The purpose of the AIP Console Tools CLI is to provide methods to start Application analysis without needing to interact directly with the AIP Console UI, by leveraging its REST API.
The CLI can create new applications, deliver source code and run application analysis.
Before using the CLI, you will need a JRE or JDK, version 8 or above. You can use either a JVM provided by Oracle, AdoptOpenJDK or other validated JVMs (like Amazon Corretto, Azul Zulu, Eclipse OpenJ9, etc.)
You will also need the following :
- An installation of AIP Console that is accessible and configured.
- An API Token for the user that will run the CLI ( check here for details on obtaining a token)
- Prepare your source code in one of the two following ways :
- As a zip or tar.gz archive that will be uploaded to AIP Console
- As a relative path, pointing to content in the Source Folder location (SFL) defined in AIP Console like below :
These options can be updated when on-boarding a version using either
- Add Version command
- Deliver Version command
The enabled options will be added to the existing default ones: Global Assessment and ** Function Points measurement**. To Enable/Disable Data safety investigation or Blueprint and Security assessment you will need to display the help for dedicated command for more details.
The Export command allows you to export items listed below to a dedicated file. When to use this command:
- when you plan to import these settings to V2 AIP Console version.
java -jar .\aip-console-tools-cli.jar export --apikey="valid-Api-key" -s "server-url" --appList="Applications to be exported: semicolon-separated string list" -f="full path to the exported results file"This tool will report all the applications that can be exported compared to the list provided in the appList argument. The amount of applications to export in one command is limited to 5 at a time.
- All settings in the admin space
- All domains with their contents (including applications)
- All available exclusion patterns
For any of the command line listed bellow, you can use --verbose argument to decide whether to display API log information or not.
To create a new application,
- You also optionally have the possibility to decide whether the application should keep the delivered version history or not: set --no-version-history argument to match your requirement.
- Whether or not to display log information on screen by setting --verbose argument to either true or false.
Important note
- When an application is created without the deliveries history then the source code should be located the SFL sub-folders. This meant no file will not be accepted, and the path provided for versions must be SFL relative path.
run the following :
java -jar .\aip-console-tools-cli.jar new -n "my app" --apikey="BYxRnywP.TNSS0gXt8GB2v7oVZCRHzMspITeoiT1Q" --verbose=false --no-version-history=falseThis will create a new application "my app" on my AIP Console instance at localhost:8081 using my API Key. The
complete deliveries history will be kept and the API log information will not be displayed.
To add a new version and analyze its source code, have a ZIP archive file and use the following command :
java -jar .\aip-console-tools-cli.jar add --apikey="BYxRnywP.TNSS0gXt8GB2v7oVZCRHzMspITeoiT1Q" -n "my app" -f ./source.zip --verbose=falseIt will upload the source.zip file, create a new version for the application "my app" and run an analysis on this version. NOTE If your application already has versions, this command will clone the previous version configuration to run the analysis on the new source code.
- The API log information will not be displayed
To deliver a new version, without running the analysis, you can use the following command :
java -jar .\aip-console-tools-cli.jar deliver --apikey="BYxRnywP.TNSS0gXt8GB2v7oVZCRHzMspITeoiT1Q" -n "my app" -f ./source.zip --verbose=false --set-as-current=trueIt will upload the source.zip file, and create a new version for the application "my app"
- The API log information will not be displayed
- The version will be used as current and ready to analyze
To run an analysis on the latest delivered version, you can use the following command :
java -jar .\aip-console-tools-cli.jar analyze --apikey="BYxRnywP.TNSS0gXt8GB2v7oVZCRHzMspITeoiT1Q" -n "my app" --verbose=falseIt will retrieve the latest version of the application "my app", mark that version as current if it isn't, and start an analysis job, without snapshot.
- The API log information will not be displayed
To deliver a new version using a relative folder path, with source code already updated on the AIP Node server, you can use the following command :
java -jar .\aip-console-tools-cli.jar deliver --apikey="BYxRnywP.TNSS0gXt8GB2v7oVZCRHzMspITeoiT1Q" -n "my app" -f "my_app_sources/"It will not upload source code, but it will use the source on AIP Node inside the SourceFolderLocation/my_app_sources to create a new Version.
When running the CLI, you must specify a command to be run. The list of commands is :
CreateApplicationornewto create an application on AIP ConsoleAddVersionoraddto create a new version and analyze itDeliverto create a new version without running an analysisAnalysisoranalyzeto run an analysis on the current version
Each commands has a --help parameter, providing a list of all parameters available.
Below, is a detail of all available parameters for each commands, and how it affects the CLI.
alias: new
This command is used to create new applications directly from the CLI from an application name.
The available options are :
-nor--name(required) : specify the name of the application to create
--node-name(optional) : specify the name of an AIP Node on which the application will be create. default : Automatically selected by AIP Console--domain-name(optional) : specify a domain name to associate with the application to create. default: No domain is set for the application.--no-version-history(optional): If true then no history will be kept for delivered sources.--verbose(optional): Whether the command log should be output to the console or not, defaulted to true--server-urlor-s: Specify the URL to your AIP Console server. default : localhost:8081--apikeyor--apikey:env(either is required) : the API Key to log in to AIP Console OR the environment variable containing the key--timeout(optional) : Time in seconds before calls to AIP Console time out. default : 90--user(optional) (legacy) : Specify a username to log in. Requires passing the user's password in the--apikeyparameter. default : none
alias: add
This command is used to deliver a new version of an application to AIP Console, run an analysis on it and create a snapshot.
The available options are :
--app-nameor-n(required): The application name.--app-guidor-a(optional): The application GUID. Can replace the application name parameter.--fileor-f(required): The path to the source code archive (in ZIP or TAR.GZ format) to upload.--auto-create(optional): Enables automatic creation of application on AIP Console if the application with the given name doesn't exists.--no-clone,--no-rescan,--new-configuration` (optional): Disables cloning a previous version when creating this new version. This is the default behaviour when no version exists for the given application.--version-nameor-v(option): The name of the version to create. default:vYYMMDD.hhmmss, based on current date and time.--verbose(optional): Whether the command log should be output to the console or not, defaulted to true--snapshot-name(option) The name of the snapshot to generate, default will be based on the date and time--enable-security-dataflow(optional): Enables the Security Dataflow objective for this version. Has no impact when cloning a version.--process-imaging(optional): Sharing data with the configured Imaging instance linked to AIP Console.--backupor-b(optional): Enables backup creation before delivering a new version.--backup-name(optional): Specify a name for the backup. Requires the backup parameter to be passed. * default*:--node-name(optional) : specify the name of an AIP Node on which the application will be create. Has no effect if--auto-createis not passed or if application has already been created. default : Automatically selected by AIP Console--domain-name(optional) : specify a domain name to associate with the application to create. Has no effect if--auto-createis not passed or if application has already been created. default: No domain is set for the application.--server-urlor-s: Specify the URL to your AIP Console server. default : localhost:8081--apikeyor--apikey:env(either is required) : the API Key to log in to AIP Console OR the environment variable containing the key--timeout(optional) : Time in seconds before calls to AIP Console time out. default : 90--user(optional) (legacy) : Specify a username to log in. Requires passing the user's password in the--apikeyparameter. default : none--consolidationor--upload-application(optional) : When sets to false, this prevents from consolidating snapshot or from publishing application to the Health dashboard. default : false--module-option(optional) Generates a user defined module option forr either technology module or analysis unit module. Possible value is one of: full_content, one_per_au, one_per_techno--exclude-patternsor-exclude: File patterns to exclude in the delivery, the pattern needs to follow the syntax of glob patterns--exclusion-rules: (Optional) case sensitive. Project's exclusion rules, separated with comma and no space.
example--exclusion-rules= " EXCLUDE_EMPTY_PROJECTS,PREFER_FULL_DOT_NET_TO_BASIC_DOT_NET_WEB,EXCLUDE_TEST_CODE"
To get the full list do run help on this command (deliver --help).
REMARKS: Following exclusion rules are to be used in collaboration with the JeeFileDiscoverer extension EXCLUDE_JAVA_FILES_WHEN_A_FULL_JEE_PROJECT_EXISTS, EXCLUDE_JAVA_FILES_WITH_AN_INCOMPLETE_PACKAGE, EXCLUDE_JAVA_FILES_WITH_AN_UNNAMED_PACKAGE, EXCLUDE_WEB_JSP_PROJECT_WHEN_JAVA_FILES_EXISTS_FOR_THE_SAME_WEB_XML_FILE, EXCLUDE_JAVA_FILES_PROJECT_LOCATED_INSIDE_OTHER_JAVA_FILES_PROJECT;
NOTE: When creating a version, if a previous version exists, it's configuration will be cloned to the new version, but the new source will be used for analysis.
This command is used to deliver a new version of an application to AIP Console. It doesn't marks that version as current by default and won't run an analysis.
The available options are :
--app-nameor-n(required): The application name.--fileor-f(required): The path to the source code archive (in ZIP or TAR.GZ format) to upload.--auto-create(optional): Enables automatic creation of application on AIP Console if the application with the given name doesn't exists.--no-clone,--no-rescan,--new-configuration` (optional): Disables cloning a previous version when creating this new version. This is the default behaviour when no version exists for the given application.--version-nameor-v(optional): The name of the version to create. default:vYYMMDD.hhmmss, based on current date and time.--verbose(optional): Whether the command log should be output to the console or not, defaulted to true--exclude-patternsor-exclude: File patterns to exclude in the delivery, the pattern needs to follow the syntax of glob patterns--exclusion-rules: (Optional) case sensitive. Project's exclusion rules, separated with comma and no space.
example--exclusion-rules= " EXCLUDE_EMPTY_PROJECTS,PREFER_FULL_DOT_NET_TO_BASIC_DOT_NET_WEB,EXCLUDE_TEST_CODE"
To get the full list do run help on this command (deliver --help).
REMARKS: Following exclusion rules are to be used in collaboration with the JeeFileDiscoverer extension EXCLUDE_JAVA_FILES_WHEN_A_FULL_JEE_PROJECT_EXISTS, EXCLUDE_JAVA_FILES_WITH_AN_INCOMPLETE_PACKAGE, EXCLUDE_JAVA_FILES_WITH_AN_UNNAMED_PACKAGE, EXCLUDE_WEB_JSP_PROJECT_WHEN_JAVA_FILES_EXISTS_FOR_THE_SAME_WEB_XML_FILE, EXCLUDE_JAVA_FILES_PROJECT_LOCATED_INSIDE_OTHER_JAVA_FILES_PROJECT;--auto-discover: will discover new technologies and install new extensions during rescan, to disable when run consistency check--enable-security-dataflow(optional): Enables the Security Dataflow objective for this version. Has no impact when cloning a version.--backupor-b(optional): Enables backup creation before delivering a new version.--backup-name(optional): Specify a name for the backup. Requires the backup parameter to be passed. * default*:--node-name(optional) : specify the name of an AIP Node on which the application will be create. Has no effect if--auto-createis not passed or if application has already been created. default : Automatically selected by AIP Console--domain-name(optional) : specify a domain name to associate with the application to create. Has no effect if--auto-createis not passed or if application has already been created. default: No domain is set for the application.--server-urlor-s(optional): Specify the URL to your AIP Console server. default : localhost:8081--apikeyor--apikey:env(either is required) : the API Key to log in to AIP Console OR the environment variable containing the key--timeout(optional) : Time in seconds before calls to AIP Console time out. default : 90--user(optional) (legacy) : Specify a username to log in. Requires passing the user's password in the--apikeyparameter. default : none
alias: analyze
This command is use to run an analysis on a version.
The available options are :
--app-nameor-n(required): The application name.--snapshotor-S(optional): Also runs snapshot creation after analysis.--process-imaging(optional): If snapshot option is provided, Sharing data with the configured Imaging instance linked to AIP Console.--verbose(optional): Whether the command log should be output to the console or not, defaulted to true--server-urlor-s(optional): Specify the URL to your AIP Console server. default : localhost:8081--apikeyor--apikey:env(either is required) : the API Key to log in to AIP Console OR the environment variable containing the key--timeout(optional) : Time in seconds before calls to AIP Console time out. default : 90--user(optional) (legacy) : Specify a username to log in. Requires passing the user's password in the--apikeyparameter. default : none--consolidationor--upload-application(optional) : When sets to false, this prevents from consolidating snapshot or from publishing application to the Health dashboard. default : true--module-option(optional) Generates a user defined module option forr either technology module or analysis unit module. Possible value is one of: full_content, one_per_au, one_per_techno
This command is used to run a snapshot on an already analyzed version.
The available options are :
--app-nameor-n(required): The application name.--version-nameor-v(optional): The name of the version to create. default: The current version (version marked as current).--snapshot-nameor-S(optional): Used to specify the snapshot name. default: Defaults toSnapshot-YYYY-MM-DDThh-mm-ss(based on the current date and time)--verbose(optional): Whether the command log should be output to the console or not, defaulted to true--process-imaging(optional): Sharing data with the configured Imaging instance linked to AIP Console.--server-urlor-s(optional): Specify the URL to your AIP Console server. default : localhost:8081--apikeyor--apikey:env(either is required) : the API Key to log in to AIP Console OR the environment variable containing the key--timeout(optional) : Time in seconds before calls to AIP Console time out. default : 90--user(optional) (legacy) : Specify a username to log in. Requires passing the user's password in the--apikeyparameter. default : none--consolidationor--upload-application(optional) : When sets to false, this prevents from consolidating snapshot or from publishing application to the Health dashboard. default : true
When AIP Console finishes execution, it will return a specific return code, based on the execution.
Here is a detailed list of all error codes that can be returned by the CLI :
- 0 : No errors, processing was completed correctly. This is also the return code for
--helpand--versionparameters. - 1 : API key missing. No API key was provided either in the prompt or in the environment variable.
- 2 : Login Error. Unable to login to AIP Console with the given API key. Please check that you provide the proper value.
- 3 : Upload Error. An error occurred during upload to AIP Console. Check the standard output to see more details.
- 4 : Add Version Job Error. Creation of the Add Version job failed, or AIP CLI is unable to get the status of the running job. Please see the standard output for more details regarding this error.
- 5 : Job terminated. The Add Version job did not finish in an expected state. Check the standard output or AIP Console for more details about the state of the job.
- 6 : Application name or GUID missing. The AddVersion job cannot run due to a missing application name or missing application guid.
- 7 : Application Not Found. The given Application Name or GUID could not be found.
- 8 : Source Folder Not Found. THe given source folder could not be found on the AIP Node where the application version is delivered
- 9 : No Version. Application has no version and the provided command cannot be run.
- 10 : Version Not Found. The given version could not be found OR no version matches the requested command (i.e. No delivered version exists to be used for analysis)
- 1000 : Unexpected error. This can occur for various reasons, and the standard output should be checked for more information.
As detailed in the AIP Console documentation, you can obtain the API Key from the profile in the AIP Console UI.
If you cannot use an API Key, you can authenticate using username and password, by passing the --user flag to a command, and set the user's password in the --apikey or set it in an environment variable, which name you'll pass to --apikey:env




