简体   繁体   English

使用php-opencloud列出启用CDN的机架式容器

[英]List rackspace CDN-enabled containers with php-opencloud

The documentation states 文档说明

To list CDN-only containers, follow the same operation for Storage which lists all containers. 要列出仅CDN的容器,请对存储列出所有容器进行相同的操作。 The only difference is which service object you execute the method on. 唯一的区别是您在哪个服务对象上执行该方法。

But what is the right service object. 但是正确的服务对象是什么。 I tried: 我试过了:

$service = objectStoreService('cloudFiles', $region);
$service = objectStoreCDNService('cloudFilesCDN', $region);
$service = objectStoreCDNService('cloudFiles', $region);
$service = objectStoreService('cloudFilesCDN', $region);

And $containers = $service->listContainers() or $containers->listContainers(array('enabled_only' => TRUE)) with all of the above to no avail. $containers = $service->listContainers()$containers->listContainers(array('enabled_only' => TRUE))以上均无济于事。

As you've already noticed, you need to provide the enabled_only query parameter in order to retrieve CDN-enabled containers. 正如您已经注意到的,您需要提供enabled_only查询参数才能检索启用CDN的容器。

You're going wrong because your true is being converted to 1 in the URL. 您出了错,因为您的true在URL中被转换为1 This is a natural boolean conversion. 这是自然的布尔转换。 The API, however, seems to be expecting a string. 但是,API似乎期望使用字符串。 Changing it to: 更改为:

$containers = $service->listContainers(array(
   'enabled_only' => 'true'
));

should work. 应该管用。


What happens if you perform the operation on the CDN service: 如果您在CDN服务上执行该操作会发生什么:

$containers = $service->getCdnService()->listContainers();

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

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