Exemplo n.º 1
0
 /**
  * @return CnameConfig
  */
 protected function parseDataFromResponse()
 {
     $content = $this->rawResponse->body;
     $config = new CnameConfig();
     $config->parseFromXml($content);
     return $config;
 }
Exemplo n.º 2
0
 public function testCnameNumberLimit()
 {
     $cnameConfig = new CnameConfig();
     for ($i = 0; $i < CnameConfig::OSS_MAX_RULES; $i += 1) {
         $cnameConfig->addCname(strval($i) . '.foo.com');
     }
     try {
         $cnameConfig->addCname('www.foo.com');
         $this->assertFalse(true);
     } catch (OssException $e) {
         $this->assertEquals($e->getMessage(), "num of cname in the config exceeds self::OSS_MAX_RULES: " . strval(CnameConfig::OSS_MAX_RULES));
     }
 }
Exemplo n.º 3
0
 /**
  * 解除指定Bucket的CNAME绑定
  *
  * @param string $bucket bucket名称
  * @param CnameConfig $cnameConfig
  * @param array $options
  * @throws OssException
  * @return null
  */
 public function deleteBucketCname($bucket, $cname, $options = NULL)
 {
     $this->precheckCommon($bucket, NULL, $options, false);
     $options[self::OSS_BUCKET] = $bucket;
     $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
     $options[self::OSS_OBJECT] = '/';
     $options[self::OSS_SUB_RESOURCE] = 'cname';
     $options[self::OSS_CONTENT_TYPE] = 'application/xml';
     $cnameConfig = new CnameConfig();
     $cnameConfig->addCname($cname);
     $options[self::OSS_CONTENT] = $cnameConfig->serializeToXml();
     $options[self::OSS_COMP] = 'delete';
     $response = $this->auth($options);
     $result = new PutSetDeleteResult($response);
     return $result->getData();
 }