/** * Creates a new ElasticLB specific EC2 response object * * @param Zend_Http_Response $httpResponse the HTTP response * @param string $apiVersion the EC2 API version */ public function __construct(Zend_Http_Response $httpResponse, $apiVersion = null) { if (!$apiVersion) { $apiVersion = $this->_ec2ApiVersion; } $this->_xmlNamespace = $this->_xmlNamespaceBase . $apiVersion . '/'; parent::__construct($httpResponse); }
/** * Checks for errors responses from Amazon * * @param Zend_Service_Amazon_Ec2_Response $response the response object to * check. * * @return void * * @throws Zend_Service_Amazon_Ec2_Exception if one or more errors are * returned from Amazon. */ private function checkForErrors(Zend_Service_Amazon_Ec2_Response $response) { $xpath = new DOMXPath($response->getDocument()); $list = $xpath->query('//Error'); if ($list->length > 0) { $node = $list->item(0); $code = $xpath->evaluate('string(Code/text())', $node); $message = $xpath->evaluate('string(Message/text())', $node); throw new Zend_Service_Amazon_Ec2_Exception($message, 0, $code); } }