Script commands Visibility and Usability Suggest edits
You can control many aspect of how the orchestration commands appear and behave in CloudShell by editing the script from the scripts management page.
To demonstrate these capabilities, we’ll create a simple script which we’ll customize. The script essentially prints out the parameters it receives and then sets the Sandbox status to ‘Online’.
Create a new Python file and name it customization_test.py. Add the following code:
In the CloudShell portal, open the Management tab. Navigate to the Scripts sub section and select Environment.
Drag and drop or add the customization_test.py script. Then click the “Edit” button to customize it.
Setting display name, descriptions and category
You can set the script display name or alias by editing the “Alias” field in the edit form. Note that if you try to execute this script as a command from the API you’ll still need to reference it by its name. Set the alias to Customization Script.
The description is also easy to set via the edit form. Enter any text here, it will be displayed as a reference under the script name in the commands pane.
Categories help improve usability by grouping commands with a similar role or domain under a folder in the sandbox command panel. This grouping has visual implications only and will not affect API calls. For this example, let’s set the category name to ‘Customization’.
Adding parameters
Our script expects two parameters, but CloudShell has no way of knowing that. We need to add these parameters in this same form.
Click the “Add Parameter” link at the bottom of the form. Set the Name as ‘first_param’ and the Default Value as ‘None’, finally fill in the description field with any text. If the command parameters don’t have default values, they will become mandatory and the user won’t be able to execute the command without filling in values for them.
Repeat the process, this time for the second param which the script expects to be named “second_param”.
Test the new look and feel
To test the script, we need to add it to a blueprint. Go to Lab Management -> Environment. Create a new environment or select an existing one and attach the script to it from the properties page of the environment. Reserve the environment and open the command pane in the sandbox.