[英]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.