您的当前代码将只检索其中一个证书,而不是存储的安全证书,为了使您的掩码工作,您需要添加关闭字符串“”双引号,并且您调用的方法应该是getSslCertificateRequests,见下图:
accountId = 202768 #change this value
mask = "mask[accountId, certificateSigningRequest, certificateAuthorityName, id]"
response = client['SoftLayer_Security_Certificate_Request'].getSslCertificateRequests(accountId)
目前门户网站使用SoftLayer_Account :: getSecurityCertificate检索存储的安全证书,包括SSL,请使用以下的Python脚本:
import SoftLayer
from pprint import pprint as pp
USERNAME = 'set-me'
# Endpoint url that contains all the Api Services.
API_KEY = 'set-me'
# Generate one for you or your users, or view yours at
https://control.softlayer.com/account/users
client = SoftLayer.create_client_from_env(username=USERNAME,
api_key=API_KEY)
accountService = client['SoftLayer_Account']
try:
""""
getSecurityCertificates() retrieves stored security certificates (ie. SSL)
"""""
result = accountService.getSecurityCertificates()
pp(result)
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 Account's stored security certificates (i.e. SSL) . %s %s " % (e.faultCode, e.faultString))
要找到相关的,你应该使用的方法getAdcLoadBalancers和发送在前面的方法得到的ID值,试试这个REST请求的虚拟IP地址。
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Account/getAdcLoadBalancers?objectFilter={"adcLoadBalancers":{"securityCertificateId":{"operation":[id]}}}
记住要改变用户名和apiKey的有效凭据,以及上面提到的ID检索相关的负载均衡器的IP地址。
非常感谢,但我仍然遇到麻烦,试图找到服务方法getAdcLoadBalancers和它的datataype的文档。是否有任何问题,因为它似乎不包括在内,或者我搜索错误。 – chengwei45