ali-cdn-sdk
Advanced tools
Comparing version 1.1.0 to 1.2.0
'use strict'; | ||
/** | ||
* 配置 sdk 配置的方法。 https://help.aliyun.com/document_detail/27148.html?spm=5176.doc27148.6.603.5Tehoi | ||
* 配置 sdk 配置的方法。 https://help.aliyun.com/document_detail/27148.html | ||
*/ | ||
module.exports = [ | ||
{ | ||
action: 'DescribeDomainBpsData', // 查询网络带宽 | ||
action: 'DescribeDomainBpsData', // 查询网络带宽 | ||
method: 'GET', | ||
params: [ | ||
{ | ||
name: 'DomainName', // 支持数组, 逗号分隔 | ||
name: 'DomainName', // 支持数组, 逗号分隔 | ||
required: true, | ||
@@ -26,3 +26,3 @@ }, | ||
{ | ||
action: 'DescribeDomainFlowData', // 查询流量数据 | ||
action: 'DescribeDomainFlowData', // 查询流量数据 | ||
method: 'GET', | ||
@@ -45,3 +45,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainSrcBpsData', // 查询回源带宽 | ||
action: 'DescribeDomainSrcBpsData', // 查询回源带宽 | ||
method: 'GET', | ||
@@ -64,3 +64,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainSrcFlowData', // 查询回源流量 | ||
action: 'DescribeDomainSrcFlowData', // 查询回源流量 | ||
method: 'GET', | ||
@@ -83,3 +83,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainHitRateData', // 查询字节缓存命中率 | ||
action: 'DescribeDomainHitRateData', // 查询字节缓存命中率 | ||
method: 'GET', | ||
@@ -102,3 +102,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainReqHitRateData', // 查询字节请求缓存命中率 | ||
action: 'DescribeDomainReqHitRateData', // 查询字节请求缓存命中率 | ||
method: 'GET', | ||
@@ -123,3 +123,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainQpsData', // 查询访问QPS | ||
action: 'DescribeDomainQpsData', // 查询访问QPS | ||
method: 'GET', | ||
@@ -142,3 +142,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainHttpCodeData', // 查询返回码 | ||
action: 'DescribeDomainHttpCodeData', // 查询返回码 | ||
method: 'GET', | ||
@@ -161,3 +161,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainPvData', // 查询PV数据 | ||
action: 'DescribeDomainPvData', // 查询PV数据 | ||
method: 'GET', | ||
@@ -180,3 +180,3 @@ params: [ | ||
{ | ||
action: 'DescribeDomainTopUrlVisit', // top url | ||
action: 'DescribeDomainTopUrlVisit', // top url | ||
method: 'GET', | ||
@@ -194,3 +194,3 @@ params: [ | ||
{ | ||
action: 'RefreshObjectCaches', // 刷新 | ||
action: 'RefreshObjectCaches', // 刷新 | ||
method: 'GET', | ||
@@ -208,6 +208,16 @@ params: [ | ||
{ | ||
action: 'DescribeRefreshTasks', // 查询刷新预热状态 | ||
action: 'PushObjectCache', // 预热 | ||
method: 'GET', | ||
params: [ | ||
{ | ||
name: 'ObjectPath', | ||
required: true, | ||
}, | ||
], | ||
}, | ||
{ | ||
action: 'DescribeRefreshTasks', // 查询刷新预热状态 | ||
method: 'GET', | ||
params: [ | ||
{ | ||
name: 'TaskId', | ||
@@ -227,3 +237,3 @@ }, | ||
{ | ||
action: 'DescribeCdnDomainLogs', // https://help.aliyun.com/document_detail/27224.html?spm=5176.doc27155.6.702.NHsuzU | ||
action: 'DescribeCdnDomainLogs', // https://help.aliyun.com/document_detail/27224.html | ||
method: 'GET', | ||
@@ -242,7 +252,7 @@ params: [ | ||
name: 'PageNumber', | ||
} | ||
}, | ||
], | ||
}, | ||
{ | ||
action: 'DescribeCdnDomainDetail', // https://help.aliyun.com/document_detail/27163.html | ||
action: 'DescribeCdnDomainDetail', // https://help.aliyun.com/document_detail/27163.html | ||
method: 'GET', | ||
@@ -249,0 +259,0 @@ params: [ |
@@ -77,2 +77,3 @@ 'use strict'; | ||
let headerString = ''; | ||
// eslint-disable-next-line no-return-assign | ||
Object.keys(params).forEach(key => headerString += `${key}=${encodeURIComponent(params[key])}&`); | ||
@@ -83,2 +84,3 @@ headerString = headerString.slice(0, -1); | ||
const sign = crypto.createHmac('sha1', this.opts.appSecret + '&').update(stringToSign).digest('base64'); | ||
// eslint-disable-next-line no-useless-concat | ||
return this.opts.endpoint + '?' + 'Signature=' + encodeURIComponent(sign) + '&' + headerString; | ||
@@ -88,3 +90,3 @@ } | ||
validate(opts) { | ||
['accessKeyId', 'appSecret', 'endpoint', 'apiVersion'].forEach(key => { | ||
[ 'accessKeyId', 'appSecret', 'endpoint', 'apiVersion' ].forEach(key => { | ||
if (!opts[key]) { | ||
@@ -91,0 +93,0 @@ throw new errors.ValidationError(`${key} is required`); |
{ | ||
"name": "ali-cdn-sdk", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "阿里云 cdn sdk", | ||
@@ -16,3 +16,4 @@ "main": "lib/sdk.js", | ||
"scripts": { | ||
"test": "mocha", | ||
"test": "egg-bin test", | ||
"ci": "npm run lint && egg-bin cov", | ||
"lint": "eslint lib test" | ||
@@ -28,10 +29,8 @@ }, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"co": "^4.6.0", | ||
"eslint": "2", | ||
"eslint-config-egg": "^2.0.0", | ||
"lint": "^1.1.2", | ||
"mocha": "^3.2.0", | ||
"moment": "^2.17.1" | ||
"egg-bin": "^3.6.0", | ||
"eslint": "^4.0.0", | ||
"eslint-config-egg": "^4.2.1", | ||
"moment": "^2.18.1", | ||
"pre-commit": "^1.2.2" | ||
} | ||
} |
9806
5
373