ksyun-sdk-node 1.0.5 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/base/BaseClient.js +90 -55
  2. package/dist/index.js +9 -12
  3. package/dist/lib/fetch.js +4 -5
  4. package/dist/lib/sign.js +31 -33
  5. package/dist/lib/signautreV4.js +167 -0
  6. package/dist/service/Actiontrail/v20190401/index.js +4 -7
  7. package/dist/service/Bill/v20180601/index.js +11 -50
  8. package/dist/service/Bill/v20220601/index.js +64 -0
  9. package/dist/service/Bill_union/v20200101/index.js +48 -10
  10. package/dist/service/Bill_union/v20221222/index.js +142 -0
  11. package/dist/service/Bws/v20160304/index.js +23 -6
  12. package/dist/service/Cdn/v20160901/index.js +42 -0
  13. package/dist/service/Cdn/v20200630/index.js +410 -0
  14. package/dist/service/Cdn/v20200901/index.js +162 -0
  15. package/dist/service/Cen/v20160304/index.js +460 -0
  16. package/dist/service/Clickhouse/v20210101/index.js +546 -0
  17. package/dist/service/Ebs/v20160304/index.js +3 -6
  18. package/dist/service/Eip/v20160304/index.js +3 -6
  19. package/dist/service/Epc/v20151101/index.js +36 -60
  20. package/dist/service/Iam/v20151101/index.js +61 -7
  21. package/dist/service/Kad/v20161122/index.js +3 -6
  22. package/dist/service/Kce/v20180314/index.js +320 -0
  23. package/dist/service/Kce/v20190806/index.js +482 -0
  24. package/dist/service/Kce/v20201231/index.js +63 -0
  25. package/dist/service/Kcf/v20211215/index.js +203 -0
  26. package/dist/service/Kcm/v20160304/index.js +120 -0
  27. package/dist/service/Kcrs/v20211109/index.js +851 -0
  28. package/dist/service/Kcs/v20160701/index.js +1106 -0
  29. package/dist/service/Kcs/v20170401/index.js +81 -0
  30. package/dist/service/Kead/v20200101/index.js +3 -6
  31. package/dist/service/Kec/v20160304/index.js +107 -42
  32. package/dist/service/Ket/v20170101/index.js +141 -0
  33. package/dist/service/Kkms/v20160304/index.js +167 -0
  34. package/dist/service/Klog/v20200731/index.js +804 -0
  35. package/dist/service/Kls/v20170101/index.js +194 -0
  36. package/dist/service/Krds/v20160701/index.js +1302 -0
  37. package/dist/service/Krds/v20200825/index.js +174 -0
  38. package/dist/service/Memcached/v20180627/index.js +249 -0
  39. package/dist/service/Mongodb/v20170101/index.js +22 -7
  40. package/dist/service/Monitor/v20100525/index.js +70 -0
  41. package/dist/service/Monitor/v20181114/index.js +49 -0
  42. package/dist/service/Monitor/v20210101/index.js +179 -0
  43. package/dist/service/Monitor/v20220101/index.js +68 -0
  44. package/dist/service/Rabbitmq/v20191017/index.js +242 -0
  45. package/dist/service/Resourcemanager/v20210320/index.js +3 -6
  46. package/dist/service/Sks/v20151101/index.js +3 -6
  47. package/dist/service/Slb/v20160304/index.js +517 -8
  48. package/dist/service/Sts/v20151101/index.js +4 -7
  49. package/dist/service/Tagv2/v20200901/index.js +174 -0
  50. package/dist/service/Tidb/v20210520/index.js +363 -0
  51. package/dist/service/Trade/v20200114/index.js +3 -6
  52. package/dist/service/Trade/v20200831/index.js +3 -6
  53. package/dist/service/Vpc/v20160304/index.js +239 -7
  54. package/dist/service/Waf/v20200707/index.js +248 -0
  55. package/package.json +1 -1
  56. package/src/base/BaseClient.js +85 -36
  57. package/src/lib/signautreV4.js +166 -0
  58. package/src/service/Actiontrail/v20190401/index.js +1 -1
  59. package/src/service/Bill/v20180601/index.js +6 -46
  60. package/src/service/Bill/v20220601/index.js +56 -0
  61. package/src/service/Bill_union/v20200101/index.js +37 -0
  62. package/src/service/Bill_union/v20221222/index.js +134 -0
  63. package/src/service/Bws/v20160304/index.js +20 -0
  64. package/src/service/{Bill_union/v20211209 → Cdn/v20160901}/index.js +6 -6
  65. package/src/service/Cdn/v20200630/index.js +402 -0
  66. package/src/service/Cdn/v20200901/index.js +154 -0
  67. package/src/service/Cen/v20160304/index.js +452 -0
  68. package/src/service/Clickhouse/v20210101/index.js +538 -0
  69. package/src/service/Ebs/v20160304/index.js +1 -4
  70. package/src/service/Epc/v20151101/index.js +26 -50
  71. package/src/service/Iam/v20151101/index.js +57 -0
  72. package/src/service/Kce/v20180314/index.js +312 -0
  73. package/src/service/Kce/v20190806/index.js +474 -0
  74. package/src/service/Kce/v20201231/index.js +55 -0
  75. package/src/service/Kcf/v20211215/index.js +197 -0
  76. package/src/service/Kcm/v20160304/index.js +112 -0
  77. package/src/service/Kcrs/v20211109/index.js +857 -0
  78. package/src/service/Kcs/v20160701/index.js +1101 -0
  79. package/src/service/Kcs/v20170401/index.js +73 -0
  80. package/src/service/Kec/v20160304/index.js +86 -22
  81. package/src/service/Ket/v20170101/index.js +133 -0
  82. package/src/service/Kkms/v20160304/index.js +159 -0
  83. package/src/service/Klog/v20200731/index.js +810 -0
  84. package/src/service/Kls/v20170101/index.js +186 -0
  85. package/src/service/Krds/v20160701/index.js +1296 -0
  86. package/src/service/Krds/v20200825/index.js +166 -0
  87. package/src/service/Memcached/v20180627/index.js +248 -0
  88. package/src/service/Mongodb/v20170101/index.js +18 -0
  89. package/src/service/Monitor/v20100525/index.js +62 -0
  90. package/src/service/{Slb/v20171210 → Monitor/v20181114}/index.js +13 -11
  91. package/src/service/Monitor/v20210101/index.js +172 -0
  92. package/src/service/Monitor/v20220101/index.js +60 -0
  93. package/src/service/Rabbitmq/v20191017/index.js +234 -0
  94. package/src/service/Slb/v20160304/index.js +512 -0
  95. package/src/service/Sts/v20151101/index.js +1 -1
  96. package/src/service/Tagv2/v20200901/index.js +166 -0
  97. package/src/service/Tidb/v20210520/index.js +355 -0
  98. package/src/service/Vpc/v20160304/index.js +235 -0
  99. package/src/service/Waf/v20200707/index.js +240 -0
