如何在SoftLay中访问已删除的VSI数据

2024-06-02 12:46:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要访问已删除的VSI以查找其ID。我有已删除设备的主机名。本质上,我需要获取已删除VSI的主机名并找到它们的ID

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")`

Tags: keyimportclientapiidjsonresponseusername