/** * 解析Lifestyle数据 * * @return LifecycleConfig */ protected function parseDataFromResponse() { $content = $this->rawResponse->body; $config = new LifecycleConfig(); $config->parseFromXml($content); return $config; }
/** * 设置Bucket的Lifecycle配置 * * @param string $bucket bucket名称 * @param LifecycleConfig $lifecycleConfig Lifecycle配置类 * @param array $options * @throws OssException * @return null */ public function putBucketLifecycle($bucket, $lifecycleConfig, $options = NULL) { $this->precheckCommon($bucket, NULL, $options, false); $options[self::OSS_BUCKET] = $bucket; $options[self::OSS_METHOD] = self::OSS_HTTP_PUT; $options[self::OSS_OBJECT] = '/'; $options[self::OSS_SUB_RESOURCE] = 'lifecycle'; $options[self::OSS_CONTENT_TYPE] = 'application/xml'; $options[self::OSS_CONTENT] = $lifecycleConfig->serializeToXml(); $response = $this->auth($options); $result = new PutSetDeleteResult($response); return $result->getData(); }