@@ -1,4 +1,4 @@
1
- const getSignedParams = require('../lib/sign.js').getSignedParams
1
+ const {getSignatureHeaders, getCanonicalizedQuery} = require('../lib/signautreV4.js')
2
2
  const fetch = require('../lib/fetch.js')
3
3
  const dayjs = require('dayjs')
4
4
  const utc = require('dayjs/plugin/utc.js')
@@ -26,67 +26,116 @@ module.exports = class BaseClient {
26
26
  */
27
27
  request (apiAction, params = {}) {
28
28
 
29
- let apiConfig = this._apiList[apiAction]
30
- let publicParams = {
31
- Accesskey: this.ak,
32
- Service: this._baseConfig.config.credentials.service,
33
- Action: apiAction,
34
- Version: apiConfig.config.query.Version,
35
- Timestamp: dayjs().utc().format('YYYY-MM-DDThh:mm:ss')+'Z',
36
- SignatureVersion: '1.0',
37
- SignatureMethod: 'HMAC-SHA256',
38
- Region: this.region || this._baseConfig.config.credentials.region,
39
- }
40
-
41
- let combainParams = {
42
- ...publicParams,
43
- ...params
44
- }
29
+ params = this.formatParams(apiAction, params)
45
30
 
46
- let signedParams = getSignedParams(combainParams, this.sk)
31
+ let apiConfig = this._apiList[apiAction]
47
32
 
48
33
  let protocol = this.httpProfile.protocol || this._baseConfig.protocol
49
34
  let endpoint = this.httpProfile.endpoint || this._baseConfig.endpoint
50
- let method = this.httpProfile.method || apiConfig.method
51
-
52
- let url = `${protocol}${endpoint}${apiConfig.url}`
53
- if (['GET', 'DELETE', 'OPTION', 'HEAD'].includes(method.toUpperCase())) {
54
- url += `?${qs.stringify(signedParams)}`
55
- }
35
+ let method = (this.httpProfile.method || apiConfig.method).toUpperCase()
36
+ let region = this.region || this._baseConfig.config.credentials.region
56
37
  let headers = {
57
38
  ...(this._baseConfig.config.headers || {}),
58
- ...(apiConfig.config.headers || {}),
59
- // 目前kop只支持application/x-www-form-urlencoded类型的签名解析
60
- 'Content-Type': 'application/x-www-form-urlencoded',
39
+ ...(apiConfig.config.headers || {})
40
+ }
41
+
42
+ let query = apiConfig.config.query
43
+ if (['GET', 'OPTION', 'HEAD'].includes(method)) {
44
+ query = {
45
+ ...query,
46
+ ...params
47
+ }
48
+ }
49
+
50
+ let body = this.getBody(method, headers['Content-Type'], params)
51
+
52
+ let signParams = {
53
+ path: apiConfig.url,
54
+ query,
55
+ body: body || '',
56
+ headers,
57
+ host: endpoint,
58
+ method,
59
+ region,
60
+ service: this._baseConfig.config.credentials.service,
61
+ access_key: this.ak,
62
+ secret_key: this.sk,
61
63
  }
62
- let body = this.getBody(method, headers['Content-Type'], signedParams)
64
+
65
+ let signHeaders = getSignatureHeaders(signParams)
66
+
67
+ let url = `${protocol}${endpoint}${apiConfig.url}?${getCanonicalizedQuery(query)}`
63
68
 
64
69
  let timeoutSecond = this.httpProfile.timeout || this._baseConfig.config.timeout
65
70
  return fetch(url, {
66
71
  method: method,
67
72
  timeout: timeoutSecond * 1000,
68
- headers,
73
+ headers: signHeaders,
69
74
  body
70
75
  })
71
76
  }
77
+ /**
78
+ * 格式化参数,对Filter类型做扁平处理
79
+ * @param {string} apiAction 接口名
80
+ * @param {object} params 参数值
81
+ * @returns 格式化后的参数
82
+ */
83
+ formatParams (apiAction, params) {
84
+ let paramsType = this._apiList[apiAction].paramsType
85
+ if (!paramsType || params == null) {
86
+ return params
87
+ }
88
+ let res = {}
89
+ Object.keys(params).forEach(key => {
90
+ let type = paramsType[key]
91
+ // 这些类型不用处理,如果为null、undefined则排除掉
92
+ if (['String', 'Int', 'Double', 'Long', 'Boolean', 'Array'].includes(type) && params[key] != null) {
93
+ res[key] = params[key]
94
+ }
95
+ if (type == 'Filter') {
96
+ res = {
97
+ ...res,
98
+ ...this.formatFilter(key, params[key])
99
+ }
100
+ }
101
+ })
102
+ return res
103
+ }
104
+ formatFilter (pKey, value) {
105
+ let res = {}
106
+ Object.keys(value).forEach(key => {
107
+ let prefixName = `${pKey}.${key}`
108
+ let childValue = value[key]
109
+ if (typeof(childValue) == 'object') {
110
+ res = {
111
+ ...res,
112
+ ...this.formatFilter(prefixName, childValue)
113
+ }
114
+ } else {
115
+ res[prefixName] = childValue
116
+ }
117
+ })
118
+ return res
119
+ }
120
+
72
121
  /**
73
122
  * 获取body
74
123
  * @param {string} method 请求类型
75
124
  * @param {string} contentType
76
- * @param {object} signedParams 参数对象
125
+ * @param {object} params 参数对象
77
126
  * @returns {string}
78
127
  */
79
- getBody (method, contentType, signedParams) {
80
- if (!['POST', 'PUT'].includes(method.toUpperCase())) {
81
- return undefined
128
+ getBody (method, contentType, params) {
129
+ if (!['POST', 'PUT'].includes(method) || JSON.stringify(params) == '{}') {
130
+ return null
82
131
  }
83
132
  // 目前只有下面这两种
84
133
  if (contentType == 'application/x-www-form-urlencoded') {
85
- return qs.stringify(signedParams)
134
+ return qs.stringify(params)
86
135
  }
87
136
  if (contentType == 'application/json') {
88
- return JSON.stringify(signedParams)
137
+ return JSON.stringify(params)
89
138
  }
90
- return JSON.stringify(signedParams)
139
+ return JSON.stringify(params)
91
140
  }
92
141
  }
@@ -0,0 +1,166 @@
1
+ const crypto = require("crypto-js")
2
+ const dayjs = require('dayjs')
3
+ const utc = require('dayjs/plugin/utc.js')
4
+
5
+ dayjs.extend(utc)
6
+
7
+ const HEADERS_TO_IGNORE = {
8
+ 'cache-control' : true,
9
+ 'content-type' : true,
10
+ 'content-length' : true,
11
+ 'expect' : true,
12
+ 'max-forwards' : true,
13
+ 'pragma' : true,
14
+ 'range' : true,
15
+ 'te' : true,
16
+ 'if-match' : true,
17
+ 'if-none-match' : true,
18
+ 'if-modified-since' : true,
19
+ 'if-unmodified-since' : true,
20
+ 'if-range' : true,
21
+ 'accept' : true,
22
+ 'authorization' : true,
23
+ 'proxy-authorization' : true,
24
+ 'from' : true,
25
+ 'referer' : true,
26
+ 'user-agent' : true
27
+ }
28
+
29
+ function getSignatureKey(key, dateStamp, regionName, serviceName) {
30
+ var kDate = crypto.HmacSHA256(dateStamp, "AWS4" + key);
31
+ var kRegion = crypto.HmacSHA256(regionName, kDate);
32
+ var kService = crypto.HmacSHA256(serviceName, kRegion);
33
+ var kSigning = crypto.HmacSHA256("aws4_request", kService);
34
+ return kSigning;
35
+ }
36
+
37
+ /**
38
+ * 编码
39
+ * @param {*} str
40
+ * @returns
41
+ */
42
+ function encodeRfc3986Full(str) {
43
+ // This function assumes the string has already been percent encoded
44
+ function encodeRfc3986(urlEncodedString) {
45
+ return urlEncodedString.replace(/[!'()*]/g, function (c) {
46
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
47
+ })
48
+ }
49
+ return encodeRfc3986(encodeURIComponent(str))
50
+ }
51
+
52
+ /**
53
+ *
54
+ * @param {*} path
55
+ * @returns
56
+ */
57
+ function createCanonicalizedPath(path) {
58
+ return encodeRfc3986Full(path).replace(/%2F/g, '/')
59
+ }
60
+
61
+ function getCanonicalHeaders(headers) {
62
+ function trimAll(header) {
63
+ return header.toString().trim().replace(/\s+/g, ' ')
64
+ }
65
+ return Object.keys(headers)
66
+ .filter(function (key) { return HEADERS_TO_IGNORE[key.toLowerCase()] == null })
67
+ .sort(function (a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 })
68
+ .map(function (key) { return key.toLowerCase() + ':' + trimAll(headers[key]) })
69
+ .join('\n') + '\n'
70
+ }
71
+
72
+ function getSignedHeaders(headers) {
73
+ return Object.keys(headers)
74
+ .map(function (key) { return key.toLowerCase() })
75
+ .filter(function (key) { return HEADERS_TO_IGNORE[key] == null })
76
+ .sort()
77
+ .join(';')
78
+ }
79
+
80
+
81
+ function getCanonicalizedQuery(query) {
82
+ if (!query) {
83
+ return ''
84
+ }
85
+ delete query['X-Amz-Signature'] // php项目里有这句
86
+ let res = [];
87
+ let sortKeys = Object.keys(query).sort()
88
+ sortKeys.forEach(key => {
89
+ if (!Array.isArray(query[key])) {
90
+ res.push(encodeRfc3986Full(key) + '=' + encodeRfc3986Full(query[key]))
91
+ } else {
92
+ query[key].map(encodeRfc3986Full).sort().forEach(val => {
93
+ res.push(encodeRfc3986Full(key) + '=' + encodeRfc3986Full(val))
94
+ })
95
+ }
96
+ })
97
+ return res.join('&')
98
+ }
99
+
100
+ // 签名步骤摘要
101
+ // 要创建已签名的请求,请完成以下操作:
102
+
103
+ /**
104
+ * 获取包含签名的头,含之前的头
105
+ * AWS Version 4
106
+ * https://docs.aws.amazon.com/zh_cn/general/latest/gr/sigv4_signing.html
107
+ * @param {string} path
108
+ * @param {string} query
109
+ */
110
+ function getSignatureHeaders({
111
+ path, query, body, headers, host, method, region, service, secret_key, access_key
112
+ }) {
113
+
114
+ let now = dayjs().utc()
115
+ let amzdate = now.format(`YYYYMMDDTHHmmssZ`)
116
+ let datestamp = now.format('YYYYMMDD')
117
+
118
+ // 任务 1:针对签名版本 4 创建规范请求
119
+ // 将请求的内容(主体、操作、标头等)组织为标准(规范)格式。规范请求是用于创建待签字符串的输入之一。
120
+
121
+ let canonical_uri = createCanonicalizedPath(path)
122
+ let canonical_querystring = getCanonicalizedQuery(query)
123
+
124
+ let allHeaders = {
125
+ ...headers,
126
+ host,
127
+ 'x-amz-date': amzdate
128
+ }
129
+ let canonical_headers = getCanonicalHeaders(allHeaders)
130
+ let signed_headers = getSignedHeaders(allHeaders)
131
+
132
+ let payload_hash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] ||
133
+ crypto.SHA256(body || '').toString()
134
+
135
+ let canonical_request = method + '\n' + canonical_uri + '\n' + canonical_querystring + '\n' + canonical_headers + '\n' + signed_headers + '\n' + payload_hash
136
+
137
+
138
+ // 任务 2:创建签名版本 4 的待签字符串
139
+ // 使用规范请求和额外信息(例如算法、请求日期、凭证范围和规范请求的摘要(哈希))创建待签字符串。
140
+ let algorithm = 'AWS4-HMAC-SHA256'
141
+ let credential_scope = datestamp + '/' + region + '/' + service + '/' + 'aws4_request'
142
+ let string_to_sign = algorithm + '\n' + amzdate + '\n' + credential_scope + '\n' + crypto.SHA256(canonical_request).toString()
143
+
144
+ // 任务 3:为AWS签名版本 4 计算签名
145
+ // 使用AWS秘密访问密钥作为初始哈希操作的密钥,对请求日期、区域和服务执行一系列加密哈希操作(HMAC 操作),从而派生签名密钥。在派生签名密钥后,通过对待签字符串执行加密哈希操作来计算签名。使用派生的签名密钥作为此操作的哈希密钥。
146
+ let signing_key = getSignatureKey(secret_key, datestamp, region, service);
147
+ let signature = crypto.HmacSHA256(string_to_sign, signing_key).toString();
148
+
149
+ // 任务 4:将签名添加到 HTTP 请求
150
+ // 在计算签名后,将其添加到请求的 HTTP 标头或查询字符串中。
151
+ let authorization_header = algorithm + ' ' + 'Credential=' + access_key + '/' + credential_scope + ', ' + 'SignedHeaders=' + signed_headers + ', ' + 'Signature=' + signature
152
+
153
+ let res = {
154
+ ...headers
155
+ }
156
+ res['x-amz-date'] = amzdate
157
+ res['Authorization'] = authorization_header
158
+
159
+ return res
160
+
161
+ }
162
+
163
+ module.exports = {
164
+ getCanonicalizedQuery,
165
+ getSignatureHeaders
166
+ }
@@ -25,7 +25,7 @@ module.exports = class Client extends BaseClient {
25
25
  'Action': 'ListOperateLogs',
26
26
  },
27
27
  'headers': {
28
- 'Content-Type': 'application/x-www-form-urlencoded'
28
+ 'Content-Type': 'application/json'
29
29
  },
30
30
  },
