Reputation: 1039
I'm using the laravel-rackspace-opencloud package to manage files on RackSpace's cloud files platform. Is it possible to use this library to create / delete file containers? I've not been able to find an example of this, and the README only seems to reference the management of files within containers that have already been created.
Upvotes: 0
Views: 365
Reputation: 1804
Please follow the steps to create / delete file containers
create rack-space file containers with laravel
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => 'XXXXXX','apiKey' => 'XXXXXX'));
try{
$ContainerName = 'todo'; // static for now
$objectStoreService = $client->objectStoreService(null, 'DFW');
$container = $objectStoreService->createContainer($ContainerName);
} catch (Guzzle\Http\Exception\ClientErrorResponseException $e) {
Log::info($e->getResponse());
}
- Delete Containers
//1. conneciton
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => 'XXXXXX','apiKey' => 'XXXXXX'));
// 2. get region
$objectStoreService = $client->objectStoreService(null, 'DFW');
// 3. Get container.
$container = $objectStoreService->getContainer('{containerName}');
// 4. Delete container.
$container->delete();
Upvotes: 1