Sha256: a00a20b7ca53fac22c14e53b577593817966e864fe0254371d955288e8d01674

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

<?php
require('vendor/autoload.php');
use OpenCloud\Rackspace;

$endpoint = getenv('RAX_AUTH_URL') . '/v2.0/';
$credentials = array(
    'username' => getenv('RAX_USERNAME'),
    'apiKey'   => getenv('RAX_API_KEY')
);

$rackspace = new Rackspace($endpoint, $credentials);
$compute   = $rackspace->computeService('cloudServersOpenStack', getenv('RAX_REGION'));

$image_id  = getenv('SERVER1_IMAGE');
$flavor_id = getenv('SERVER1_FLAVOR');

// Create a server in DFW
$server    = $compute->Server();
// create it
print("Creating server...");
$server->create(array(
    'name' => 'php-opencloud server',
    // Using the image ID from ORD
    'image' => $compute->image($image_id),
    // And a flavor that's too small
    'flavor' => $compute->flavor($flavor_id)
));
print("requested, now waiting...\n");
print("ID=" . $server->id . "...\n");
$server->WaitFor("ACTIVE", 600, 'dot');
print("done\n");
exit(0);

function dot($server)
{
    printf("%s %3d%%\n", $server->status, $server->progress);
}

?>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polytrix-0.0.1 sdks/php-opencloud/challenges/create_server.php