-
Notifications
You must be signed in to change notification settings - Fork 99
/
cvm_role.ts
28 lines (24 loc) · 1.03 KB
/
cvm_role.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import * as tencentcloud from "../../tencentcloud-sdk-nodejs"
// import * as tencentcloud from "tencentcloud-sdk-nodejs"
import CvmRoleCredential from "../../tencentcloud-sdk-nodejs/tencentcloud/common/cvm_role_credential"
// import CvmRoleCredential from "tencentcloud-sdk-nodejs/tencentcloud/common/cvm_role_credential"
async function main() {
// 导入对应产品模块的client models。
const CvmClient = tencentcloud.cvm.v20170312.Client
// 实例化要请求产品的client对象
const client = new CvmClient({
credential: new CvmRoleCredential(),
region: "ap-shanghai",
})
// 通过client对象调用想要访问的接口,需要传入请求对象以及响应回调函数
client.DescribeZones(null, function (err, response) {
// 请求异常返回,打印异常信息
if (err) {
console.log(err)
return
}
// 请求正常返回,打印response对象
console.log(response)
})
}
main().catch(console.error)