Search code examples
pythonibm-cloud-infrastructure

How to access deleted VSI's data in SoftLayer


I need to access deleted VSI's to find their ID. I have the hostnames of the devices that were deleted. In essence, I need to take the hostnames of the deleted VSI's and find their ID. Here is my code (Python):

import SoftLayer
import json

USERNAME = 'set me'
API_KEY = 'set me'


client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
accountService = client['SoftLayer_Account']
objectMask= "mask[hostname,id]"

try:

 response = accountService.getallTopLevelBillingItems(mask=objectMask)
 print(json.dumps(response, sort_keys=True, indent=2, separators=(',', ': ')))

except:

 print("Unable to get the VSIs")`

Solution

  • There is no way to retrieve the deleted VSIs using the SLDN API once they were cancelled.

    I'm not sure but you can try by submitting a ticket and request that information if you need those IDs for logging purposes