List<CloudStackIpAddress> cloudIps = getApi().listPublicIpAddresses(null, null, null, null, null, request.getPublicIp(), null, null, null);
if (cloudIps == null)
throw new EC2ServiceException(ServerError.InternalError, "Specified ipAddress doesn't exist");
CloudStackIpAddress cloudIp = cloudIps.get(0);
CloudStackInfoResponse resp = getApi().disableStaticNat(cloudIp.getId());
if (resp != null) {
return resp.getSuccess();
}
} catch(Exception e) {
logger.error( "EC2 DisassociateAddress - ", e);
throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
}