Scalr\Modules\Platforms\Cloudstack\Helpers\CloudstackHelper::checkStaticNatIp PHP Метод

checkStaticNatIp() приватный статический Метод

Checks Elastic IP availability
private static checkStaticNatIp ( string $ipaddress, CloudStack $cs ) : boolean
$ipaddress string public IP address
$cs Scalr\Service\CloudStack\CloudStack CloudStack instance
Результат boolean Returns true if IP address is available.
    private static function checkStaticNatIp($ipaddress, CloudStack $cs)
    {
        \Scalr::getContainer()->logger('Cloudstack_Helpers')->debug(sprintf(_("Checking IP: %s"), $ipaddress));
        try {
            $requestObject = new ListIpAddressesData();
            $requestObject->ipaddress = $ipaddress;
            $info = $cs->listPublicIpAddresses($requestObject);
            if (count($info) > 0) {
                return true;
            } else {
                return false;
            }
        } catch (Exception $e) {
            return false;
        }
    }