Exemplo n.º 1
0
    /**
     * Return all the available zones
     * 
     * @return boolean|array
     */
    public function zonesInstance()
    {
        if (!isset($this->ec2Zone)) {
            $this->ec2Zone = new Ec2Zone($this->accessKey,$this->accessSecret,$this->region);
            $this->ec2Zone->setHttpClient($this->ec2->getHttpClient());
        }
        
        $this->resetError();
        try {
            $this->adapterResult = $this->ec2Zone->describe();
        } catch (Ec2Exception\RunTimeException $e) {
            $this->setError($e);
            return false;
        }

        $zones = array();
        foreach ($this->adapterResult as $zone) {
            if (strtolower($zone['zoneState']) === 'available') {
                $zones[] = array (
                    Instance::INSTANCE_ZONE => $zone['zoneName'],
                );
            }
        }
        return $zones;
    }