This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use OpenCloud\Rackspace; | |
use Guzzle\Log\MessageFormatter; | |
use Guzzle\Log\ClosureLogAdapter; | |
use Guzzle\Plugin\Log\LogPlugin; | |
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array( | |
'username' => 'foo', | |
'apiKey' => 'bar', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use OpenCloud\Rackspace; | |
$client = new Rackspace(Rackspace::UK_IDENTITY_ENDPOINT, [ | |
'username' => 'foo', | |
'apiKey' => 'bar' | |
]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use OpenCloud\ObjectStore\Constants\UrlType; | |
// Will perform a HEAD operation, not a GET | |
$video = $container->getPartialObject($filename); | |
// Finds content-length from header, rather than entity body | |
if ($video->getContentLength()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use OpenCloud\Rackspace; | |
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array( | |
'username' => 'foo', | |
'apiKey' => 'bar', | |
'ssl.certificate_authority' => false | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Guzzle\Http\Exception\BadResponseException; | |
$url = clone $cinderService->getUrl(); | |
$url->addPath('volumes'); | |
$body = json_encode(array( | |
'size' => $vol_size, | |
'imageRef' => $img_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First, retrieve the user | |
$user = $instance->user('<user_name>'); | |
// Second, add the DB by name | |
$user->addDatabase('<db_name>'); | |
// Third, update | |
$user->update(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use OpenCloud\Rackspace; | |
$cloud = new OpenCloud\Rackspace(Rackspace::UK_IDENTITY_ENDPOINT, array( | |
'username' => 'tescloud', | |
'apiKey' => '___My___API___Key' | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Guzzle\Http\Exception\ClientErrorResponseException; | |
try { | |
// your code | |
} catch (ClientErrorResponseException $e) { | |
// Output HTTP request | |
echo $e->getRequest(), PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use OpenCloud\Compute\Constants\ServerState; | |
$callback = function($server) { | |
if (!empty($server->error)) { | |
var_dump($server->error); | |
exit; | |
} else { | |
echo sprintf( | |
"Waiting on %s/%-12s %4s%%", | |
$server->name, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use OpenCloud\Rackspace; | |
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array( | |
'username' => 'foo', | |
'apiKey' => 'bar' | |
)); | |
$service = $client->databaseService('cloudDatabases', 'DFW'); | |
$instance = $service->instance('<instance_id>'); |