Useful CloudShell Automation API Code Examples
This section provides different code examples that can be used for reference.
📄️ Starting an API Session Outside of CloudShell
This script starts an API session from your IDE. This is useful for performing admin tasks outside of the scope of the blueprint or sandbox.
📄️ Performing Actions on Resources in the Sandbox
Adding resources, connecting L1 routes and setting live status
📄️ Finding Blueprints Containing a Specific Resource, Service or App
The following Python scripts utilize the CloudShell Automation API to print a list of the blueprints that have a specific component and should be run from an IDE that can access the Quali Server.
📄️ Editing Apps in a Sandbox
The EditAppsInReservation API enables you to programmatically modify an App in a sandbox. Generally, the classic flow is to call this API using CloudShell Automation API during the Preparation phase of the setup script (before the Provisioning phase that deploys the Apps).
📄️ Getting a Resource's Reservations
The GetResourceReservations API returns the reservations (sandboxes) associated with a specific resource. This is useful for admin and reporting automation - for example, to check whether a resource is currently in use before taking it offline, to audit which users have reserved a resource, or to list its upcoming (scheduled) reservations.
📄️ Undeploying Apps While Keeping the Resource
The UndeployApps API removes a deployed App from the cloud provider (it destroys the virtual machine) while keeping the App's CloudShell resource in place. This is different from deleting an App, which both destroys the VM on the cloud provider and removes the resource from CloudShell.
📄️ Removing Entities from a Topology
The RemoveEntitiesFromTopology API enables you to programmatically remove elements from a topology (blueprint), including services and abstract resources. This is useful when you want to automate cleanup or restructuring of a blueprint's contents from outside CloudShell, for example as part of a maintenance script that trims obsolete services or abstract resources from a set of blueprints.