Here is the public function "should create a virtual machine" with validation,
public function deployVirtualMachine($serviceOfferingId, $templateId, $zoneId, $account = "", $diskOfferingId = "") {
if (empty($serviceOfferingId)) {
throw new CloudStackClientException(sprintf(MISSING_ARGUMENT_MSG, "serviceOfferingId"), MISSING_ARGUMENT);
}
if (empty($templateId)) {
throw new CloudStackClientException(sprintf(MISSING_ARGUMENT_MSG, "templateId"), MISSING_ARGUMENT);
}
if (empty($zoneId)) {
throw new CloudStackClientException(sprintf(MISSING_ARGUMENT_MSG, "zoneId"), MISSING_ARGUMENT);
}
return $this->request("deployVirtualMachine", array(
'serviceofferingid' => $serviceOfferingId,
'templateid' => $templateId,
'zoneid' => $zoneId,
'account' => $account,
'diskofferingid' => $diskOfferingId,
'displayname' => $displayName,
}
I'm trying to call this function, but I keep getting exception " $templateId" is missing. but I'm pretty sure its defined here in my array.
$params = array(
$serviceOfferingId => '85d06496-bb75-41fb-9358-4ab919e03fe4',
$templateId => 'c0989cf6-2da5-11e4-a846-726c7bbb864f',
$zoneId => '7cd483ab-5aad-458b-b5e1-0e270310f41c',
$name => 'srv11'
);
echo $cloudstack->deployVirtualMachine($params);
Any help would be highly appreciated
Thank you