Вопрос

I am having problems trying to get the Rackspace Opencloud API to work as expected (particularly the cloud files).

I have been following these guides:

https://github.com/rackspace/php-opencloud/blob/master/docs/userguide/ObjectStore/Access.md http://docs.rackspace.com/sdks/api/php/namespace-OpenCloud.ObjectStore.html

The Authentication seems to work fine because a token and the service catalog is returned.

header("Content-Type: text/plain");
require '/vendor/autoload.php';

use OpenCloud\Rackspace;

$client = new Rackspace('https://lon.identity.api.rackspacecloud.com/v2.0/', array(
    'username' => 'MY_USERNAME',
    'apiKey'   => 'MY_APIKEY'
));

$client->authenticate();

echo 'Authenticated with token: '.$client->getToken()."\n\n";

print_r($client->getCatalog());

My problems start when i try to use a service from the API:

$service = $client->objectStoreService('cloudFiles');

This line kills the code. I have copied the Rackspace documentation line for line but still no luck, I am unable to get any of the services to work.

Can anyone see where I'm going wrong or provide any tips for the best way to troubleshoot this issue?

Это было полезно?

Решение

Specify the region explicitly

You need to explicitly choose the region you want to use. From your identity line, it looks like you'll need to set it to LON.

$service = $client->objectStoreService('cloudFiles', 'LON'); # Or IAD, HKG, SYD, etc.

Side note: I just submitted a pull request on php-opencloud to make this more clear in the documentation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top