[英]How do you create / delete containers with laravel-rackspace-opencloud?
我正在使用laravel-rackspace-opencloud软件包来管理RackSpace的云文件平台上的文件。 是否可以使用此库创建/删除文件容器? 我找不到这样的示例,自述文件似乎仅引用已创建容器中文件的管理。
请按照以下步骤创建/删除文件容器
使用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()); }
- 删除容器
//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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.