*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Service / Amazon / Ec2 / Availabilityzones.php
blobe2b2828f125c3bc4494deeb0241044b744d99b4a
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
16 * @package Zend_Service_Amazon
17 * @subpackage Ec2
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';
25 /**
26 * An Amazon EC2 interface to query which Availibity Zones your account has access to.
28 * @category Zend
29 * @package Zend_Service_Amazon
30 * @subpackage Ec2
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
36 /**
37 * Describes availability zones that are currently available to the account
38 * and their states.
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)
45 $params = array();
46 $params['Action'] = 'DescribeAvailabilityZones';
48 if(is_array($zoneName) && !empty($zoneName)) {
49 foreach($zoneName as $k=>$name) {
50 $params['ZoneName.' . ($k+1)] = $name;
52 } elseif($zoneName) {
53 $params['ZoneName.1'] = $zoneName;
56 $response = $this->sendRequest($params);
58 $xpath = $response->getXPath();
59 $nodes = $xpath->query('//ec2:item');
61 $return = array();
62 foreach ($nodes as $k => $node) {
63 $item = array();
64 $item['zoneName'] = $xpath->evaluate('string(ec2:zoneName/text())', $node);
65 $item['zoneState'] = $xpath->evaluate('string(ec2:zoneState/text())', $node);
67 $return[] = $item;
68 unset($item);
71 return $return;