你可以使用一個對象屏蔽來獲取這樣的信息:
面具[allowedHardware [allowedHost [憑證],allowedVirtualGuests [allowedHost [憑證]]]
這將是一個REST請求用法:
https://$username:[email protected]/rest/v3/SoftLayer_Network_Storage_Iscsi/$iscsiId/getObject.json?objectMask=mask[allowedHardware[allowedHost[credential]],allowedVirtualGuests[allowedHost[credential]]]
這裏一個使用樣本Python客戶端:
"""
Get credentials for a authorized hosts of a SoftLayer_Network_Storage_Iscsi
Important manual pages
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Iscsi
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <[email protected]>
"""
import SoftLayer
import json
USERNAME = 'set me'
API_KEY = 'set me'
iscsiStorageId = 1234567
client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY)
networkStorageIscsiService = client['SoftLayer_Network_Storage_Iscsi']
objectMask = 'mask[allowedHardware[allowedHost[credential]],allowedVirtualGuests[allowedHost[credential]]]'
try:
iscsiStorage = networkStorageIscsiService.getObject(mask=objectMask, id=iscsiStorageId)
print(json.dumps(iscsiStorage, sort_keys=True, indent=2, separators=(',', ': ')))
except SoftLayer.SoftLayerAPIError as e:
print("Unable to retrieve the Network Storage Iscsi. faultCode=%s, faultString=%s"
% (e.faultCode, e.faultString))
下一個環節可能會爲您提供進一步的信息:
https://sldn.softlayer.com/article/object-masks
嗨大衛......我能與上述步驟感謝您檢索憑據 – Ajay