31
31
  'paramsType': {
@@ -29,7 +29,8 @@ module.exports = class Client extends BaseClient {
29
29
  },
30
30
  },
31
31
  'paramsType': {
32
- 'Action': 'String',
32
+ 'BillStartMonth': 'String',
33
+ 'BillEndMonth': 'String',
33
34
  }
34
35
  },
35
36
  'GetPostpayDetailBill': {
@@ -45,21 +46,10 @@ module.exports = class Client extends BaseClient {
45
46
  },
46
47
  },
47
48
  'paramsType': {
48
- }
49
- },
50
- 'GetPostpayDetailBillCSV': {
51
- 'url': '/',
52
- 'method': 'GET',
53
- 'config': {
54
- 'query': {
55
- 'Version': '2018-06-01',
56
- 'Action': 'GetPostpayDetailBillCSV',
57
- },
58
- 'headers': {
59
- 'Content-Type': 'application/json'
60
- },
61
- },
62
- 'paramsType': {
49
+ 'BillStartMonth': 'String',
50
+ 'BillEndMonth': 'String',
51
+ 'ProductCode': 'String',
52
+ 'ProjectId': 'String',
63
53
  }
64
54
  },
65
55
  'GetProductCode': {
@@ -77,35 +67,5 @@ module.exports = class Client extends BaseClient {
77
67
  'paramsType': {
78
68
  }
79
69
  },
80
- 'getMonthConsume': {
81
- 'url': '/',
82
- 'method': 'GET',
83
- 'config': {
84
- 'query': {
85
- 'Version': '2018-06-01',
86
- 'Action': 'getMonthConsume',
87
- },
88
- 'headers': {
89
- 'Content-Type': 'application/json'
90
- },
91
- },
92
- 'paramsType': {
93
- }
94
- },
95
- 'getPostpayDetailConsume': {
96
- 'url': '/',
97
- 'method': 'GET',
98
- 'config': {
99
- 'query': {
100
- 'Version': '2018-06-01',
101
- 'Action': 'getPostpayDetailConsume',
102
- },
103
- 'headers': {
104
- 'Content-Type': 'application/json'
105
- },
106
- },
107
- 'paramsType': {
108
- }
109
- },
110
70
  }
