我試圖創建WHM /的cPanel對SoftLayer的虛擬服務器,創建的SoftLayer Virtual_Guest與WHM /的cPanel
不幸的是,SoftLayer的API不支持代碼示例和任何API調用會招致我的帳戶收費。
而服務generateOrderTemplate不會驗證,但只需要參數。
下面的代碼有什麼問題?
try {
$client = \libraries\SoftLayer\SoapClient::getClient('SoftLayer_Virtual_Guest', null, $apiUsername, $apiKey);
} catch (Exception $e) {
die('Unable to create service client: ' . $e->getMessage());
}
try {
$virtualGuest = new \stdClass();
$virtualGuest->datacenter->name = 'ams01';
$virtualGuest->hostname = 'test';
$virtualGuest->domain = 'myDomain.com';
$virtualGuest->startCpus = 1;
$virtualGuest->maxMemory = 1024;
$virtualGuest->hourlyBillingFlag = false;
$virtualGuest->localDiskFlag = true;
$virtualGuest->operatingSystemReferenceCode = 'CENTOS_7_64';
$virtualGuest->softwareComponents[0]->softwareDescription->id = 46;
$virtualGuest->softwareComponents[0]->softwareDescription->controlPanel = 1;
$virtualGuest->softwareComponents[0]->softwareDescription->virtualLicense = 1;
$virtualGuest->softwareComponents[0]->softwareDescription->manufacturer = "cPanel";
$virtualGuest->blockDevices[0]->device = 0;
$virtualGuest->blockDevices[0]->diskImage->capacity = 25;
$call = $client->generateOrderTemplate($virtualGuest);
$call = $client->createObject($virtualGuest);
print_r($call);
} catch (Exception $e) {
die('Unable to create Virtual Guest: ' . $e->getMessage());
}
感謝
感謝親,我會嘗試它(y) –