Scalr\Modules\Platforms\GoogleCE\GoogleCEPlatformModule::getLocations PHP Метод

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

См. также: Scalr\Modules\PlatformModuleInterface::getLocations()
public getLocations ( Scalr_Environment $environment = null )
$environment Scalr_Environment
    public function getLocations(\Scalr_Environment $environment = null)
    {
        $retval = [];
        if ($environment && $environment->isPlatformEnabled(\SERVER_PLATFORMS::GCE)) {
            try {
                $client = $this->getClient($environment);
                $zones = $client->zones->listZones($environment->keychain(SERVER_PLATFORMS::GCE)->properties[Entity\CloudCredentialsProperty::GCE_PROJECT_ID]);
                foreach ($zones->getItems() as $zone) {
                    if ($zone->status == 'UP') {
                        $retval[$zone->getName()] = $zone->getName();
                    }
                }
            } catch (Exception $e) {
            }
        }
        return $retval;
    }