VMware introduced the Developer Center and Code Capture with the release of vCenter Server Appliance (VCSA) 6.7 U2 and it is available in all the new releases.
In this post, we will look at the Developer Center Code Capture feature available in the vSphere 6.7 latest version.
The Developer Center is a single point of entry for developers that provides tools to manage API structure and to capture user actions to translate them into executable code. Also, the vSphere Client Developer Center provides tools for automation experts, DevOps engineers, and developers to find the resources to manage API structures and to capture vSphere Client actions to translate them into PowerCLI.
Code Capture records user actions and translates them into executable code. This will help administrators and engineers to analyze and reuse the actions through PowerCLI. And note that only vCenter Server calls are recorded. Calls made on operations regarding roles, privileges, tags, content libraries, and storage policies are not recorded. This feature is available in HTML5 vSphere Client only and to use this you have to enable it first.
Enable Code Capture
You can enable the code capture by following below procedure
- Navigate to menu and Click Developer Center
- Select Code Capture
- Click the toggle to enable Code Capture.
You can start the recording from the red record button in the top pane and while recording is in progress, the red record button in the top pane blinks.
Navigate to your desired pane and click on the red record button to start the recording. We are testing this feature by performing a clone of the virtual machine and powering on.
Navigate to Developer Center and you can see the only option available is STOP RECORDING since the recording is in progress
Once the clone the process is finished you can verify that the VM is running and stop the recording. And the code of the operations we performed which is cloning the VM and Power on is visible there.
And there are three other options available and STOP RECORDING is grayed after stopping the record process.
CLEAR AND START ANOTHER: This option will clear the captured code in a previous session and start a new session
You have to select the CLEAR AND RESTART option from the pop-up message to continue.
COPY: This option will copy the code, and you can paste to any notepad or any other suitable application to save it as PowerCLI format and use it for future purpose
DOWNLOAD: This option will download the code as a PowerCLI script
You can open in PowerShell application and verify the code
Disable Code Capture
You can disable the feature by clicking the toggle “Enable Code Capture” option.
If you disable Code Capture, a pop-up message will appear “Disabling the Code Capture will clear actions recorded in the current session and hide Code Capture on the navigation header”. So make sure you copy or download the code before proceeding with this operation.
The Developer Center with Code Capture feature is very useful for VMware administrators’ and engineers to automate different tasks in vSphere environment. The feature will allow you to “capture” the UI tasks you do within the UI into PowerCLI code and copy the code or download it as a script and use it in a PowerShell session to execute the tasks.