/** * Relies upon environment variable settings — these are the same environment * variables that are used by python-novaclient. Just make sure that they're * set to the right values before running this test. define('AUTHURL', $_ENV['NOVA_URL']); define('USERNAME', $_ENV['OS_USERNAME']); define('TENANT', $_ENV['OS_TENANT_NAME']); define('APIKEY', $_ENV['NOVA_API_KEY']); */ define('AUTHURL', 'https://identity.api.rackspacecloud.com/v2.0/'); define('USERNAME', 'onyourblog'); define('APIKEY', 'b3fa0f633b6f09d61c8e37b2b414769b'); $cloud = new \OpenCloud\Rackspace(AUTHURL, array('username' => USERNAME, 'apiKey' => APIKEY)); $cloud->Authenticate(); $arr = $cloud->ExportCredentials(); printf("%s Token [%s] expires in %5d seconds\n", date('r'), $arr['token'], $arr['expiration'] - time()); echo '<br>'; if ($cloud) { echo 'rackspace connection established<br>'; $cloud->SetDefaults('ObjectStore', 'cloudFiles', 'ORD'); $ostore = $cloud->ObjectStore(); // uses default values if ($ostore) { echo 'ostore opened<br>'; $containerlist = $ostore->ContainerList(); while ($container = $containerlist->Next()) { // do something with the container printf("Container %s has %u bytes<br>", $container->name, $container->bytes); } $oyb_01 = $ostore->Container('oyb_01');
* */ require_once "../lib/php-opencloud.php"; /** * Relies upon environment variable settings — these are the same environment * variables that are used by python-novaclient. Just make sure that they're * set to the right values before running this test. define('AUTHURL', $_ENV['NOVA_URL']); define('USERNAME', $_ENV['OS_USERNAME']); define('TENANT', $_ENV['OS_TENANT_NAME']); define('APIKEY', $_ENV['NOVA_API_KEY']); */ define('AUTHURL', 'https://identity.api.rackspacecloud.com/v2.0/'); define('USERNAME', 'onyourblog'); define('TENANT', '839319'); define('APIKEY', 'b3fa0f633b6f09d61c8e37b2b414769b'); $mysecret = array('username' => 'onyourblog', 'password' => 'YVR2013ca'); // establish our credentials if ($connection = new \OpenCloud\OpenStack(AUTHURL, $mysecret)) { echo 'connection established'; } else { echo 'connection failed'; } $rackspace = new \OpenCloud\Rackspace(AUTHURL, array('username' => USERNAME, 'apiKey' => APIKEY)); //while(TRUE) { $rackspace->Authenticate(); $arr = $rackspace->ExportCredentials(); printf("%s Token [%s] expires in %5d seconds\n", date('r'), $arr['token'], $arr['expiration'] - time()); // sleep(60); //}
printf("SmokeTest started at %s\n", date(TIMEFORMAT, $start)); printf("Using endpoint [%s]\n", $_ENV['NOVA_URL']); printf("Using region [%s]\n", MYREGION); step('Authenticate'); $secret = array('username' => USERNAME, 'apiKey' => APIKEY); $rackspace = new \OpenCloud\Rackspace(AUTHURL, $secret); $rackspace->AppendUserAgent('(PHP SDK SMOKETEST)'); /** * load cached credentials */ $fp = @fopen(CACHEFILE, 'r'); if (!$fp) { // no cached credentials info('Saving credentials in %s', CACHEFILE); $rackspace->Authenticate(); $cred = $rackspace->ExportCredentials(); $fp = @fopen(CACHEFILE, 'w'); if (!$fp) { die(sprintf("Cannot open cache file %s for writing\n", CACHEFILE)); } fwrite($fp, serialize($cred)); fclose($fp); } else { // load cached credentials info('Loading credentials from %s', CACHEFILE); $str = fread($fp, 99999); // read it all fclose($fp); $rackspace->ImportCredentials(unserialize($str)); } /**