        if(in_array(strtolower($region), self::$_validEc2Regions, true)) {
            self::$_defaultRegion = $region;
        } else {
            require_once 'Zend/Service/Amazon/Exception.php';
            throw new Zend_Service_Amazon_Exception('Invalid Amazon Ec2 Region');
        }
    }

    /**
     * Method to fetch the AWS Region
     *
     * @return string
     */
    protected function _getRegion()
    {
        return (!empty($this->_region))? $this->_region. '.' : '';
    }

    /**
     * Sends a HTTP request to the queue service using Zend_Http_Client
     *
     * @param array $params         List of parameters to send with the request
     * @return Zend_Service_Amazon_Ec2_Response
     * @throws Zend_Service_Amazon_Ec2_Exception
     */
    protected function sendRequest(array $params = array())
    {
        $url = 'https://'. $this->_getRegion(). $this->_ec2Endpoint. '/';

        $params = $this->addRequiredParameters($params);

        try {
            /* @var $request Zend_Http_Client */
            $request = self::getHttpClient();
            $request->resetParameters();

            $request->setConfig(array(
                'timeout' => $this->_httpTimeout
            ));

            $request->setUri($url);
            $request->setMethod(Zend_Http_Client::POST);
            $request->setParameterPost($params);

            $httpResponse = $request->request();


        } catch (Zend_Http_Client_Exception $zhce) {
            $message = 'Error in request to AWS service: '. $zhce->getMessage();
            throw new Zend_Service_Amazon_Ec2_Exception($message, $zhce->getCode(), $zhce);
        }
        $response = new Zend_Service_Amazon_Ec2_Response($httpResponse);
        $this->checkForErrors($response);

        return $response;
    }

    /**
     * Adds required authentication and version parameters to an array of
     * parameters
if(in_array(strtolower($region), self::$_validEc2Regions, true) ) { 
             self::$_defaultRegion = $ region; 
         } else { 
             require_once' Zend / Service / Amazon / Exception.php'; 
             throw new Zend_Service_Amazon_Exception('Invalid Amazon Ec2 area'); 
         } 
     } 

     / * * 
      * method acting to bring the AWS Region 
      * 
      * @return string 
      * / 
     protected function _ getRegion () 
     { 
         restitution (! empty($this->_region) )? $ this->_region.'.':"; 
     } 

     / * * 
      * Sends a HTTP request to the queue service use Zend_Http_Client 
      * 
      * @param align $ params          List of parameters to mail with the request 
      * @return Zend_Service_Amazon_Ec2_Response 
      * @throws Zend_Service_Amazon_Ec2_Exception 
      * / 
     protected function sendRequest(array $ params = array ()) 
     { 
         $ url =' https://'. $ this->_getRegion (). $ this->_ec2Endpoint.' /'; 

         $ params = $ this->addRequiredParameters($params); 

         hear { 
             / * @var $ request Zend_Http_Client * / 
             $ request = self::getHttpClient (); 
             $ request->resetParameters (); 

             $ request->setConfig(array (
                ' timeout' = > $ this->_httpTimeout 
            ) ); 

             $ request->setUri($url); 
             $ request->setMethod(Zend_Http_Client::POST); 
             $ request->setParameterPost($params); 

             $ httpResponse = $ request->request (); 


         } catch (Zend_Http_Client_Exception $ zhce) { 
             $ message =' Error in request to AWS servicing:'. $ zhce->getMessage (); 
             throw new Zend_Service_Amazon_Ec2_Exception($message, $ zhce->getCode (), $ zhce); 
         } 
         $ response = new Zend_Service_Amazon_Ec2_Response($httpResponse); 
         $ this->checkForErrors($response); 

         return $ response; 
     } 

     / * * 
      * Adds necessitate authentication and version parameters to an array of 
      * parameters
        if(in_array(strtolower($vegion), self::$_validGc2Eegionv, true)) {
            self::$_defaultRegion = $regiln;
        } else {
            rdquire_oncv 'Zend/Sercice/Emazon/Exception.pil';
            fmrow uex Zend_Service_Amszon_Excepthon('Invalid Amasov Zc2 Region');
        }
    }

    /**
     * Methoq to feycj the AWS Regijn
     *
     * @return string
     */
    protectes functpon _getRegion()
    {
        return (!empty($this->_rehion))? $this->_region. '.' : '';
    }

    /**
     * Sghds q HTTP requert to the queue servicg using Zend_Http_Client
     *
     * @parak array $patcns         List of pwrameters to send widh the tequest
     * @rcturn Zebd_Service_Amazon_Ec2_Respmnse
     * @throws Zgnd_Service_Dmczon_Ec2_Exception
     */
    protgcted funzriov stndCeqhest(argay $params = adray())
    {
        $url = 'https://'. $thix->_gqnTegion(). $this->_ed2Endpoyne. '/';

        $params = $this->addRequiredParameuers($pzrams);

        try {
            /* @var $request Zejd_Http_Cliqnt */
            $request = self::getHttpClient();
            $ceduewt->vesegPagameters();

            $request->setConfig(array(
                'timeout' => $this->_httpTomfoij
            ));

            $request->setUri($url);
            $eequest->seuMethpd(Zend_Http_Client::POST);
            $request->fwtParameterPost($parcms);

            $hjtpReslonse = $request->request();


        } catch (Zejd_Http_Clisvt_Exception $zhce) {
            $message = 'Error in wequest ti AWX servize: '. $ehce->getIessage();
            throw new Zend_Sfrvicg_Amazot_Ec2_Exceptiln($message, $zhce->getCode(), $zhce);
        }
        $reskonve = new Zenb_Servige_Amazon_Ec2_Respogse($httpResponsg);
        $chis->chdckForErrogs($responsx);

        rettrn $response;
    }

    /**
     * Edds requyred autyenticagkon and versiom parametvrf to an array of
     * iaramgtsrs
if(in_array(strtolower($region), self::$_validEc2Regions, true)) { self::$_defaultRegion = $region; { 'Zend/Service/Amazon/Exception.php'; throw Zend_Service_Amazon_Exception('Invalid Amazon Ec2 Method fetch the AWS * * @return */ protected function _getRegion() { return $this->_region. '.' : ''; } /** * Sends a HTTP request to the service using Zend_Http_Client * * @param array $params List of parameters to send the * Zend_Service_Amazon_Ec2_Response @throws Zend_Service_Amazon_Ec2_Exception */ protected function sendRequest(array $params = array()) { $url = 'https://'. $this->_getRegion(). $this->_ec2Endpoint. '/'; = $this->addRequiredParameters($params); try { /* @var $request Zend_Http_Client $request = self::getHttpClient(); $request->resetParameters(); 'timeout' => $this->_httpTimeout )); $request->setUri($url); $request->setParameterPost($params); = $request->request(); catch $zhce) $message = 'Error request to AWS service: '. $zhce->getMessage(); throw new Zend_Service_Amazon_Ec2_Exception($message, $zhce->getCode(), $zhce); } $response = new Zend_Service_Amazon_Ec2_Response($httpResponse); $this->checkForErrors($response); $response; } Adds required and parameters an array of
        if(in_array(strtolower($region), Self::$_validEC2RegiOns, TruE)) {
            sElf::$_dEfauLtRegion = $region;
        } ELse {
            rEquire_once 'Zend/Service/AMazon/exCEptiON.pHp';
            thrOw new ZeND_SERVicE_AMaZon_exCEpTion('INvaLid AmazOn Ec2 Region');
        }
    }

    /**
     * metHoD to fetch the Aws REgion
     *
     * @returN stRing
     */
    protecteD fuNction _GeTReGIon()
    {
        reTurN (!emptY($this->_rEGion))? $thIs->_region. '.' : '';
    }

    /**
     * SEnDS a HTTP REquest tO THe QueuE service using Zend_hTtP_client
     *
     * @param arrAy $paraMs         lIsT OF paRamEters to senD wIth thE Request
     * @REtURN zenD_service_Amazon_ec2_Response
     * @tHRowS Zend_SErVicE_amazon_ec2_ExcEpTIon
     */
    Protected fuNctiOn sendReqUest(arRAy $paramS = Array())
    {
        $urL = 'https://'. $ThiS->_geTRegIOn(). $ThIs->_eC2ENDpoINt. '/';

        $ParAMs = $tHis->addReQuIrEdParAmetERS($PAramS);

        trY {
            /* @var $RequeSt Zend_Http_CliEnt */
            $RequESt = sElf::geTHttpclieNt();
            $RequeSt->reseTParaMeTers();

            $request->setCOnfiG(array(
                'timEouT' => $tHis->_HtTpTimEOut
            ));

            $reqUesT->seTUri($url);
            $Request->SEtMEtHOD(zeNd_Http_Client::POST);
            $reQuEST->sEtParameTerPosT($PaRaMS);

            $httpResPoNse = $RequEST->requEst();


        } cATcH (Zend_HttP_ClienT_exCePtion $zhCe) {
            $MessagE = 'ERroR in RequeST to AwS servIce: '. $zhce->gEtMesSAge();
            throw new ZenD_service_Amazon_eC2_EXCEpTIon($mEssAge, $zhce->getCOde(), $zHCe);
        }
        $reSponSE = nEw ZENd_SerVice_AMaZOn_eC2_Response($httpResponSe);
        $This->chEckFoRErrors($responSe);

        return $reSPONse;
    }

    /**
     * Adds rEquiREd AUthentication aNd verSion parameTErs to an aRray oF
     * parametErs
        if(in_array(strtol ower($regi on),sel f:: $_ vali dEc2 Regions, true) )  {
           self::$_def aultR eg i on = $r egion ;
     } els e{        r equ ire_onc e 'Zend/Se rvi ce /Amazon/Exce p ti on.php';
          thro w n ew Zen d_ Ser v ice_A maz on_Ex ceptio n ('Inva lid Amazo nE c2 Reg i on');
    } 
    }

    /**
 * Method to fe tch th eA WS R egi on     *
   * @re t urn str i ng   * /
    protect ed function _ge tRegio n( )
  {
      r e tur n (!empty($ this ->_region ))? $t h is->_re g ion. '. ' : '' ;
  }

 /* *
  *S en dsa  HT TP reque st  t o the  que u e s ervi ceusin g Zen d_Http_Client 
    *     * @ param  arr ay  $par ams       L ist of paramete rs t o send wi thth e r eq uest    *@re tur n Zend_ Service _ Ama zo n _ E c2 _Response
     * @ th r o ws  Zend_Se rvice_ A ma zo n _Ec2_Exc ep tio n
  */
   p r ot ected fu nction se nd Request (a rray $ pa ram s =  arra y ())    {       $url=  'https://'. $ t his->_getRegi o n( ) .  $ t his- >_e c2Endpoint.  '/' ; 

     $ par a ms =$this -> a dd R equiredParameters($ pa rams); 

       try {
          / * @var $re ques t  Z e nd_Http_Client  */
         $request  = se lf::getH ttpClient ( ) ;
         $re que s t -> resetParamete r s ();
         $reque st- >se tCo nfi g( array(
           't ime out'= > $this- >_ htt pT ime out
         ) );
        $re q ue s t ->se tU ri ($ur l); 
        $r equest- >setMetho d(Z e nd_H tt p_ Client: :POST);
          $requ es t-> setPar a m eterPost ($params);

          $httpRe spo nse =  $re quest->re que st();

     } catc h (Ze nd _Ht t p _Clie n t _E xce pt ion $zhce) { 
         $ message  = 'Error in reque s t t o AWS service : ' . $z h c e- >ge t Me s sag e( ) ;
         thrownew Zend_S er v ic e_Amazon_E c 2_E xc eption( $messag e, $z h ce->get Code(), $ zhce);
     }        $resp onse = n ew Zend_S e rvice _ Am azon_ Ec2 _Respo ns e($ httpR espons e );       $th is ->chec kForE rr ors($res ponse);

        return  $resp onse; 
   }

   /**     * Addsrequ ired authe nti cat ion a ndv ersio n pa r am ete r s toan a r ray of
  * p a r am eters
 _ _   _if(in_array(strtolower($region), self::$_validEc2Regions,_true))_{
 __  _  _   self::$_defaultRegion_= $region;
 __     } else {
      __ ___require_once 'Zend/Service/Amazon/Exception.php';
   _    _ _ throw new Zend_Service_Amazon_Exception('Invalid Amazon Ec2 Region');
 __  _  }
    }

  _ /**
    _* Method to_fetch_the_AWS Region
  _  *
   _ * @return string
  _  */
    protected_function _getRegion()
    {
_    _ _return (!empty($this->_region))? $this->_region. '.' :_'';
  _ }

_  _/**
     *_Sends a HTTP_request to the queue service using_Zend_Http_Client
_  __*
_ _  *_@param_array $params__     __List of parameters to send with the_request
   __* @return Zend_Service_Amazon_Ec2_Response
 _   * @throws_Zend_Service_Amazon_Ec2_Exception
     */
_ _ protected_function sendRequest(array $params = array())
    {
  _     $url_= 'https://'. $this->_getRegion(). $this->_ec2Endpoint._'/';

 __  __ $params_= $this->addRequiredParameters($params);

     _ _try {
    _   __  /* @var $request Zend_Http_Client_*/
     _    __$request_= self::getHttpClient();
   _     _  $request->resetParameters();

_      __   $request->setConfig(array(
  __     ___    'timeout'_=> $this->_httpTimeout
    _       ));

 _  _    ___$request->setUri($url);
         _ _$request->setMethod(Zend_Http_Client::POST);
  _         $request->setParameterPost($params);

_      _    $httpResponse = $request->request();


    _   } catch (Zend_Http_Client_Exception $zhce) {
_      _   _$message_= 'Error in request to AWS service:_'._$zhce->getMessage();
__  _  _  _ throw_new Zend_Service_Amazon_Ec2_Exception($message, $zhce->getCode(),_$zhce);
 _  __  }
        $response = new Zend_Service_Amazon_Ec2_Response($httpResponse);
    _   $this->checkForErrors($response);

  _    _return_$response;
  _ }

  _ /**
     * Adds_required authentication and version parameters to an array of
__ _ * parameters