1

Using Laravel with OpenCloud/OpenStack, I can create a container using the createContainer function but it creates a private container by default and I would like to create a container with public read access (which can be done from the hosting provider portal).

Here is my code:

$client = app()->make('OpenCloud\OpenStack');    
$service = $client->objectStoreService('swift', $data_center);    
$container = $service->createContainer($container_name);    
// trying to find how to set $container read access ???
mana
  • 6,347
  • 6
  • 50
  • 70

1 Answers1

0

Since by default swift container are not public, you can change that by changing the container metadata.

This might work:

$metadata = $container->appendToMetadata(array(
    'X-Container-Read' =>: '.r:*'
));

[1]http://docs.php-opencloud.com/en/latest/services/object-store/containers.html#create-or-update-container-metadata

[2]https://ask.openstack.org/en/question/80609/how-to-make-a-container-public-in-swift-rest-api/

Nelson Marcos
  • 477
  • 2
  • 16
  • Does not work for me. I tried to make the metadata of private container exactly the same as public container and still show up as private on my OVH dashboard. Thanks for the links. Will try with [2]. – user3280979 May 19 '17 at 15:49