111
71
  }
@@ -0,0 +1,56 @@
1
+ const BaseClient = require("../../../base/BaseClient.js");
2
+
3
+ module.exports = class Client extends BaseClient {
4
+ _baseConfig = {
5
+ 'protocol': 'http://',
6
+ 'endpoint': 'bill.api.ksyun.com',
7
+ 'config': {
8
+ 'timeout': 60, //设置timeout
9
+ 'headers': {
10
+ 'Accept': 'application/json'
11
+ },
12
+ 'credentials': {
13
+ 'region': 'cn-shanghai-3',
14
+ 'service': 'bill',
15
+ },
16
+ },
17
+ }
18
+ _apiList = {
19
+ 'GetMonthConsume': {
20
+ 'url': '/',
21
+ 'method': 'GET',
22
+ 'config': {
23
+ 'query': {
24
+ 'Version': '2022-06-01',
25
+ 'Action': 'GetMonthConsume',
26
+ },
27
+ 'headers': {
28
+ 'Content-Type': 'application/json'
29
+ },
30
+ },
31
+ 'paramsType': {
32
+ 'BillMonth': 'String',
33
+ }
34
+ },
35
+ 'GetPostpayDetailConsume': {
36
+ 'url': '/',
37
+ 'method': 'GET',
38
+ 'config': {
39
+ 'query': {
40
+ 'Version': '2022-06-01',
41
+ 'Action': 'GetPostpayDetailConsume',
42
+ },
43
+ 'headers': {
44
+ 'Content-Type': 'application/json'
45
+ },
46
+ },
47
+ 'paramsType': {
48
+ 'BillMonth': 'String',
49
+ 'ProductCode': 'String',
50
+ 'ProjectId': 'String',
51
+ 'PageNo': 'Int',
52
+ 'PageSize': 'Int',
53
+ }
54
+ },
55
+ }
56
+ }
@@ -29,6 +29,8 @@ module.exports = class Client extends BaseClient {
29
29
  },
