예제 #1
0
파일: listlb.php 프로젝트: omusico/home365
 * numbers each step
 */
function step($msg, $p1 = NULL, $p2 = NULL, $p3 = NULL)
{
    global $STEPCOUNTER;
    printf("\nStep %d. %s\n", ++$STEPCOUNTER, sprintf($msg, $p1, $p2, $p3));
}
function info($msg, $p1 = NULL, $p2 = NULL, $p3 = NULL, $p4 = NULL, $p5 = NULL)
{
    printf("  %s\n", sprintf($msg, $p1, $p2, $p3, $p4, $p5));
}
define('TIMEFORMAT', 'r');
step('Authenticate');
$rackspace = new \OpenCloud\Rackspace(AUTHURL, array('username' => USERNAME, 'apiKey' => APIKEY));
step('Connect to the Load Balancer Service');
$lbservice = $rackspace->LoadBalancerService('cloudLoadBalancers', 'DFW');
// allowed domains
$adlist = $lbservice->AllowedDomainList();
while ($ad = $adlist->Next()) {
    info('Allowed domain: [%s]', $ad->Name());
}
// protocols
info('Protocols:');
$prolist = $lbservice->ProtocolList();
while ($prot = $prolist->Next()) {
    info('  %s %4d', substr($prot->Name() . '.....................', 0, 20), $prot->port);
}
// algorithms
info('Algorithms:');
$alist = $lbservice->AlgorithmList();
while ($al = $alist->Next()) {
예제 #2
0
파일: cleanup.php 프로젝트: omusico/home365
step('Deleting the test network(s)');
$list = $cloudservers->NetworkList();
while ($network = $list->Next()) {
    info('Deleting: %s %s', $network->id, $network->label);
    try {
        $network->Delete();
    } catch (OpenCloud\Common\Exceptions\DeleteError $e) {
        info('---Cannot delete');
    }
}
step('Connect to CBS');
$cbs = $rackspace->VolumeService('cloudBlockStorage', MYREGION);
step('Connect to Cloud Files');
$files = $rackspace->ObjectStore('cloudFiles', MYREGION);
step('Connect to Cloud Load Balancers');
$lbservice = $rackspace->LoadBalancerService('cloudLoadBalancers', MYREGION);
step('Deleting snapshots');
$list = $cbs->SnapshotList();
while ($snap = $list->Next()) {
    if ($snap->Status() == 'error' || $snap->Status() == 'available') {
        info('Deleting snapshot [%s] %s', $snap->id, $snap->Name());
        $snap->Delete();
    } else {
        info('[%s] %s status is %s', $snap->id, $snap->Name(), $snap->Status());
    }
}
step('Deleting objects');
$list = $files->ContainerList();
while ($container = $list->Next()) {
    info('Container: %s', $container->Name());
    $objlist = $container->ObjectList();