Extract the "AWS Transform: Advisor for .Net Applications" recommendations from CAST Highlight into JSON files for an upload in AWS Transform
This Python script automatically extracts the recommendations from "AWS Transform: Advisor for .Net Applications" into JSON files. It will generate one JSON file with all the recommended waves and one JSON file per wave. Those JSON files follow a format that will allow users to upload them directly in AWS Transform to help selecting the .Net repositories to be automatically upgraded in the latest .Net version.
This script just takes as an input a token to connect to a CAST Highlight account. The default CAST Highlight URL is https://rpa.casthighlight.com, but you can select another one like ,https://cloud.casthighlight.com or https://app.casthighlight.com
- Repository vs Application: since AWS Transform works at the source code repository level, CAST Highlight code scans must also be done at the source code repository level and not at the application level. For example, if an application is composed of 3 GitHub repositories, the 3 GitHub repositories must be scanned separately and the 3 code scan results must be uploaded in 3 different applications in the CAST Highlight platform.
- CAST Highlight application name must follow a specific naming convention : repository_id\repository_name. For example, for the Github repository "https://github.com/aws-samples/bobs-used-bookstore-classic", the application name in CAST Highlight must be "aws-samples/bobs-used-bookstore-classic".
- Ideally, the name of the code scan snapshot should be the name of the scanned repository branch. Most of the time, the name of the scanned branch is the default name like "main"
3. Go to the Miscellaneous Options tab, select the "cast.keyword.dotnet.xml" for the Add KeyWord Scan Config option
.Net Version Check extension : https://doc.casthighlight.com/extensions/download.php?identifier=cast.keyword.dotnet

4. Activate the Upload Scan Results option, enter the login credentials to the CAST Highlight instance (Easy Authentication or Advanced Authentication) and click on Sign In
5. Select Create an application, enter the application name following the naming convention described above (repo_id/repo_name) and click on the + button
6. Select the newly created application (you can see its ID) in the drop-down list then go to the Advanced Authentication tab
7. In the Advanced Authentication tab, fill the Snapshot Label field with the branch name of the repository to scan and select the proper Snapshot date then finally hit the Save Settings button followed by the Launch Scan button
Python 3.13.3 or later (Python 3.09 and 3.10 not supported)
python -m venv venvsource venv/bin/activate # macOS / Linux
venv\Scripts\activate # Windowspip install -r requirements.txt- Retrieve the command line parameters
- Set up the analysis environment by creating several folders
- Use the CAST Highlight API and the CAST token to retrieve the company id of the CAST Highlight account
- Create or update the "AWS Transform: Advisor for .Net Applications" segmentation in CAST Highlight
- Retrieve the list of applications onboard in CAST Highlight, only applications with the status "Complete"
- Compute the "AWS Transform: Advisor for .Net Applications" segmentation and retrieve the list of applications for rach segment
- Generate the JSON files: one JSON with all the segments/waves and one JSON file per waves (6 maximum)
python .\CastAWSTransformAdvisorExtraction.py --help
usage: CastAWSTransformAdvisorExtraction.py [-h] --cast-token CAST_TOKEN
Extract the "AWS Transform: Advisor for .Net Applications" recommendations from CAST Highlight
options:
-h, --help show this help message and exit
--cast-token CAST_TOKEN CAST Highlight token
--cast-url CAST_URL CAST Highlight URL - default is https://rpa.casthighlight.com
Other possible CAST Highlight URLs:
https://cloud.casthighlight.com
https://app.casthighlight.com
https://demo.casthighlight.compython .\CastAWSTransformAdvisorExtraction.py --cast-token <your-CAST-Highlight-token>python .\CastAWSTransformAdvisorExtraction.py --cast-token <your-CAST-Highlight-token> --cast-url https://demo.casthighlight.comCreated by fcnico98 (n.bidaux@castsoftware.com)





