ksyun-sdk-node 1.0.1

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 (40) hide show
  1. package/.browserslistrc +1 -0
  2. package/.eslintignore +1 -0
  3. package/.eslintrc.json +14 -0
  4. package/README.md +75 -0
  5. package/babel.config.json +11 -0
  6. package/dist/base/BaseClient.js +104 -0
  7. package/dist/index.js +41 -0
  8. package/dist/lib/fetch.js +35 -0
  9. package/dist/lib/sign.js +155 -0
  10. package/dist/service/Actiontrail/v20190401/index.js +58 -0
  11. package/dist/service/Bill/v20180601/index.js +117 -0
  12. package/dist/service/Bill_union/v20200101/index.js +118 -0
  13. package/dist/service/Bill_union/v20211209/index.js +45 -0
  14. package/dist/service/Ebs/v20160304/index.js +359 -0
  15. package/dist/service/Iam/v20151101/index.js +887 -0
  16. package/dist/service/Kad/v20161122/index.js +133 -0
  17. package/dist/service/Kead/v20200101/index.js +52 -0
  18. package/dist/service/Resourcemanager/v20210320/index.js +171 -0
  19. package/dist/service/Sts/v20151101/index.js +50 -0
  20. package/dist/service/Trade/v20200114/index.js +47 -0
  21. package/dist/service/Trade/v20200831/index.js +49 -0
  22. package/example/iam.js +40 -0
  23. package/example/res.js +43 -0
  24. package/package.json +33 -0
  25. package/src/base/BaseClient.js +92 -0
  26. package/src/index.js +34 -0
  27. package/src/lib/fetch.js +35 -0
  28. package/src/lib/sign.js +148 -0
  29. package/src/service/Actiontrail/v20190401/index.js +47 -0
  30. package/src/service/Bill/v20180601/index.js +111 -0
  31. package/src/service/Bill_union/v20200101/index.js +112 -0
  32. package/src/service/Bill_union/v20211209/index.js +35 -0
  33. package/src/service/Ebs/v20160304/index.js +348 -0
  34. package/src/service/Iam/v20151101/index.js +876 -0
  35. package/src/service/Kad/v20161122/index.js +122 -0
  36. package/src/service/Kead/v20200101/index.js +41 -0
  37. package/src/service/Resourcemanager/v20210320/index.js +161 -0
  38. package/src/service/Sts/v20151101/index.js +39 -0
  39. package/src/service/Trade/v20200114/index.js +36 -0
  40. package/src/service/Trade/v20200831/index.js +38 -0
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ const BaseClient = require("../../../base/BaseClient.js");
6
+
7
+ module.exports = class Client extends BaseClient {
8
+ constructor(...args) {
9
+ super(...args);
10
+
11
+ _defineProperty(this, "_baseConfig", {
12
+ 'protocol': 'http://',
13
+ 'endpoint': 'kad.api.ksyun.com',
14
+ 'config': {
15
+ 'timeout': 60,
16
+ //设置timeout
17
+ 'headers': {
18
+ 'Accept': 'application/json'
19
+ },
20
+ 'credentials': {
21
+ 'region': 'cn-shanghai-3',
22
+ 'service': 'kad'
23
+ }
24
+ }
25
+ });
26
+
27
+ _defineProperty(this, "_apiList", {
28
+ 'CreateForwardConf': {
29
+ 'url': '/',
30
+ 'method': 'POST',
31
+ 'config': {
32
+ 'query': {
33
+ 'Version': '2016-11-22',
34
+ 'Action': 'CreateForwardConf'
35
+ },
36
+ 'headers': {
37
+ 'Content-Type': 'application/x-www-form-urlencoded'
38
+ }
39
+ },
40
+ 'paramsType': {
41
+ 'KadId': 'String',
42
+ 'Protocol': 'String',
43
+ 'ServicePort': 'Int'
44
+ }
45
+ },
46
+ 'DeleteForwardConf': {
47
+ 'url': '/',
48
+ 'method': 'POST',
49
+ 'config': {
50
+ 'query': {
51
+ 'Version': '2016-11-22',
52
+ 'Action': 'DeleteForwardConf'
53
+ },
54
+ 'headers': {
55
+ 'Content-Type': 'application/x-www-form-urlencoded'
56
+ }
57
+ },
58
+ 'paramsType': {
59
+ 'ForwardConfId': 'String'
60
+ }
61
+ },
62
+ 'DescribeForwardConf': {
63
+ 'url': '/',
64
+ 'method': 'GET',
65
+ 'config': {
66
+ 'query': {
67
+ 'Version': '2016-11-22',
68
+ 'Action': 'DescribeForwardConf'
69
+ },
70
+ 'headers': {
71
+ 'Content-Type': 'application/json'
72
+ }
73
+ },
74
+ 'paramsType': {
75
+ 'KadId': 'String',
76
+ 'ForwardConfId': 'Filter'
77
+ }
78
+ },
79
+ 'CreateForwardSource': {
80
+ 'url': '/',
81
+ 'method': 'POST',
82
+ 'config': {
83
+ 'query': {
84
+ 'Version': '2016-11-22',
85
+ 'Action': 'CreateForwardSource'
86
+ },
87
+ 'headers': {
88
+ 'Content-Type': 'application/x-www-form-urlencoded'
89
+ }
90
+ },
91
+ 'paramsType': {
92
+ 'ForwardConfId': 'String',
93
+ 'SourceIp': 'String',
94
+ 'SourcePort': 'String'
95
+ }
96
+ },
97
+ 'DeleteForwardSource': {
98
+ 'url': '/',
99
+ 'method': 'POST',
100
+ 'config': {
101
+ 'query': {
102
+ 'Version': '2016-11-22',
103
+ 'Action': 'DeleteForwardSource'
104
+ },
105
+ 'headers': {
106
+ 'Content-Type': 'application/x-www-form-urlencoded'
107
+ }
108
+ },
109
+ 'paramsType': {
110
+ 'ForwardSourceId': 'String'
111
+ }
112
+ },
113
+ 'DescribeForwardSource': {
114
+ 'url': '/',
115
+ 'method': 'GET',
116
+ 'config': {
117
+ 'query': {
118
+ 'Version': '2016-11-22',
119
+ 'Action': 'DescribeForwardSource'
120
+ },
121
+ 'headers': {
122
+ 'Content-Type': 'application/json'
123
+ }
124
+ },
125
+ 'paramsType': {
126
+ 'ForwardConfId': 'String',
127
+ 'ForwardSourceId': 'Filter'
128
+ }
129
+ }
130
+ });
131
+ }
132
+
133
+ };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ const BaseClient = require("../../../base/BaseClient.js");
6
+
7
+ module.exports = class Client extends BaseClient {
8
+ constructor(...args) {
9
+ super(...args);
10
+
11
+ _defineProperty(this, "_baseConfig", {
12
+ 'protocol': 'http://',
13
+ 'endpoint': 'kead.api.ksyun.com',
14
+ 'config': {
15
+ 'timeout': 60,
16
+ //设置timeout
17
+ 'headers': {
18
+ 'Accept': 'application/json'
19
+ },
20
+ 'credentials': {
21
+ 'region': 'cn-shanghai-3',
22
+ 'service': 'kead'
23
+ }
24
+ }
25
+ });
26
+
27
+ _defineProperty(this, "_apiList", {
28
+ 'DescribeBlockIp': {
29
+ 'url': '/',
30
+ 'method': 'GET',
31
+ 'config': {
32
+ 'query': {
33
+ 'Version': '2020-01-01',
34
+ 'Action': 'DescribeBlockIp'
35
+ },
36
+ 'headers': {
37
+ 'Content-Type': 'application/json'
38
+ }
39
+ },
40
+ 'paramsType': {
41
+ 'SearchStr': 'String',
42
+ 'Status': 'String',
43
+ 'InstanceType': 'String',
44
+ 'RegionCode': 'String',
45
+ 'StartTime': 'String',
46
+ 'endTime': 'String'
47
+ }
48
+ }
49
+ });
50
+ }
51
+
52
+ };
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ const BaseClient = require("../../../base/BaseClient.js");
6
+
7
+ module.exports = class Client extends BaseClient {
8
+ constructor(...args) {
9
+ super(...args);
10
+
11
+ _defineProperty(this, "_baseConfig", {
12
+ 'protocol': 'http://',
13
+ 'endpoint': 'resourcemanager.api.ksyun.com',
14
+ 'config': {
15
+ 'timeout': 60,
16
+ //设置timeout
17
+ 'headers': {
18
+ 'Accept': 'application/json'
19
+ },
20
+ 'credentials': {
21
+ 'region': 'cn-shanghai-3',
22
+ 'service': 'resourcemanager'
23
+ }
24
+ }
25
+ });
26
+
27
+ _defineProperty(this, "_apiList", {
28
+ 'CreateFolder': {
29
+ 'url': '/',
30
+ 'method': 'POST',
31
+ 'config': {
32
+ 'query': {
33
+ 'Version': '2021-03-20',
34
+ 'Action': 'CreateFolder'
35
+ },
36
+ 'headers': {
37
+ 'Content-Type': 'application/x-www-form-urlencoded'
38
+ }
39
+ },
40
+ 'paramsType': {
41
+ 'ParentId': 'String',
42
+ 'Name': 'String',
43
+ 'Desc': 'String'
44
+ }
45
+ },
46
+ 'DeleteFolder': {
47
+ 'url': '/',
48
+ 'method': 'POST',
49
+ 'config': {
50
+ 'query': {
51
+ 'Version': '2021-03-20',
52
+ 'Action': 'DeleteFolder'
53
+ },
54
+ 'headers': {
55
+ 'Content-Type': 'application/x-www-form-urlencoded'
56
+ }
57
+ },
58
+ 'paramsType': {
59
+ 'FolderId': 'String'
60
+ }
61
+ },
62
+ 'UpdateFolder': {
63
+ 'url': '/',
64
+ 'method': 'POST',
65
+ 'config': {
66
+ 'query': {
67
+ 'Version': '2021-03-20',
68
+ 'Action': 'UpdateFolder'
69
+ },
70
+ 'headers': {
71
+ 'Content-Type': 'application/x-www-form-urlencoded'
72
+ }
73
+ },
74
+ 'paramsType': {
75
+ 'FolderId': 'String',
76
+ 'ParentId': 'String',
77
+ 'Name': 'String',
78
+ 'Desc': 'String'
79
+ }
80
+ },
81
+ 'ListAccountsForParent': {
82
+ 'url': '/',
83
+ 'method': 'GET',
84
+ 'config': {
85
+ 'query': {
86
+ 'Version': '2021-03-20',
87
+ 'Action': 'ListAccountsForParent'
88
+ },
89
+ 'headers': {
90
+ 'Content-Type': 'application/x-www-form-urlencoded'
91
+ }
92
+ },
93
+ 'paramsType': {
94
+ 'FolderId': 'String',
95
+ 'Search': 'String',
96
+ 'Page': 'Int',
97
+ 'PageSize': 'Int'
98
+ }
99
+ },
100
+ 'MoveAccount': {
101
+ 'url': '/',
102
+ 'method': 'POST',
103
+ 'config': {
104
+ 'query': {
105
+ 'Version': '2021-03-20',
106
+ 'Action': 'MoveAccount'
107
+ },
108
+ 'headers': {
109
+ 'Content-Type': 'application/x-www-form-urlencoded'
110
+ }
111
+ },
112
+ 'paramsType': {
113
+ 'Ids': 'String',
114
+ 'FromFolderId': 'String',
115
+ 'ToFolderId': 'String'
116
+ }
117
+ },
118
+ 'UpdateAccount': {
119
+ 'url': '/',
120
+ 'method': 'POST',
121
+ 'config': {
122
+ 'query': {
123
+ 'Version': '2021-03-20',
124
+ 'Action': 'UpdateAccount'
125
+ },
126
+ 'headers': {
127
+ 'Content-Type': 'application/x-www-form-urlencoded'
128
+ }
129
+ },
130
+ 'paramsType': {
131
+ 'MemberId': 'Int',
132
+ 'NewDisplayName': 'String',
133
+ 'FolderId': 'String'
134
+ }
135
+ },
136
+ 'ListAccounts': {
137
+ 'url': '/',
138
+ 'method': 'GET',
139
+ 'config': {
140
+ 'query': {
141
+ 'Version': '2021-03-20',
142
+ 'Action': 'ListAccounts'
143
+ },
144
+ 'headers': {
145
+ 'Content-Type': 'application/x-www-form-urlencoded'
146
+ }
147
+ },
148
+ 'paramsType': {
149
+ 'PageNumber': 'Int',
150
+ 'PageSize': 'Int',
151
+ 'IsAll': 'Int'
152
+ }
153
+ },
154
+ 'ListFolders': {
155
+ 'url': '/',
156
+ 'method': 'GET',
157
+ 'config': {
158
+ 'query': {
159
+ 'Version': '2021-03-20',
160
+ 'Action': 'ListFolders'
161
+ },
162
+ 'headers': {
163
+ 'Content-Type': 'application/x-www-form-urlencoded'
164
+ }
165
+ },
166
+ 'paramsType': {}
167
+ }
168
+ });
169
+ }
170
+
171
+ };
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ const BaseClient = require("../../../base/BaseClient.js");
6
+
7
+ module.exports = class Client extends BaseClient {
8
+ constructor(...args) {
9
+ super(...args);
10
+
11
+ _defineProperty(this, "_baseConfig", {
12
+ 'protocol': 'http://',
13
+ 'endpoint': 'sts.api.ksyun.com',
14
+ 'config': {
15
+ 'timeout': 60,
16
+ //设置timeout
17
+ 'headers': {
18
+ 'Accept': 'application/json'
19
+ },
20
+ 'credentials': {
21
+ 'region': 'cn-shanghai-3',
22
+ 'service': 'sts'
23
+ }
24
+ }
25
+ });
26
+
27
+ _defineProperty(this, "_apiList", {
28
+ 'AssumeRole': {
29
+ 'url': '/',
30
+ 'method': 'POST',
31
+ 'config': {
32
+ 'query': {
33
+ 'Version': '2015-11-01',
34
+ 'Action': 'AssumeRole'
35
+ },
36
+ 'headers': {
37
+ 'Content-Type': 'application/x-www-form-urlencoded'
38
+ }
39
+ },
40
+ 'paramsType': {
41
+ 'RoleKrn': 'String',
42
+ 'RoleSessionName': 'String',
43
+ 'DurationSeconds': 'String',
44
+ 'Policy': 'String'
45
+ }
46
+ }
47
+ });
48
+ }
49
+
50
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ const BaseClient = require("../../../base/BaseClient.js");
6
+
7
+ module.exports = class Client extends BaseClient {
8
+ constructor(...args) {
9
+ super(...args);
10
+
11
+ _defineProperty(this, "_baseConfig", {
12
+ 'protocol': 'http://',
13
+ 'endpoint': 'trade.api.ksyun.com',
14
+ 'config': {
15
+ 'timeout': 60,
16
+ //设置timeout
17
+ 'headers': {
18
+ 'Accept': 'application/json'
19
+ },
20
+ 'credentials': {
21
+ 'region': 'cn-shanghai-3',
22
+ 'service': 'trade'
23
+ }
24
+ }
25
+ });
26
+
27
+ _defineProperty(this, "_apiList", {
28
+ 'DescribeInstances': {
29
+ 'url': '/',
30
+ 'method': 'POST',
31
+ 'config': {
32
+ 'query': {
33
+ 'Version': '2020-01-14',
34
+ 'Action': 'DescribeInstances'
35
+ },
36
+ 'headers': {
37
+ 'Content-Type': 'application/x-www-form-urlencoded'
38
+ }
39
+ },
40
+ 'paramsType': {
41
+ 'InstanceIds': 'String'
42
+ }
43
+ }
44
+ });
45
+ }
46
+
47
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+
5
+ const BaseClient = require("../../../base/BaseClient.js");
6
+
7
+ module.exports = class Client extends BaseClient {
8
+ constructor(...args) {
9
+ super(...args);
10
+
11
+ _defineProperty(this, "_baseConfig", {
12
+ 'protocol': 'http://',
13
+ 'endpoint': 'trade.api.ksyun.com',
14
+ 'config': {
15
+ 'timeout': 60,
16
+ //设置timeout
17
+ 'headers': {
18
+ 'Accept': 'application/json'
19
+ },
20
+ 'credentials': {
21
+ 'region': 'cn-shanghai-3',
22
+ 'service': 'trade'
23
+ }
24
+ }
25
+ });
26
+
27
+ _defineProperty(this, "_apiList", {
28
+ 'SetRenewal': {
29
+ 'url': '/',
30
+ 'method': 'POST',
31
+ 'config': {
32
+ 'query': {
33
+ 'Version': '2020-08-31',
34
+ 'Action': 'SetRenewal'
35
+ },
36
+ 'headers': {
37
+ 'Content-Type': 'application/x-www-form-urlencoded'
38
+ }
39
+ },
40
+ 'paramsType': {
41
+ 'InstanceIds': 'String',
42
+ 'RenewStrategy': 'Int',
43
+ 'RenewDuration': 'Int'
44
+ }
45
+ }
46
+ });
47
+ }
48
+
49
+ };
package/example/iam.js ADDED
@@ -0,0 +1,40 @@
1
+ const kscSdk = require('../src/index.js')
2
+
3
+ const Client = kscSdk.Iam.v20151101
4
+ const clientConfig = {
5
+ // 认证信息
6
+ credential: {
7
+ secretId: '',
8
+ secretKey: '',
9
+ },
10
+ // 产品地域
11
+ region: "cn-beijing-6",
12
+ // 可选配置实例
13
+ httpProfile: {
14
+ method: 'POST', // 请求方法 GET 或者 POST
15
+ timeout: 60, // 请求超时时间秒
16
+ protocol: '', // 协议 http:// 或者 https://
17
+ endpoint: '' // 接入点域名 如 iam.api.ksyun.com
18
+ },
19
+ }
20
+ let client = new Client(clientConfig)
21
+
22
+ /**
23
+ * client.request 参数
24
+ * @param {string} apiAction 接口名
25
+ * @param {object} data 参数
26
+ */
27
+
28
+ let apiAction = 'GetUser'
29
+ let data = {
30
+ "UserName": "test14"
31
+ }
32
+
33
+ client.request(apiAction, data)
34
+ .then(res => res.json())
35
+ .then(data => {
36
+ console.log(JSON.stringify(data))
37
+ })
38
+ .catch(err => {
39
+ console.log(err)
40
+ })
package/example/res.js ADDED
@@ -0,0 +1,43 @@
1
+ const kscSdk = require('../src/index.js')
2
+
3
+ const Client = kscSdk.Resourcemanager.v20210320
4
+ const clientConfig = {
5
+ // 认证信息
6
+ credential: {
7
+ secretId: '',
8
+ secretKey: '',
9
+ },
10
+ // 产品地域
11
+ region: "cn-beijing-6",
12
+ // 可选配置实例
13
+ httpProfile: {
14
+ method: '', // 请求方法 get 或者 post
15
+ timeout: 60, // 请求超时时间秒
16
+ protocol: 'http://', // 协议 http:// 或者 https://
17
+ endpoint: '' // 接入点域名 如 iam.api.ksyun.com
18
+ },
19
+ }
20
+ let client = new Client(clientConfig)
21
+
22
+ /**
23
+ * client.request 参数
24
+ * @param {string} apiAction 接口名
25
+ * @param {object} data 参数
26
+ */
27
+
28
+ let apiAction = 'ListFolders'
29
+ let data = {
30
+ }
31
+
32
+ client.request(apiAction, data)
33
+ // .then(res => {
34
+ // console.log(res)
35
+ // return res
36
+ // })
37
+ .then(res => res.json())
38
+ .then(data => {
39
+ console.log(JSON.stringify(data))
40
+ })
41
+ .catch(err => {
42
+ console.log(err)
43
+ })
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "ksyun-sdk-node",
3
+ "version": "1.0.1",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "lint": "eslint --ext .js src/",
8
+ "build": "babel src --out-dir dist",
9
+ "test": "mocha",
10
+ "example": "node example/iam.js",
11
+ "postversion": "git push && git push --tags"
12
+ },
13
+ "keywords": [],
14
+ "author": "Sunxinqiang",
15
+ "license": "ISC",
16
+ "dependencies": {
17
+ "abort-controller": "^3.0.0",
18
+ "core-js": "^3.6.5",
19
+ "crypto-js": "^4.1.1",
20
+ "dayjs": "^1.10.7",
21
+ "node-fetch": "^2.6.7",
22
+ "qs": "^6.10.3"
23
+ },
24
+ "devDependencies": {
25
+ "@babel/cli": "^7.17.6",
26
+ "@babel/core": "^7.17.5",
27
+ "@babel/preset-env": "^7.16.11",
28
+ "chai": "^4.3.6",
29
+ "eslint": "^8.10.0",
30
+ "https-proxy-agent": "^5.0.0",
31
+ "mocha": "^9.2.1"
32
+ }
33
+ }