如何获取软层上卷存储的凭证
How to get credentials of volume storage on softlayer
我尝试了以下方法,以获取软层上 iSCSI 存储的凭据(我在软层上有耐力块存储)但无法检索密码。
SoftLayer_Network_Storage_Iscsi::getCredentials
eg. res = client['SoftLayer_Network_Storage_Iscsi'].getCredentials(id=***)
SoftLayer_Network_Storage_Iscsi::getObjectsByCredential
SoftLayer_Network_Storage_Iscsi::getObject
SoftLayer_Network_Storage_Iscsi::getAllowedVirtualGuests
我想为特定卷检索授权主机的用户名、密码和 iqn。是否有 api 检索此信息或任何其他检索此信息的方法
您可以使用对象掩码来检索此类信息:
mask[allowedHardware[allowedHost[credential]],allowedVirtualGuests[allowedHost[credential]]]
这将是 REST 请求的用法:
https://$username:$apiKey@api.softlayer.com/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. <sldn@softlayer.com>
"""
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))
下一个 link 可能会为您提供更多信息:
我尝试了以下方法,以获取软层上 iSCSI 存储的凭据(我在软层上有耐力块存储)但无法检索密码。
SoftLayer_Network_Storage_Iscsi::getCredentials
eg. res = client['SoftLayer_Network_Storage_Iscsi'].getCredentials(id=***)
SoftLayer_Network_Storage_Iscsi::getObjectsByCredential
SoftLayer_Network_Storage_Iscsi::getObject
SoftLayer_Network_Storage_Iscsi::getAllowedVirtualGuests
我想为特定卷检索授权主机的用户名、密码和 iqn。是否有 api 检索此信息或任何其他检索此信息的方法
您可以使用对象掩码来检索此类信息:
mask[allowedHardware[allowedHost[credential]],allowedVirtualGuests[allowedHost[credential]]]
这将是 REST 请求的用法:
https://$username:$apiKey@api.softlayer.com/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. <sldn@softlayer.com>
"""
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))
下一个 link 可能会为您提供更多信息: