public function disassociateAddress($publicIp = null, $associationId = null)
{
if ($publicIp === null && $associationId === null) {
throw new \InvalidArgumentException('Either publicIp or associationId must be provided.');
}
$result = false;
$options = array();
if ($publicIp !== null) {
$options['PublicIp'] = (string) $publicIp;
}
if ($associationId !== null) {
$options['AssociationId'] = (string) $associationId;
}
$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 disassociate elastic IP address. It returned "%s"', $sxml->return));
}
$result = true;
}
return $result;
}