30
30
  },
31
31
  'paramsType': {
32
+ 'BillBeginMonth': 'String',
33
+ 'BillEndMonth': 'String',
32
34
  }
33
35
  },
34
36
  'DescribeBillSummaryByProduct': {
@@ -44,6 +46,8 @@ module.exports = class Client extends BaseClient {
44
46
  },
45
47
  },
46
48
  'paramsType': {
49
+ 'BillBeginMonth': 'String',
50
+ 'BillEndMonth': 'String',
47
51
  }
48
52
  },
49
53
  'DescribeBillSummaryByProject': {
@@ -76,6 +80,10 @@ module.exports = class Client extends BaseClient {
76
80
  },
77
81
  },
78
82
  'paramsType': {
83
+ 'BillMonth': 'String',
84
+ 'ProductCode': 'String',
85
+ 'Page': 'Int',
86
+ 'Size': 'Int',
79
87
  }
80
88
  },
81
89
  'DescribeProductCode': {
@@ -106,6 +114,35 @@ module.exports = class Client extends BaseClient {
106
114
  },
107
115
  },
108
116
  'paramsType': {
117
+ 'CustomerBillMonth': 'Int',
118
+ 'ProductGroupCode': 'String',
119
+ 'StatisticType': 'Int',
120
+ 'PayType': 'Int',
121
+ 'SubAccountId': 'Int',
122
+ 'Page': 'Int',
123
+ 'Size': 'String',
124
+ }
125
+ },
126
+ 'DescribeSplitItemDayBillDetails': {
127
+ 'url': '/',
128
+ 'method': 'GET',
129
+ 'config': {
130
+ 'query': {
131
+ 'Version': '2020-01-01',
132
+ 'Action': 'DescribeSplitItemDayBillDetails',
133
+ },
134
+ 'headers': {
135
+ 'Content-Type': 'application/json'
136
+ },
137
+ },
138
+ 'paramsType': {
139
+ 'CustomerBillMonth': 'Int',
140
+ 'ProductGroupCode': 'String',
141
+ 'StatisticType': 'Int',
142
+ 'PayType': 'Int',
143
+ 'SubAccountId': 'Int',
144
+ 'Page': 'Int',
145
+ 'Size': 'Int',
109
146
  }
110
147
  },
