[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Service/Amazon/ -> Ec2.php (source)

   1  <?php
   2  /**
   3   * Zend Framework
   4   *
   5   * LICENSE
   6   *
   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 [email protected] so we can send you a copy immediately.
  14   *
  15   * @category   Zend
  16   * @package    Zend_Service
  17   * @subpackage Amazon
  18   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20   * @version    $Id$
  21   */
  22  
  23  /**
  24   * Amazon Ec2 Interface to allow easy creation of the Ec2 Components
  25   *
  26   * @category   Zend
  27   * @package    Zend_Service
  28   * @subpackage Amazon
  29   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  30   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  31   */
  32  class Zend_Service_Amazon_Ec2
  33  {
  34      /**
  35       * Factory method to fetch what you want to work with.
  36       *
  37       * @param string $section           Create the method that you want to work with
  38       * @param string $key               Override the default aws key
  39       * @param string $secret_key        Override the default aws secretkey
  40       * @throws Zend_Service_Amazon_Ec2_Exception
  41       * @return object
  42       */
  43      public static function factory($section, $key = null, $secret_key = null)
  44      {
  45          switch(strtolower($section)) {
  46              case 'keypair':
  47                  $class = 'Zend_Service_Amazon_Ec2_Keypair';
  48                  break;
  49              case 'eip':
  50                  // break left out
  51              case 'elasticip':
  52                  $class = 'Zend_Service_Amazon_Ec2_Elasticip';
  53                  break;
  54              case 'ebs':
  55                  $class = 'Zend_Service_Amazon_Ec2_Ebs';
  56                  break;
  57              case 'availabilityzones':
  58                  // break left out
  59              case 'zones':
  60                  $class = 'Zend_Service_Amazon_Ec2_Availabilityzones';
  61                  break;
  62              case 'ami':
  63                  // break left out
  64              case 'image':
  65                  $class = 'Zend_Service_Amazon_Ec2_Image';
  66                  break;
  67              case 'instance':
  68                  $class = 'Zend_Service_Amazon_Ec2_Instance';
  69                  break;
  70              case 'security':
  71                  // break left out
  72              case 'securitygroups':
  73                  $class = 'Zend_Service_Amazon_Ec2_Securitygroups';
  74                  break;
  75              default:
  76                  throw new Zend_Service_Amazon_Ec2_Exception('Invalid Section: ' . $section);
  77                  break;
  78          }
  79  
  80          if (!class_exists($class)) {
  81              require_once 'Zend/Loader.php';
  82              Zend_Loader::loadClass($class);
  83          }
  84          return new $class($key, $secret_key);
  85      }
  86  }
  87  


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1