Scalr\Modules\Platforms\Azure\AzurePlatformModule::GetServerIPAddresses PHP Метод

GetServerIPAddresses() публичный Метод

См. также: Scalr\Modules\PlatformModuleInterface::GetServerIPAddresses()
public GetServerIPAddresses ( DBServer $DBServer )
$DBServer DBServer
    public function GetServerIPAddresses(DBServer $DBServer)
    {
        $env = $DBServer->GetEnvironmentObject();
        $azure = $env->azure();
        $nicInfo = $azure->network->interface->getInfo($env->keychain(SERVER_PLATFORMS::AZURE)->properties[CloudCredentialsProperty::AZURE_SUBSCRIPTION_ID], $DBServer->GetProperty(\AZURE_SERVER_PROPERTIES::RESOURCE_GROUP), $DBServer->GetProperty(\AZURE_SERVER_PROPERTIES::NETWORK_INTERFACE), true);
        if (!empty($nicInfo->properties->ipConfigurations)) {
            foreach ($nicInfo->properties->ipConfigurations as $ipConfig) {
                $privateIp = $ipConfig->properties->privateIPAddress;
                if ($ipConfig->properties->publicIPAddress) {
                    $publicIp = $ipConfig->properties->publicIPAddress->properties->ipAddress;
                    if ($publicIp) {
                        break;
                    }
                }
            }
        }
        return array('localIp' => $privateIp, 'remoteIp' => $publicIp);
    }