将Laravel与OpenCloud/OpenStack一起使用,我可以使用CreateContainer函数创建一个容器,但它默认情况下创建一个私人容器,我想创建一个带有公共读取访问的容器(可以可以从托管提供商门户网站完成)。
这是我的代码:
$client = app()->make('OpenCloudOpenStack');
$service = $client->objectStoreService('swift', $data_center);
$container = $service->createContainer($container_name);
// trying to find how to set $container read access ???
由于默认情况下,Swift容器不是公共的,因此您可以通过更改容器元数据来更改它。
这可能有效:
$metadata = $container->appendToMetadata(array(
'X-Container-Read' =>: '.r:*'
));
[1] http://docs.php-opencloud.com/en/latest/services/object-store/containers.html#create-or-preate-orpdate-container-container-metadata
[2] https://ask.openstack.org/en/question/80609/how-to-to-make-a-container-public-public-in-swift-rest-rest-api/