The documentation states
To list CDN-only containers, follow the same operation for Storage which lists all containers. 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.
As you've already noticed, you need to provide the enabled_only
query parameter in order to retrieve CDN-enabled containers.
You're going wrong because your true
is being converted to 1
in the URL. This is a natural boolean conversion. The API, however, seems to be expecting a string. Changing it to:
$containers = $service->listContainers(array(
'enabled_only' => 'true'
));
should work.
What happens if you perform the operation on the CDN service:
$containers = $service->getCdnService()->listContainers();
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.