예제 #1
0
파일: clone.php 프로젝트: omusico/home365
<?php

// (c)2012 Rackspace Hosting
// See COPYING for licensing information
require_once "php-opencloud.php";
// set this to the name of the domain to export
define('EXPORT_DOMAIN', 'fipplefippleraxdrg.info');
define('AUTHURL', RACKSPACE_US);
define('USERNAME', $_ENV['OS_USERNAME']);
define('TENANT', $_ENV['OS_TENANT_NAME']);
define('APIKEY', $_ENV['NOVA_API_KEY']);
// establish our credentials
$cloud = new \OpenCloud\Rackspace(AUTHURL, array('username' => USERNAME, 'apiKey' => APIKEY));
// uncomment to turn on debugging
//setDebug(TRUE);
$dns = $cloud->DNS();
$dlist = $dns->DomainList(array('name' => EXPORT_DOMAIN));
while ($domain = $dlist->Next()) {
    printf("Cloning %s\n", $domain->Name());
    //setDebug(TRUE);
    $resp = $domain->CloneDomain('NEWDOMAIN.IO');
    //setDebug(FALSE);
    $resp->WaitFor('COMPLETED', 300, 'ShowStatus', 1);
    // check result
    if ($resp->Status() == 'ERROR') {
        printf("Error code [%d] message [%s]\nDetails: [%s]\n", $resp->error->code, $resp->error->message, $resp->error->details);
    } else {
        if ($resp->Status() != 'COMPLETED') {
            printf("Unable to wait longer. Sorry.\n");
        }
    }
예제 #2
0
파일: cleanup.php 프로젝트: omusico/home365
    }
}
step('Deleting unused volumes');
$list = $cbs->VolumeList();
while ($vol = $list->Next()) {
    if (in_array($vol->Status(), array('in-use', 'attaching'))) {
        info('Volume [%s] %s is %s', $vol->id, $vol->Name(), $vol->Status());
    } else {
        try {
            info('Deleting volume [%s] %s', $vol->id, $vol->Name());
            $vol->Delete();
        } catch (OpenCloud\DeleteError $e) {
            info('---Unable to delete volume [%s]', $vol->Name());
        }
    }
}
step('Deleting database instances');
$dbservice = $rackspace->DbService('cloudDatabases', MYREGION);
$list = $dbservice->InstanceList();
while ($instance = $list->Next()) {
    info('Deleting %s', $instance->Name());
    $instance->Delete();
}
step('Deleting DNS entries');
$dns = $rackspace->DNS();
$list = $dns->DomainList();
while ($domain = $list->Next()) {
    info('Deleting domain %s', $domain->Name());
    $domain->Delete();
}
step('DONE');