public function createVmac($domain, $ipaddress, $type, $vmname)
{
$domain = (string) $domain;
$ipaddress = (string) $ipaddress;
$type = (string) $type;
$vmname = (string) $vmname;
if (!$domain) {
throw new BadMethodCallException('Parameter $domain is missing.');
}
if (!$ipaddress) {
throw new BadMethodCallException('Parameter $ipaddress is missing.');
}
if (!$type) {
throw new BadMethodCallException('Parameter $type is missing.');
}
if ($type != "ovh" && $type != "vmware") {
throw new BadMethodCallException('Parameter $type must be "ovh" or "vmware"');
}
if (!$vmname) {
throw new BadMethodCallException('Parameter $vmname is missing.');
}
$payload = array("ipAddress" => $ipaddress, "virtualMachineName" => $vmname);
try {
$r = $this->get('dedicated/server/' . $domain . '/virtualMac/' . $ip, array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($payload))->send();
} catch (\Exception $e) {
throw new ServerException($e->getMessage(), $e->getCode(), $e);
}
return $r->getBody(true);
}