public function releaseAddress($publicIp = null, $allocationId = null)
{
if ($publicIp === null && $allocationId === null) {
throw new \InvalidArgumentException('Either publicIp or allocationId must be provided.');
}
$result = false;
$options = array();
if ($publicIp !== null) {
$options['PublicIp'] = (string) $publicIp;
}
if ($allocationId !== null) {
$options['AllocationId'] = (string) $allocationId;
}
$response = $this->client->call(ucfirst(__FUNCTION__), $options);
if ($response->getError() === false) {
$sxml = simplexml_load_string($response->getRawContent());
if ((string) $sxml->return != 'true') {
throw new Ec2Exception(sprintf('Amazon Ec2 could not release elastic IP address "%s". It returned "%s"', isset($options['AllocationId']) ? $options['AllocationId'] : $options['PublicIp'], $sxml->return));
}
$result = true;
}
return $result;
}