예제 #1
0
            case '--help':
                printf(<<<ENDHELP
Switches:

    -C --catalog    Display service catalog
    -H --help       Display help message

ENDHELP
);
                exit;
            default:
        }
    }
}
step('Listing Services');
$list = $rackspace->ServiceList();
#print_r($rackspace->ServiceCatalog());
$list->Sort('name');
while ($service = $list->Next()) {
    info('Name: %s Type: %s', $service->name, $service->type);
    foreach ($service->endpoints as $endpoint) {
        info('  %-60s (%s)', substr($endpoint->publicURL, 0, 60), isset($endpoint->region) ? $endpoint->region : 'N/A');
    }
}
step('Only list services in DFW');
$list = $rackspace->ServiceList();
$list->Select(function ($item) {
    foreach ($item->endpoints as $endpoint) {
        if (isset($endpoint->region) && $endpoint->region == 'DFW') {
            return true;
        }