7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_Service_Amazon
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: Availabilityzones.php 16971 2009-07-22 18:05:45Z mikaelkael $
23 require_once 'Zend/Service/Amazon/Ec2/Abstract.php';
26 * An Amazon EC2 interface to query which Availibity Zones your account has access to.
29 * @package Zend_Service_Amazon
31 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
32 * @license http://framework.zend.com/license/new-bsd New BSD License
34 class Zend_Service_Amazon_Ec2_Availabilityzones
extends Zend_Service_Amazon_Ec2_Abstract
37 * Describes availability zones that are currently available to the account
40 * @param string|array $zoneName Name of an availability zone.
41 * @return array An array that contains all the return items. Keys: zoneName and zoneState.
43 public function describe($zoneName = null)
46 $params['Action'] = 'DescribeAvailabilityZones';
48 if(is_array($zoneName) && !empty($zoneName)) {
49 foreach($zoneName as $k=>$name) {
50 $params['ZoneName.' . ($k+
1)] = $name;
53 $params['ZoneName.1'] = $zoneName;
56 $response = $this->sendRequest($params);
58 $xpath = $response->getXPath();
59 $nodes = $xpath->query('//ec2:item');
62 foreach ($nodes as $k => $node) {
64 $item['zoneName'] = $xpath->evaluate('string(ec2:zoneName/text())', $node);
65 $item['zoneState'] = $xpath->evaluate('string(ec2:zoneState/text())', $node);