コード例 #1
0
ファイル: Ec2Test.php プロジェクト: sasezaki/mirror-zf1-tests
 public function testFactoryReturnsSecurityGroupsObject()
 {
     $object = Zend_Service_Amazon_Ec2::factory('security', 'access_key', 'secret_access_key');
     $this->assertType('Zend_Service_Amazon_Ec2_Securitygroups', $object);
 }
コード例 #2
0
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('App_');
$configFile = APPLICATION_PATH . '/etc/config.ini';
if (!is_file($configFile) || !is_readable($configFile)) {
    $msg = 'The file "' . $configFile . "' does either not exist or is not readable\n\n";
    die($msg);
}
$config = new Zend_Config_Ini(APPLICATION_PATH . '/etc/config.ini');
try {
    $opts = App_Console_Getopt::getInstance();
    $opts->parseAndMergeWithConfig($config);
} catch (Zend_Console_Getopt_Exception $e) {
    echo $e->getMessage() . "\n\n";
    echo $opts->getUsageMessage();
    exit;
}
$ebs = Zend_Service_Amazon_Ec2::factory('ebs', $opts->getOption('access-key'), $opts->getOption('secret-key'));
/* @var $ebs Zend_Service_Amazon_Ec2_Ebs */
$prune = new App_Service_Amazon_Ec2_EbsSnapshotPrune($ebs);
try {
    $result = $prune->prune($opts->getOption('volume'), $opts->getOption('dry-run'));
} catch (Exception $e) {
    echo 'There was an error running ' . __FILE__ . "\n" . 'Error Message: ' . $e->getMessage() . "\n\n";
    echo $opts->getUsageMessage();
    exit;
}
if ($opts->getOption('quiet')) {
    exit;
}
echo $result->printSummary();