我如何弄清楚如何调用 Sotlayer 服务 API
How do I figure out how to call Sotlayer Service API
我如何确定将什么作为输入传递给各种 SoftLayer 服务?
https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Group/getAttachedVolumes
我知道如何创建对象来调用这些命令,但不清楚将什么传递给这些 API 引用。我是否遗漏了某种文档,或者是否有一种独立的方法来解决这个问题?
到目前为止,我基本上都是在猜测和查看经理如何调用相关功能,但在这种情况下,没有经理使用该服务或特定功能。
我想你看经理使用 python,看看这个脚本到 getAttachedVolumes:
"""
This script retrieve the network storage volumes this group is attached to
Important manual pages:
https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Group/getAttachedVolumes
https://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
import pprint
# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'
storageGroupId = 448757
# declaring the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
try:
result = client['SoftLayer_Network_Storage_Group'].getAttachedVolumes(id=storageGroupId)
pprint.pprint(result)
except SoftLayer.SoftLayerAPIError as e:
print(('Error faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString)))
我希望它能提供如何发送方法输入的想法,你应该在这一行发送L
client['SoftLayer_Network_Storage_Group'].getAttachedVolumes(id=storageGroupId)
查看以下链接以获取更多信息:
另一个重要链接:
对于其他编程语言:
如果您需要其他方法、编程语言的进一步帮助或有任何疑问,请告诉我。
Updated
要检索帐户的网络存储组(及其标识符),您可以使用此方法:SoftLayer_Account::getNetworkStorageGroups,下面是 python 中的示例:
"""
This script retrieves an account's Network Storage Groups
Important manual pages:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getNetworkStorageGroups
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage_Group
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
import pprint
# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'
# declaring the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
try:
result = client['SoftLayer_Account'].getNetworkStorageGroups()
pprint.pprint(result)
except SoftLayer.SoftLayerAPIError as e:
print(('Error faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString)))
您将在响应中检索标识符 (groupId)
我如何确定将什么作为输入传递给各种 SoftLayer 服务?
https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Group/getAttachedVolumes
我知道如何创建对象来调用这些命令,但不清楚将什么传递给这些 API 引用。我是否遗漏了某种文档,或者是否有一种独立的方法来解决这个问题?
到目前为止,我基本上都是在猜测和查看经理如何调用相关功能,但在这种情况下,没有经理使用该服务或特定功能。
我想你看经理使用 python,看看这个脚本到 getAttachedVolumes:
"""
This script retrieve the network storage volumes this group is attached to
Important manual pages:
https://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage_Group/getAttachedVolumes
https://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
import pprint
# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'
storageGroupId = 448757
# declaring the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
try:
result = client['SoftLayer_Network_Storage_Group'].getAttachedVolumes(id=storageGroupId)
pprint.pprint(result)
except SoftLayer.SoftLayerAPIError as e:
print(('Error faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString)))
我希望它能提供如何发送方法输入的想法,你应该在这一行发送L
client['SoftLayer_Network_Storage_Group'].getAttachedVolumes(id=storageGroupId)
查看以下链接以获取更多信息:
另一个重要链接:
对于其他编程语言:
如果您需要其他方法、编程语言的进一步帮助或有任何疑问,请告诉我。
Updated
要检索帐户的网络存储组(及其标识符),您可以使用此方法:SoftLayer_Account::getNetworkStorageGroups,下面是 python 中的示例:
"""
This script retrieves an account's Network Storage Groups
Important manual pages:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getNetworkStorageGroups
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage_Group
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
"""
import SoftLayer
import pprint
# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'
# declaring the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
try:
result = client['SoftLayer_Account'].getNetworkStorageGroups()
pprint.pprint(result)
except SoftLayer.SoftLayerAPIError as e:
print(('Error faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString)))
您将在响应中检索标识符 (groupId)