您可以通过一些掩码使用“SoftLayer_Network_Storage::getObject”来获取更多信息。下面是一个示例:“<strong>用户名”、“<strong>密码”、“<strong>Host IQN”,用于授权主机(裸机服务器、虚拟服务器、IP 地址)。
Python 示例:
# So we can talk to the SoftLayer API:
import SoftLayer
# For nice debug output:
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
API_KEY = 'set me'
# Set the network storage id in order to get the associated authorized hosts:
iscsiId = 6550721
mask = 'mask[id,username,allowedVirtualGuests[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedHardware[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedIpAddresses[ipAddress,allowedHost[name,credential[username,password]]]]'
# Set up your API client
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
try:
# The expected result after executing the script is: true
result = client['SoftLayer_Network_Storage'].getObject(mask=mask,id=iscsiId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to get authorized hosts information faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
参考:
http://developer.softlayer.com/article/Object-Masks
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/getObject
https://softlayer.github.io/python/list_packages/