我有一张图片模板,如图所示。我想获得磁盘空间和虚拟磁盘列表,如图所示。我用过:
http://sldn.softlayer.com/zh/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/getObject to get the image template with mask as ('mask[id,accountId,name,globalIdentifier,blockDevices[device,diskImageId,diskSpace,groupId,id,units],parentId,createDate,datacenter,imageType,storageRepository,datacenters]')
。
设置了mask blockDevices。但结果是流程:
{'accountId': xxxxxxx,
'blockDevices': [],
'createDate': '2016-09-18T07:16:57-05:00',
'datacenters': [{'id': xx4092,
'longName': 'Singapore 1',
'name': 'sng01',
'statusId': 2}],
'globalIdentifier': 'xxxxxxxx-b068-40b1-8377-9ab66df80131',
'id': 1331697,
'imageType': {'description': 'a disk that may be replaced on upgrade',
'keyName': 'SYSTEM',
'name': 'System'},
'name': 'xxx-test-all-disk',
'parentId': ''}
blockDevices项是一个空数组。为什么?
任何api都可以帮助我获取映像磁盘空间和虚拟磁盘信息吗?
答案 0 :(得分:0)
请尝试以下mask
(这是其余示例):
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest_Block_Device_Template_Group/[imageId]/getObject?objectMask=mask[id,name,children[id,name,blockDevices[diskSpace,units,diskImage[localDiskFlag]]]]
Method:GET
children
项包含您想要的信息。目前,您正试图获取parent
项目。
我希望它可以帮到你。