-
Notifications
You must be signed in to change notification settings - Fork 426
Add Region and bucket api #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
$this->iovipHost = $iovipHost; | ||
} | ||
|
||
//华东机房 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/Qiniu/Region.php
Outdated
return array(null, new Error($url, $ret)); | ||
} | ||
$r = ($ret->body === null) ? array() : $ret->json(); | ||
//print_r($ret); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试代码
生命规则接口添加
增加空间事件通知规则接口
examples/rs_delete_bucket.php
Outdated
@@ -0,0 +1,20 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件名 改成 delete_bucket.php 吧,
rs 概念不对外暴露,增加客户负担。
下同。
examples/uc_bucketLifecycleRule.php
Outdated
@@ -0,0 +1,24 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件名 同上
src/Qiniu/Config.php
Outdated
|
||
const BLOCK_SIZE = 4194304; //4*1024*1024 分块上传块大小,该参数为接口规格,不能修改 | ||
|
||
const RSF_HOST = 'rsf.qiniu.com'; | ||
const API_HOST = 'api.qiniu.com'; | ||
const RS_HOST = 'rs.qiniu.com'; //RS Host | ||
const UC_HOST = 'https://api.qiniu.com'; //UC Host | ||
const UC_HOST = 'uc.qbox.me'; //UC Host | ||
const RTCAPI_HOST = 'http://rtc.qiniuapi.com'; | ||
const ARGUS_HOST = 'argus.atlab.ai'; | ||
const RTCAPI_VERSION = 'v3'; | ||
|
||
// Zone 空间对应的机房 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Zone 空间对应的机房 ==》 // Zone 空间对应的存储区域
src/Qiniu/Region.php
Outdated
/* | ||
* GET /v2/query?ak=<ak>&&bucket=<bucket> | ||
**/ | ||
public static function queryZone($ak, $bucket) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryZone —> queryRegion ?
Travis 没有过 |
Line exceeds 120 characters
src/Qiniu/Storage/BucketManager.php
Outdated
|
||
public function listbuckets( | ||
$region = null, | ||
$global = 'false', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$global 废弃了把。
src/Qiniu/Storage/BucketManager.php
Outdated
* fs:如果为 true,会返回每个空间当前的文件数和存储量(实时数据)。 | ||
* @return string[] 包含空间信息 | ||
*/ | ||
public function bucketInfos($region = null, $global = 'false', $shared = 'false', $fs = 'false') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上 $global 废弃了。
src/Qiniu/Storage/BucketManager.php
Outdated
* 主备源会分开计算. | ||
* Backup 是否备用回源,回源优先尝试主源 | ||
*/ | ||
public function putBucktSourceConfig($params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array的参数还是限制下吧:
public function putBucktSourceConfig($params Array)
另外把 key 都注释清楚。
src/Qiniu/Storage/BucketManager.php
Outdated
/** | ||
* 获取空间回源配置 | ||
*/ | ||
public function getBucktSourceConfig($params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
src/Qiniu/Storage/BucketManager.php
Outdated
* allowed_credentials:该配置不支持设置,默认为true。 | ||
* 备注:如果没有设置任何corsRules,那么默认允许所有的跨域请求 | ||
*/ | ||
public function putCorsRules($bucket, $params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 如果我只看函数和备注的话,不清楚怎么过使用这个函数。
看了文档才明白:https://github.com/qbox/product/blob/dc594b8f5b7745337efbf67656702ef9429bf910/kodo/bucket/uc.md#corsrulesset-%E8%AE%BE%E7%BD%AEbucket%E7%9A%84cors%E8%B7%A8%E5%9F%9F%E8%A7%84%E5%88%99
Body:
[
{
"allowed_origin": ["http://www.test1.com"],
"allowed_method": ["GET", "POST"],
},
{
"allowed_origin": ["http://www.test2.com"],
"allowed_method": ["GET", "POST", "HEAD"],
"allowed_header": ["testheader", "Content-Type"],
"exposed_header": ["test1", "test2"],
"max_age": 20
}
]
所以 a. 修改下注释。 b. 这个一次只允许设置一条规则,函数比较清晰,设置参数就是:
{
"allowed_origin": ["http://www.test2.com"],
"allowed_method": ["GET", "POST", "HEAD"],
"allowed_header": ["testheader", "Content-Type"],
"exposed_header": ["test1", "test2"],
"max_age": 20
}
- 参数最好加上类型 (其他新加的函数都可以添加上)
public function putCorsRules(string $bucket, Array $params)
src/Qiniu/Storage/BucketManager.php
Outdated
* 主备源会分开计算. | ||
* Backup 是否备用回源,回源优先尝试主源 | ||
*/ | ||
public function putBucktSourceConfig(array $params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同 putCorsRules
return $this->postV2($url, $body); | ||
} | ||
|
||
private function postV2($url, $body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个删掉吧, 可读性不好。
把 private function post($url, $body)
改成: private function post($url, $body, $contentType = 'application/x-www-form-urlencoded')
@@ -407,6 +1005,24 @@ private function post($url, $body) | |||
return array($r, null); | |||
} | |||
|
|||
private function ucPostV2($path, $body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个也删掉吧, 合并成一个。
No description provided.