Final updates to CDN.
This commit is contained in:
@@ -257,6 +257,10 @@ class CDN {
|
||||
* ?>
|
||||
* @endcode
|
||||
*
|
||||
* @attention
|
||||
* The $enabledOnly flag sendes \c enabled_only to the
|
||||
* endpoint. The endpoint may or may not honor this.
|
||||
*
|
||||
* @param boolean $enabledOnly
|
||||
* If this is set to TRUE, then only containers that are
|
||||
* CDN-enabled will be returned.
|
||||
@@ -266,13 +270,18 @@ class CDN {
|
||||
* @throws HPCloud::Exception
|
||||
* An HTTP-level exception on error.
|
||||
*/
|
||||
public function containers($enabledOnly = FALSE) {
|
||||
public function containers($enabledOnly = NULL) {
|
||||
$client = \HPCloud\Transport::instance();
|
||||
$url = $this->url . '/?format=json';
|
||||
|
||||
if ($enabledOnly) {
|
||||
$url .= '&enabled_only=true';
|
||||
}
|
||||
// DEVEX-1733 suggests that this should result in the
|
||||
// server listing only DISABLED containers.
|
||||
elseif ($enabledOnly === FALSE) {
|
||||
$url .= '&enabled_only=false';
|
||||
}
|
||||
|
||||
$headers = array(
|
||||
'X-Auth-Token' => $this->token,
|
||||
|
||||
@@ -154,6 +154,43 @@ class CDNTest extends \HPCloud\Tests\TestCase {
|
||||
return $cdn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ depends testDisable
|
||||
*/
|
||||
/* Temporarily removed. It's unclear what exactly
|
||||
* the correct behavior is supposed to be.
|
||||
public function testContainersEnabledOnly($cdn) {
|
||||
$cname = $this->conf('hpcloud.swift.container');
|
||||
|
||||
\HPCloud\Bootstrap::setConfiguration(array('transport.debug' => 1));
|
||||
$containers = $cdn->containers(TRUE);
|
||||
|
||||
throw new \Exception(print_r($containers, TRUE));
|
||||
|
||||
$found = 0;
|
||||
foreach ($containers as $container) {
|
||||
if ($container['name'] == $cname) {
|
||||
++$found;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(0, $found);
|
||||
|
||||
$containers = $cdn->containers(FALSE);
|
||||
$found = 0;
|
||||
foreach ($containers as $container) {
|
||||
if ($container['name'] == $cname) {
|
||||
++$found;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(1, $found);
|
||||
\HPCloud\Bootstrap::setConfiguration(array('transport.debug' => 0));
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @depends testDisable
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user