ksyun-sdk-node 1.5.8 → 1.5.10
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.
- package/README.md +25 -25
- package/dist/base/BaseClient.js +2 -1
- package/dist/service/Aicp/v20240612/index.js +55 -4
- package/example/iam.js +10 -11
- package/package.json +1 -1
- package/src/base/BaseClient.js +2 -1
- package/src/service/Aicp/v20240612/index.js +53 -2
- package/example/res.js +0 -44
package/README.md
CHANGED
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
```js
|
|
32
32
|
const kscSdk = require('ksyun-sdk-node')
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const IamClient = kscSdk.Iam.v20151101
|
|
35
35
|
const clientConfig = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
// 认证信息
|
|
37
|
+
credential: {
|
|
38
|
+
secretId: "KSYUN_SECRET_ID_HERE",
|
|
39
|
+
secretKey: "KSYUN_SECRET_KEY_HERE",
|
|
40
|
+
},
|
|
41
|
+
// 产品地域
|
|
42
|
+
region: "cn-beijing-6",
|
|
43
|
+
// 可选配置实例
|
|
44
|
+
httpProfile: {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
timeout: 60, // 请求超时时间秒
|
|
47
|
+
protocol: '',
|
|
48
|
+
endpoint: 'iam.api.ksyun.com',
|
|
49
|
+
},
|
|
50
50
|
}
|
|
51
|
-
let client = new
|
|
51
|
+
let client = new IamClient(clientConfig)
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* client.request 参数
|
|
@@ -56,19 +56,19 @@ let client = new Client(clientConfig)
|
|
|
56
56
|
* @param {object} data 参数
|
|
57
57
|
*/
|
|
58
58
|
|
|
59
|
-
let apiAction = '
|
|
59
|
+
let apiAction = 'ListUsers'
|
|
60
60
|
let data = {
|
|
61
|
-
|
|
61
|
+
"MaxItems": 100
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
client.request(apiAction, data)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
.then(res => res.json())
|
|
66
|
+
.then(data => {
|
|
67
|
+
console.log(JSON.stringify(data))
|
|
68
|
+
})
|
|
69
|
+
.catch(err => {
|
|
70
|
+
console.log(err)
|
|
71
|
+
})
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
# 更多示例
|
package/dist/base/BaseClient.js
CHANGED
|
@@ -40,7 +40,8 @@ module.exports = class BaseClient {
|
|
|
40
40
|
let region = this.region || this._baseConfig.config.credentials.region;
|
|
41
41
|
let headers = {
|
|
42
42
|
...(this._baseConfig.config.headers || {}),
|
|
43
|
-
...(apiConfig.config.headers || {})
|
|
43
|
+
...(apiConfig.config.headers || {}),
|
|
44
|
+
...(this.httpProfile.headers || {})
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
// 处理自定义path
|
|
@@ -407,7 +407,8 @@ module.exports = class Client extends BaseClient {
|
|
|
407
407
|
AssociatedModelId: "Filter",
|
|
408
408
|
Status: "Filter",
|
|
409
409
|
Namekeyword: "String",
|
|
410
|
-
DefaultKey: "Boolean"
|
|
410
|
+
DefaultKey: "Boolean",
|
|
411
|
+
KeyId: "Filter"
|
|
411
412
|
}
|
|
412
413
|
},
|
|
413
414
|
QueryTokenData: {
|
|
@@ -430,7 +431,8 @@ module.exports = class Client extends BaseClient {
|
|
|
430
431
|
GroupBy: "String",
|
|
431
432
|
ReasoningType: "String",
|
|
432
433
|
Marker: "Int",
|
|
433
|
-
IsGlobalServer: "Boolean"
|
|
434
|
+
IsGlobalServer: "Boolean",
|
|
435
|
+
ModelName: "String"
|
|
434
436
|
}
|
|
435
437
|
},
|
|
436
438
|
DisableApikeyStatus: {
|
|
@@ -940,13 +942,30 @@ module.exports = class Client extends BaseClient {
|
|
|
940
942
|
Filter: "Array"
|
|
941
943
|
}
|
|
942
944
|
},
|
|
943
|
-
|
|
945
|
+
EnableEndpointRateLimit: {
|
|
944
946
|
url: "/",
|
|
945
947
|
method: "POST",
|
|
946
948
|
config: {
|
|
947
949
|
query: {
|
|
948
950
|
Version: "2024-06-12",
|
|
949
|
-
Action: "
|
|
951
|
+
Action: "EnableEndpointRateLimit"
|
|
952
|
+
},
|
|
953
|
+
headers: {
|
|
954
|
+
"Content-Type": "application/json"
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
paramsType: {
|
|
958
|
+
EndpointId: "String",
|
|
959
|
+
RateLimit: "Object"
|
|
960
|
+
}
|
|
961
|
+
},
|
|
962
|
+
UpdateInferenceEndpoint: {
|
|
963
|
+
url: "/",
|
|
964
|
+
method: "POST",
|
|
965
|
+
config: {
|
|
966
|
+
query: {
|
|
967
|
+
Version: "2024-06-12",
|
|
968
|
+
Action: "UpdateInferenceEndpoint"
|
|
950
969
|
},
|
|
951
970
|
headers: {
|
|
952
971
|
"Content-Type": "application/json"
|
|
@@ -960,6 +979,38 @@ module.exports = class Client extends BaseClient {
|
|
|
960
979
|
EndpointId: "String"
|
|
961
980
|
}
|
|
962
981
|
},
|
|
982
|
+
StartInferenceEndpoint: {
|
|
983
|
+
url: "/",
|
|
984
|
+
method: "POST",
|
|
985
|
+
config: {
|
|
986
|
+
query: {
|
|
987
|
+
Version: "2024-06-12",
|
|
988
|
+
Action: "StartInferenceEndpoint"
|
|
989
|
+
},
|
|
990
|
+
headers: {
|
|
991
|
+
"Content-Type": "application/json"
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
paramsType: {
|
|
995
|
+
EndpointId: "String"
|
|
996
|
+
}
|
|
997
|
+
},
|
|
998
|
+
StopInferenceEndpoint: {
|
|
999
|
+
url: "/",
|
|
1000
|
+
method: "POST",
|
|
1001
|
+
config: {
|
|
1002
|
+
query: {
|
|
1003
|
+
Version: "2024-06-12",
|
|
1004
|
+
Action: "StopInferenceEndpoint"
|
|
1005
|
+
},
|
|
1006
|
+
headers: {
|
|
1007
|
+
"Content-Type": "application/json"
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
paramsType: {
|
|
1011
|
+
EndpointId: "String"
|
|
1012
|
+
}
|
|
1013
|
+
},
|
|
963
1014
|
DeleteInferenceEndpoint: {
|
|
964
1015
|
url: "/",
|
|
965
1016
|
method: "POST",
|
package/example/iam.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
const kscSdk = require('
|
|
1
|
+
const kscSdk = require('ksyun-sdk-node')
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const IamClient = kscSdk.Iam.v20151101
|
|
4
4
|
const clientConfig = {
|
|
5
5
|
// 认证信息
|
|
6
6
|
credential: {
|
|
7
|
-
secretId:
|
|
8
|
-
secretKey:
|
|
7
|
+
secretId: "KSYUN_SECRET_ID_HERE",
|
|
8
|
+
secretKey: "KSYUN_SECRET_KEY_HERE",
|
|
9
9
|
},
|
|
10
10
|
// 产品地域
|
|
11
11
|
region: "cn-beijing-6",
|
|
12
12
|
// 可选配置实例
|
|
13
13
|
httpProfile: {
|
|
14
|
-
method: 'POST',
|
|
14
|
+
method: 'POST',
|
|
15
15
|
timeout: 60, // 请求超时时间秒
|
|
16
|
-
protocol: '',
|
|
17
|
-
endpoint: '
|
|
18
|
-
path: '' // 自定义URL路径 如 /api/v1/xxx
|
|
16
|
+
protocol: '',
|
|
17
|
+
endpoint: 'iam.api.ksyun.com',
|
|
19
18
|
},
|
|
20
19
|
}
|
|
21
|
-
let client = new
|
|
20
|
+
let client = new IamClient(clientConfig)
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* client.request 参数
|
|
@@ -26,9 +25,9 @@ let client = new Client(clientConfig)
|
|
|
26
25
|
* @param {object} data 参数
|
|
27
26
|
*/
|
|
28
27
|
|
|
29
|
-
let apiAction = '
|
|
28
|
+
let apiAction = 'ListUsers'
|
|
30
29
|
let data = {
|
|
31
|
-
"
|
|
30
|
+
"MaxItems": 100
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
client.request(apiAction, data)
|
package/package.json
CHANGED
package/src/base/BaseClient.js
CHANGED
|
@@ -36,7 +36,8 @@ module.exports = class BaseClient {
|
|
|
36
36
|
let region = this.region || this._baseConfig.config.credentials.region
|
|
37
37
|
let headers = {
|
|
38
38
|
...(this._baseConfig.config.headers || {}),
|
|
39
|
-
...(apiConfig.config.headers || {})
|
|
39
|
+
...(apiConfig.config.headers || {}),
|
|
40
|
+
...(this.httpProfile.headers || {})
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
// 处理自定义path
|
|
@@ -401,6 +401,7 @@ module.exports = class Client extends BaseClient {
|
|
|
401
401
|
Status: "Filter",
|
|
402
402
|
Namekeyword: "String",
|
|
403
403
|
DefaultKey: "Boolean",
|
|
404
|
+
KeyId: "Filter",
|
|
404
405
|
},
|
|
405
406
|
},
|
|
406
407
|
QueryTokenData: {
|
|
@@ -424,6 +425,7 @@ module.exports = class Client extends BaseClient {
|
|
|
424
425
|
ReasoningType: "String",
|
|
425
426
|
Marker: "Int",
|
|
426
427
|
IsGlobalServer: "Boolean",
|
|
428
|
+
ModelName: "String",
|
|
427
429
|
},
|
|
428
430
|
},
|
|
429
431
|
DisableApikeyStatus: {
|
|
@@ -933,13 +935,30 @@ module.exports = class Client extends BaseClient {
|
|
|
933
935
|
Filter: "Array",
|
|
934
936
|
},
|
|
935
937
|
},
|
|
936
|
-
|
|
938
|
+
EnableEndpointRateLimit: {
|
|
937
939
|
url: "/",
|
|
938
940
|
method: "POST",
|
|
939
941
|
config: {
|
|
940
942
|
query: {
|
|
941
943
|
Version: "2024-06-12",
|
|
942
|
-
Action: "
|
|
944
|
+
Action: "EnableEndpointRateLimit",
|
|
945
|
+
},
|
|
946
|
+
headers: {
|
|
947
|
+
"Content-Type": "application/json",
|
|
948
|
+
},
|
|
949
|
+
},
|
|
950
|
+
paramsType: {
|
|
951
|
+
EndpointId: "String",
|
|
952
|
+
RateLimit: "Object",
|
|
953
|
+
},
|
|
954
|
+
},
|
|
955
|
+
UpdateInferenceEndpoint: {
|
|
956
|
+
url: "/",
|
|
957
|
+
method: "POST",
|
|
958
|
+
config: {
|
|
959
|
+
query: {
|
|
960
|
+
Version: "2024-06-12",
|
|
961
|
+
Action: "UpdateInferenceEndpoint",
|
|
943
962
|
},
|
|
944
963
|
headers: {
|
|
945
964
|
"Content-Type": "application/json",
|
|
@@ -953,6 +972,38 @@ module.exports = class Client extends BaseClient {
|
|
|
953
972
|
EndpointId: "String",
|
|
954
973
|
},
|
|
955
974
|
},
|
|
975
|
+
StartInferenceEndpoint: {
|
|
976
|
+
url: "/",
|
|
977
|
+
method: "POST",
|
|
978
|
+
config: {
|
|
979
|
+
query: {
|
|
980
|
+
Version: "2024-06-12",
|
|
981
|
+
Action: "StartInferenceEndpoint",
|
|
982
|
+
},
|
|
983
|
+
headers: {
|
|
984
|
+
"Content-Type": "application/json",
|
|
985
|
+
},
|
|
986
|
+
},
|
|
987
|
+
paramsType: {
|
|
988
|
+
EndpointId: "String",
|
|
989
|
+
},
|
|
990
|
+
},
|
|
991
|
+
StopInferenceEndpoint: {
|
|
992
|
+
url: "/",
|
|
993
|
+
method: "POST",
|
|
994
|
+
config: {
|
|
995
|
+
query: {
|
|
996
|
+
Version: "2024-06-12",
|
|
997
|
+
Action: "StopInferenceEndpoint",
|
|
998
|
+
},
|
|
999
|
+
headers: {
|
|
1000
|
+
"Content-Type": "application/json",
|
|
1001
|
+
},
|
|
1002
|
+
},
|
|
1003
|
+
paramsType: {
|
|
1004
|
+
EndpointId: "String",
|
|
1005
|
+
},
|
|
1006
|
+
},
|
|
956
1007
|
DeleteInferenceEndpoint: {
|
|
957
1008
|
url: "/",
|
|
958
1009
|
method: "POST",
|
package/example/res.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
path: '' // 自定义URL路径 如 /api/v1/xxx
|
|
19
|
-
},
|
|
20
|
-
}
|
|
21
|
-
let client = new Client(clientConfig)
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* client.request 参数
|
|
25
|
-
* @param {string} apiAction 接口名
|
|
26
|
-
* @param {object} data 参数
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
let apiAction = 'ListFolders'
|
|
30
|
-
let data = {
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
client.request(apiAction, data)
|
|
34
|
-
// .then(res => {
|
|
35
|
-
// console.log(res)
|
|
36
|
-
// return res
|
|
37
|
-
// })
|
|
38
|
-
.then(res => res.json())
|
|
39
|
-
.then(data => {
|
|
40
|
-
console.log(JSON.stringify(data))
|
|
41
|
-
})
|
|
42
|
-
.catch(err => {
|
|
43
|
-
console.log(err)
|
|
44
|
-
})
|