要在 SoftLayer 上生成/启动新的漏洞扫描,这有效(对于帐户中的每个服务器):
require_once('SoapClient.class.php');
$apiUsername = "omitted";
$apiKey = "omitted";
$client = SoftLayer_SoapClient::getClient('SoftLayer_Account', null, $apiUsername, $apiKey);
$accountInfo = $client->getObject();
$hardware = $client->getHardware();
foreach ($hardware as $server){
$scanclient = SoftLayer_SoapClient::getClient('SoftLayer_Network_Security_Scanner_Request', '', $apiUsername, $apiKey);
$scantemplate = new stdClass();
$scantemplate->accountId = $accountInfo->id;
$scantemplate->hardwareId = $server->id;
$scantemplate->ipAddress = $server->primaryIpAddress;
try{
// Successfully creates new scan
$scan = $scanclient->createObject($scantemplate);
} catch (Exception $e){
echo $e->getMessage() . "\n\r";
}
}
换的时候
$reportstatus = $scanclient->createObject($scantemplate);
至
$reportstatus = $scanclient->getReport($scantemplate);
API 以有关“对象不存在执行方法”的错误响应。
根据文档,是否需要 SoftLayer_Network_Security_Scanner_RequestInitParameters?如果是这样,您如何定义这些“初始化参数”并附加到状态或报告请求?
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Security_Scanner_Request/getReport