简体   繁体   English

PHP OpenCloud / OpenStack如何为公共访问创建容器

[英]PHP OpenCloud/OpenStack how to create container for public access

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). 使用Laravel和OpenCloud / OpenStack,我可以使用createContainer函数创建一个容器,但它默认创建一个私有容器,我想创建一个具有公共读访问权限的容器(可以从托管提供者门户网站完成)。

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 ???

Since by default swift container are not public, you can change that by changing the container metadata. 由于默认情况下swift容器不公开,因此您可以通过更改容器元数据来更改它。

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 [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/ [2] https://ask.openstack.org/en/question/80609/how-to-make-a-container-public-in-swift-rest-api/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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