111
148
  }
@@ -0,0 +1,134 @@
1
+ const BaseClient = require("../../../base/BaseClient.js");
2
+
3
+ module.exports = class Client extends BaseClient {
4
+ _baseConfig = {
5
+ 'protocol': 'http://',
6
+ 'endpoint': 'bill-union.api.ksyun.com',
7
+ 'config': {
8
+ 'timeout': 60, //设置timeout
9
+ 'headers': {
10
+ 'Accept': 'application/json'
11
+ },
12
+ 'credentials': {
13
+ 'region': 'cn-shanghai-3',
14
+ 'service': 'bill-union',
15
+ },
16
+ },
17
+ }
18
+ _apiList = {
19
+ 'QueryInstanceConsume': {
20
+ 'url': '/',
21
+ 'method': 'GET',
22
+ 'config': {
23
+ 'query': {
24
+ 'Version': '2022-12-22',
25
+ 'Action': 'QueryInstanceConsume',
26
+ },
27
+ 'headers': {
28
+ 'Content-Type': 'application/json'
29
+ },
30
+ },
31
+ 'paramsType': {
32
+ 'StartDay': 'String',
33
+ 'EndDay': 'String',
34
+ 'ProductCode': 'String',
35
+ 'Page': 'Int',
36
+ 'Size': 'Int',
37
+ }
38
+ },
39
+ 'QueryProjectConsume': {
40
+ 'url': '/',
41
+ 'method': 'GET',
42
+ 'config': {
43
+ 'query': {
44
+ 'Version': '2022-12-22',
45
+ 'Action': 'QueryProjectConsume',
46
+ },
47
+ 'headers': {
48
+ 'Content-Type': 'application/json'
49
+ },
50
+ },
51
+ 'paramsType': {
52
+ 'StartDay': 'String',
53
+ 'EndDay': 'String',
54
+ 'Page': 'Int',
55
+ 'Size': 'Int',
56
+ }
57
+ },
58
+ 'QueryProductConsume': {
59
+ 'url': '/',
60
+ 'method': 'GET',
61
+ 'config': {
62
+ 'query': {
63
+ 'Version': '2022-12-22',
64
+ 'Action': 'QueryProductConsume',
65
+ },
66
+ 'headers': {
67
+ 'Content-Type': 'application/json'
68
+ },
69
+ },
70
+ 'paramsType': {
71
+ 'StartDay': 'String',
72
+ 'EndDay': 'String',
73
+ 'Page': 'Int',
74
+ 'Size': 'Int',
75
+ }
76
+ },
77
+ 'QueryFinanceUnitConsume': {
78
+ 'url': '/',
79
+ 'method': 'GET',
80
+ 'config': {
81
+ 'query': {
82
+ 'Version': '2022-12-22',
83
+ 'Action': 'QueryFinanceUnitConsume',
84
+ },
85
+ 'headers': {
86
+ 'Content-Type': 'application/json'
87
+ },
88
+ },
89
+ 'paramsType': {
90
+ 'StartDay': 'String',
91
+ 'EndDay': 'String',
92
+ 'Page': 'Int',
93
+ 'Size': 'Int',
94
+ }
95
+ },
96
+ 'QueryFinanceUnitConsumeOfMonth': {
97
+ 'url': '/',
98
+ 'method': 'GET',
99
+ 'config': {
100
+ 'query': {
101
+ 'Version': '2022-12-22',
102
+ 'Action': 'QueryFinanceUnitConsumeOfMonth',
103
+ },
104
+ 'headers': {
105
+ 'Content-Type': 'application/json'
106
+ },
107
+ },
108
+ 'paramsType': {
109
+ 'CustomerBillMonth': 'String',
110
+ 'Page': 'Int',
111
+ 'Size': 'Int',
112
+ }
113
+ },
114
+ 'QueryUserConsume': {
115
+ 'url': '/',
116
+ 'method': 'GET',
117
+ 'config': {
118
+ 'query': {
119
+ 'Version': '2022-12-22',
120
+ 'Action': 'QueryUserConsume',
121
+ },
122
+ 'headers': {
123
+ 'Content-Type': 'application/json'
124
+ },
125
+ },
126
+ 'paramsType': {
127
+ 'StartDay': 'String',
128
+ 'EndDay': 'String',
129
+ 'Page': 'Int',
130
+ 'Size': 'Int',
131
+ }
132
+ },
133
+ }
134
+ }
@@ -125,5 +125,25 @@ module.exports = class Client extends BaseClient {
125
125
  'BandWidthShareId': 'String',
126
126
  }
127
127
  },
128
+ 'QueryBwsTopEipMonitor': {
129
+ 'url': '/',
130
+ 'method': 'GET',
131
+ 'config': {
132
+ 'query': {
133
+ 'Version': '2016-03-04',
134
+ 'Action': 'QueryBwsTopEipMonitor',
135
+ },
136
+ 'headers': {
137
+ 'Content-Type': 'application/x-www-form-urlencoded'
138
+ },
139
+ },
140
+ 'paramsType': {
141
+ 'BandWidthShareId': 'String',
142
+ 'StartTime': 'String',
143
+ 'EndTime': 'String',
144
+ 'SortType': 'String',
145
+ 'PublicIp': 'String',
146
+ }
147
+ },
128
148
  }
129
149
  }