如何获得软层存储凭证? [英] How get the softlayer storage credendials?
本文介绍了如何获得软层存储凭证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试获取授权的Softlayer网络存储的用户名,密码和主机IQN。
我使用了此python脚本,但是shell返回[]
I'm trying to get the Username,password and host IQN of a authorized Softlayer Network Storage. I used this python script, but the shell returns []
import SoftLayer
API_USERNAME = 'xxx'
API_KEY = 'yyyy'
storageId = zzzz
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY
)
client['SoftLayer_Network_Storage'].getCredentials(id=storageId)
我的代码有什么问题?
问候
What's wrong in my code? Regards
推荐答案
请尝试以下操作:
"""
Get all the authorized hosts for a iSCSI.
Important manual pages:
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Hardware
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/getObject
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
USERNAME = 'set me'
API_KEY = 'set me'
iscsiId = 6548079
# Declares the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
networkStorageService = client['SoftLayer_Network_Storage']
objectMask = "mask[id,username,allowedVirtualGuests[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedHardware[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]]]"
try:
response = networkStorageService.getObject(id=iscsiId, mask=objectMask)
print(response)
except SoftLayer.SoftLayerAPIError as e:
# If there was an error returned from the SoftLayer API then bomb out with the
# error message.
print("Unable to retrieve the network storage. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))
这篇关于如何获得软层存储凭证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文