简体   繁体   中英

How do you create / delete containers with laravel-rackspace-opencloud?

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.

Please follow the steps to create / delete file containers

  1. 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()); } 
  1. 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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM