tencentcloud-sdk-nodejs 4.1.119 → 4.1.121
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/es/common/credential.js +209 -0
- package/es/common/index.js +1 -0
- package/es/common/sdk_version.js +1 -1
- package/es/services/apm/v20210622/apm_client.js +3 -0
- package/es/services/billing/v20180709/billing_client.js +22 -4
- package/es/services/ccc/v20200210/ccc_client.js +5 -2
- package/es/services/cvm/v20170312/cvm_client.js +0 -12
- package/es/services/gs/v20191118/gs_client.js +12 -0
- package/es/services/iotexplorer/v20190423/iotexplorer_client.js +5 -2
- package/es/services/wedata/index.js +2 -0
- package/es/services/wedata/v20250806/index.js +6 -0
- package/es/services/wedata/v20250806/wedata_client.js +237 -0
- package/es/services/wedata/v20250806/wedata_models.js +1 -0
- package/package.json +3 -1
- package/tencentcloud/common/credential.d.ts +101 -0
- package/tencentcloud/common/credential.js +267 -0
- package/tencentcloud/common/cvm_role_credential.d.ts +2 -7
- package/tencentcloud/common/index.d.ts +1 -0
- package/tencentcloud/common/index.js +1 -0
- package/tencentcloud/common/interface.d.ts +7 -0
- package/tencentcloud/common/sdk_version.d.ts +1 -1
- package/tencentcloud/common/sdk_version.js +1 -1
- package/tencentcloud/services/ai3d/v20250513/ai3d_client.d.ts +4 -4
- package/tencentcloud/services/ai3d/v20250513/ai3d_client.js +4 -4
- package/tencentcloud/services/apm/v20210622/apm_client.d.ts +5 -1
- package/tencentcloud/services/apm/v20210622/apm_client.js +6 -0
- package/tencentcloud/services/apm/v20210622/apm_models.d.ts +163 -0
- package/tencentcloud/services/billing/v20180709/billing_client.d.ts +29 -5
- package/tencentcloud/services/billing/v20180709/billing_client.js +42 -6
- package/tencentcloud/services/billing/v20180709/billing_models.d.ts +1245 -338
- package/tencentcloud/services/ccc/v20200210/ccc_client.d.ts +7 -3
- package/tencentcloud/services/ccc/v20200210/ccc_client.js +9 -3
- package/tencentcloud/services/ccc/v20200210/ccc_models.d.ts +89 -2
- package/tencentcloud/services/cfw/v20190904/cfw_models.d.ts +45 -1
- package/tencentcloud/services/ckafka/v20190819/ckafka_models.d.ts +17 -0
- package/tencentcloud/services/ctem/v20231128/ctem_models.d.ts +116 -0
- package/tencentcloud/services/cvm/v20170312/cvm_client.d.ts +1 -17
- package/tencentcloud/services/cvm/v20170312/cvm_client.js +0 -24
- package/tencentcloud/services/cvm/v20170312/cvm_models.d.ts +49 -455
- package/tencentcloud/services/emr/v20190103/emr_models.d.ts +14 -0
- package/tencentcloud/services/ess/v20201111/ess_client.d.ts +3 -3
- package/tencentcloud/services/ess/v20201111/ess_client.js +3 -3
- package/tencentcloud/services/ess/v20201111/ess_models.d.ts +4 -4
- package/tencentcloud/services/essbasic/v20210526/essbasic_models.d.ts +1 -1
- package/tencentcloud/services/gs/v20191118/gs_client.d.ts +17 -1
- package/tencentcloud/services/gs/v20191118/gs_client.js +24 -0
- package/tencentcloud/services/gs/v20191118/gs_models.d.ts +171 -71
- package/tencentcloud/services/iai/v20180301/iai_client.d.ts +0 -1
- package/tencentcloud/services/iai/v20180301/iai_client.js +0 -1
- package/tencentcloud/services/iai/v20180301/iai_models.d.ts +12 -13
- package/tencentcloud/services/iotexplorer/v20190423/iotexplorer_client.d.ts +7 -3
- package/tencentcloud/services/iotexplorer/v20190423/iotexplorer_client.js +9 -3
- package/tencentcloud/services/iotexplorer/v20190423/iotexplorer_models.d.ts +35 -0
- package/tencentcloud/services/lighthouse/v20200324/lighthouse_models.d.ts +75 -6
- package/tencentcloud/services/lke/v20231130/lke_models.d.ts +14 -1
- package/tencentcloud/services/lkeap/v20240522/lkeap_client.d.ts +6 -4
- package/tencentcloud/services/lkeap/v20240522/lkeap_client.js +6 -4
- package/tencentcloud/services/mna/v20210119/mna_models.d.ts +4 -0
- package/tencentcloud/services/ocr/v20181119/ocr_client.d.ts +1 -1
- package/tencentcloud/services/ocr/v20181119/ocr_client.js +1 -1
- package/tencentcloud/services/organization/v20210331/organization_models.d.ts +3 -3
- package/tencentcloud/services/redis/v20180412/redis_client.d.ts +2 -2
- package/tencentcloud/services/redis/v20180412/redis_client.js +2 -2
- package/tencentcloud/services/redis/v20180412/redis_models.d.ts +10 -7
- package/tencentcloud/services/sqlserver/v20180328/sqlserver_models.d.ts +5 -0
- package/tencentcloud/services/tsf/v20180326/tsf_models.d.ts +0 -1
- package/tencentcloud/services/vod/v20180717/vod_models.d.ts +0 -1
- package/tencentcloud/services/vpc/v20170312/vpc_client.d.ts +0 -1
- package/tencentcloud/services/vpc/v20170312/vpc_client.js +0 -1
- package/tencentcloud/services/vpc/v20170312/vpc_models.d.ts +1 -1
- package/tencentcloud/services/wedata/index.d.ts +4 -0
- package/tencentcloud/services/wedata/index.js +2 -0
- package/tencentcloud/services/wedata/v20250806/index.d.ts +6 -0
- package/tencentcloud/services/wedata/v20250806/index.js +10 -0
- package/tencentcloud/services/wedata/v20250806/wedata_client.d.ts +318 -0
- package/tencentcloud/services/wedata/v20250806/wedata_client.js +493 -0
- package/tencentcloud/services/wedata/v20250806/wedata_models.d.ts +7466 -0
- package/tencentcloud/services/wedata/v20250806/wedata_models.js +18 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "tencentcloud-sdk-nodejs",
|
3
|
-
"version": "4.1.
|
3
|
+
"version": "4.1.121",
|
4
4
|
"description": "腾讯云 API NODEJS SDK",
|
5
5
|
"main": "./tencentcloud/index.js",
|
6
6
|
"module": "./es/index.js",
|
@@ -36,6 +36,7 @@
|
|
36
36
|
"form-data": "^3.0.4",
|
37
37
|
"get-stream": "^6.0.0",
|
38
38
|
"https-proxy-agent": "^5.0.0",
|
39
|
+
"ini": "^5.0.0",
|
39
40
|
"is-stream": "^2.0.0",
|
40
41
|
"json-bigint": "^1.0.0",
|
41
42
|
"node-fetch": "^2.2.0",
|
@@ -51,6 +52,7 @@
|
|
51
52
|
"url": "https://github.com/tencentcloud/tencentcloud-sdk-nodejs"
|
52
53
|
},
|
53
54
|
"devDependencies": {
|
55
|
+
"@types/ini": "^4.1.1",
|
54
56
|
"@types/json-bigint": "^1.0.1",
|
55
57
|
"@types/node": "^18.0.0",
|
56
58
|
"@types/node-fetch": "^2.5.7",
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import { ClientConfig, Credential, CredentialResult, DynamicCredential } from "./interface";
|
2
|
+
/**
|
3
|
+
* Basic credential with secret id and secret key
|
4
|
+
*/
|
5
|
+
export declare class BasicCredential implements Credential {
|
6
|
+
readonly secretId: string;
|
7
|
+
readonly secretKey: string;
|
8
|
+
readonly token?: string;
|
9
|
+
constructor(secretId: string, secretKey: string, token?: string);
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Environment variable credential
|
13
|
+
* Get credential from environment variables:
|
14
|
+
* - TENCENTCLOUD_SECRET_ID
|
15
|
+
* - TENCENTCLOUD_SECRET_KEY
|
16
|
+
* - TENCENTCLOUD_SESSION_TOKEN (optional)
|
17
|
+
*/
|
18
|
+
export declare class EnvironmentVariableCredential implements DynamicCredential {
|
19
|
+
getCredential(): Promise<Credential>;
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Profile credential
|
23
|
+
* Get credential from profile file ~/.tencentcloud/credentials or /etc/tencentcloud/credentials
|
24
|
+
* example credentials file:
|
25
|
+
* [default]
|
26
|
+
* secret_id = your-secret-id
|
27
|
+
* secret_key = your-secret-key
|
28
|
+
*/
|
29
|
+
export declare class ProfileCredential implements DynamicCredential {
|
30
|
+
getCredential(): Promise<Credential>;
|
31
|
+
}
|
32
|
+
interface AssumeRoleParams {
|
33
|
+
RoleArn: string;
|
34
|
+
RoleSessionName: string;
|
35
|
+
[key: string]: any;
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* Tencent Cloud Credential via STS service
|
39
|
+
* @see {@link https://cloud.tencent.com/document/api/1312/48197} for more information.
|
40
|
+
*/
|
41
|
+
export declare class STSCredential implements DynamicCredential {
|
42
|
+
private clientConfig;
|
43
|
+
private assumeRoleParams;
|
44
|
+
private endpoint;
|
45
|
+
private version;
|
46
|
+
private action;
|
47
|
+
private region;
|
48
|
+
credentialTask: Promise<CredentialResult> | null;
|
49
|
+
/**
|
50
|
+
* Constructs a new STSCredential instance
|
51
|
+
*
|
52
|
+
* @param {ClientConfig} clientConfig Request client Configuration object
|
53
|
+
* @param {AssumeRoleParams} assumeRoleParams Request parameters of the AssumeRole interface
|
54
|
+
* @see {@link https://cloud.tencent.com/document/api/1312/48197} for more AssumeRoleParams information.
|
55
|
+
*/
|
56
|
+
constructor(clientConfig: ClientConfig, assumeRoleParams: AssumeRoleParams);
|
57
|
+
protected getCredentialWithStsAssumeRole(): Promise<CredentialResult>;
|
58
|
+
getCredential(): Promise<Credential>;
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* CVM Role credential using existing implementation
|
62
|
+
* Re-export the existing CvmRoleCredential for consistency
|
63
|
+
*/
|
64
|
+
export { default as CvmRoleCredential } from "./cvm_role_credential";
|
65
|
+
/**
|
66
|
+
* TencentCloud OIDC Credential
|
67
|
+
* OIDC is an authentication protocol built on OAuth 2.0. Tencent Cloud CAM supports OIDC role-based SSO.
|
68
|
+
* @see {@link https://cloud.tencent.com/document/product/598/96013} for more information.
|
69
|
+
*/
|
70
|
+
export declare class OIDCRoleArnCredential implements DynamicCredential {
|
71
|
+
private endpoint;
|
72
|
+
private version;
|
73
|
+
private action;
|
74
|
+
private clientConfig;
|
75
|
+
private assumeRoleWithWebIdentityParams;
|
76
|
+
private defaultSessionName;
|
77
|
+
private isTke;
|
78
|
+
protected region: string;
|
79
|
+
protected expirationReservationTime: number;
|
80
|
+
protected credentialTask: Promise<CredentialResult> | null;
|
81
|
+
/**
|
82
|
+
* Constructs a new OIDCRoleArnCredential instance
|
83
|
+
*
|
84
|
+
* @param {ClientConfig} [clientConfig] Optional request client Configuration object
|
85
|
+
* @param {AssumeRoleParams} [assumeRoleParams] Optional request parameters of the AssumeRole interface
|
86
|
+
* @see {@link https://cloud.tencent.com/document/api/1312/48197} for more AssumeRoleWithWebIdentity information.
|
87
|
+
*/
|
88
|
+
constructor();
|
89
|
+
constructor(clientConfig: ClientConfig, assumeRoleWithWebIdentityParams: AssumeRoleParams);
|
90
|
+
private initFromTke;
|
91
|
+
protected getCredentialWithStsAssumeRoleWithWebIdentity(): Promise<CredentialResult>;
|
92
|
+
getCredential(): Promise<Credential>;
|
93
|
+
}
|
94
|
+
/**
|
95
|
+
* Tencent Cloud DefaultCredentialProvider
|
96
|
+
*/
|
97
|
+
export declare class DefaultCredentialProvider implements DynamicCredential {
|
98
|
+
private readonly providers;
|
99
|
+
constructor();
|
100
|
+
getCredential(): Promise<Credential>;
|
101
|
+
}
|
@@ -0,0 +1,267 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DefaultCredentialProvider = exports.OIDCRoleArnCredential = exports.CvmRoleCredential = exports.STSCredential = exports.ProfileCredential = exports.EnvironmentVariableCredential = exports.BasicCredential = void 0;
|
4
|
+
const tslib_1 = require("tslib");
|
5
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
6
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
7
|
+
const os_1 = require("os");
|
8
|
+
const ini_1 = require("ini");
|
9
|
+
const common_client_1 = require("./common_client");
|
10
|
+
const cvm_role_credential_1 = tslib_1.__importDefault(require("./cvm_role_credential"));
|
11
|
+
const EXPIRE_BUFFER = 30 * 1000;
|
12
|
+
/**
|
13
|
+
* Basic credential with secret id and secret key
|
14
|
+
*/
|
15
|
+
class BasicCredential {
|
16
|
+
constructor(secretId, secretKey, token) {
|
17
|
+
this.secretId = secretId;
|
18
|
+
this.secretKey = secretKey;
|
19
|
+
this.token = token;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
exports.BasicCredential = BasicCredential;
|
23
|
+
/**
|
24
|
+
* Environment variable credential
|
25
|
+
* Get credential from environment variables:
|
26
|
+
* - TENCENTCLOUD_SECRET_ID
|
27
|
+
* - TENCENTCLOUD_SECRET_KEY
|
28
|
+
* - TENCENTCLOUD_SESSION_TOKEN (optional)
|
29
|
+
*/
|
30
|
+
class EnvironmentVariableCredential {
|
31
|
+
async getCredential() {
|
32
|
+
const secretId = process.env.TENCENTCLOUD_SECRET_ID;
|
33
|
+
const secretKey = process.env.TENCENTCLOUD_SECRET_KEY;
|
34
|
+
const token = process.env.TENCENTCLOUD_SESSION_TOKEN;
|
35
|
+
return new BasicCredential(secretId, secretKey, token);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
exports.EnvironmentVariableCredential = EnvironmentVariableCredential;
|
39
|
+
/**
|
40
|
+
* Profile credential
|
41
|
+
* Get credential from profile file ~/.tencentcloud/credentials or /etc/tencentcloud/credentials
|
42
|
+
* example credentials file:
|
43
|
+
* [default]
|
44
|
+
* secret_id = your-secret-id
|
45
|
+
* secret_key = your-secret-key
|
46
|
+
*/
|
47
|
+
class ProfileCredential {
|
48
|
+
async getCredential() {
|
49
|
+
let filePath = '';
|
50
|
+
// Try user home directory first
|
51
|
+
const userHome = (0, os_1.homedir)();
|
52
|
+
const userCredentialsPath = path_1.default.join(userHome, ".tencentcloud", "credentials");
|
53
|
+
if (fs_1.default.existsSync(userCredentialsPath)) {
|
54
|
+
filePath = userCredentialsPath;
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
// Try system directory as fallback
|
58
|
+
filePath = '/etc/tencentcloud/credentials';
|
59
|
+
}
|
60
|
+
if (filePath) {
|
61
|
+
try {
|
62
|
+
const content = fs_1.default.readFileSync(filePath, "utf8");
|
63
|
+
const { default: { secret_id, secret_key, token } } = (0, ini_1.parse)(content);
|
64
|
+
if (secret_id && secret_key) {
|
65
|
+
return new BasicCredential(secret_id, secret_key, token);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
catch (error) {
|
69
|
+
// Ignore errors when reading user credentials
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return new BasicCredential('', '');
|
73
|
+
}
|
74
|
+
}
|
75
|
+
exports.ProfileCredential = ProfileCredential;
|
76
|
+
/**
|
77
|
+
* Tencent Cloud Credential via STS service
|
78
|
+
* @see {@link https://cloud.tencent.com/document/api/1312/48197} for more information.
|
79
|
+
*/
|
80
|
+
class STSCredential {
|
81
|
+
/**
|
82
|
+
* Constructs a new STSCredential instance
|
83
|
+
*
|
84
|
+
* @param {ClientConfig} clientConfig Request client Configuration object
|
85
|
+
* @param {AssumeRoleParams} assumeRoleParams Request parameters of the AssumeRole interface
|
86
|
+
* @see {@link https://cloud.tencent.com/document/api/1312/48197} for more AssumeRoleParams information.
|
87
|
+
*/
|
88
|
+
constructor(clientConfig, assumeRoleParams) {
|
89
|
+
this.clientConfig = clientConfig;
|
90
|
+
this.assumeRoleParams = assumeRoleParams;
|
91
|
+
this.endpoint = 'sts.tencentcloudapi.com';
|
92
|
+
this.version = '2018-08-13';
|
93
|
+
this.action = 'AssumeRole';
|
94
|
+
this.region = 'ap-guangzhou';
|
95
|
+
}
|
96
|
+
async getCredentialWithStsAssumeRole() {
|
97
|
+
const { endpoint, version, action, region, clientConfig, assumeRoleParams } = this;
|
98
|
+
try {
|
99
|
+
const client = new common_client_1.CommonClient(endpoint, version, {
|
100
|
+
region,
|
101
|
+
...clientConfig
|
102
|
+
});
|
103
|
+
const result = await client.request(action, assumeRoleParams);
|
104
|
+
return {
|
105
|
+
TmpSecretId: result.Credentials.TmpSecretId,
|
106
|
+
TmpSecretKey: result.Credentials.TmpSecretKey,
|
107
|
+
Token: result.Credentials.Token,
|
108
|
+
ExpiredTime: result.ExpiredTime,
|
109
|
+
Expiration: result.Expiration,
|
110
|
+
};
|
111
|
+
}
|
112
|
+
catch (error) {
|
113
|
+
throw new Error(`Get STS AssumeRole failed: ${error.message}`);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
async getCredential() {
|
117
|
+
if (!this.credentialTask) {
|
118
|
+
this.credentialTask = this.getCredentialWithStsAssumeRole();
|
119
|
+
}
|
120
|
+
const credential = await this.credentialTask;
|
121
|
+
// Check if the credential is expired
|
122
|
+
if (credential.ExpiredTime * 1000 - EXPIRE_BUFFER <= Date.now()) {
|
123
|
+
this.credentialTask = null;
|
124
|
+
return this.getCredential();
|
125
|
+
}
|
126
|
+
return {
|
127
|
+
secretId: credential.TmpSecretId,
|
128
|
+
secretKey: credential.TmpSecretKey,
|
129
|
+
token: credential.Token,
|
130
|
+
};
|
131
|
+
}
|
132
|
+
}
|
133
|
+
exports.STSCredential = STSCredential;
|
134
|
+
/**
|
135
|
+
* CVM Role credential using existing implementation
|
136
|
+
* Re-export the existing CvmRoleCredential for consistency
|
137
|
+
*/
|
138
|
+
var cvm_role_credential_2 = require("./cvm_role_credential");
|
139
|
+
Object.defineProperty(exports, "CvmRoleCredential", { enumerable: true, get: function () { return tslib_1.__importDefault(cvm_role_credential_2).default; } });
|
140
|
+
/**
|
141
|
+
* TencentCloud OIDC Credential
|
142
|
+
* OIDC is an authentication protocol built on OAuth 2.0. Tencent Cloud CAM supports OIDC role-based SSO.
|
143
|
+
* @see {@link https://cloud.tencent.com/document/product/598/96013} for more information.
|
144
|
+
*/
|
145
|
+
class OIDCRoleArnCredential {
|
146
|
+
constructor(clientConfig, assumeRoleWithWebIdentityParams) {
|
147
|
+
this.endpoint = 'sts.tencentcloudapi.com';
|
148
|
+
this.version = '2018-08-13';
|
149
|
+
this.action = 'AssumeRoleWithWebIdentity';
|
150
|
+
this.defaultSessionName = 'tencentcloud-node-sdk-';
|
151
|
+
this.isTke = false;
|
152
|
+
this.expirationReservationTime = 600;
|
153
|
+
if (clientConfig && assumeRoleWithWebIdentityParams) {
|
154
|
+
this.clientConfig = clientConfig;
|
155
|
+
this.assumeRoleWithWebIdentityParams = assumeRoleWithWebIdentityParams;
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
this.isTke = true;
|
159
|
+
this.clientConfig = {
|
160
|
+
credential: new BasicCredential('', ''),
|
161
|
+
...clientConfig,
|
162
|
+
};
|
163
|
+
}
|
164
|
+
}
|
165
|
+
initFromTke() {
|
166
|
+
const region = process.env.TKE_REGION;
|
167
|
+
if (!region) {
|
168
|
+
throw new Error('env TKE_REGION not exist');
|
169
|
+
}
|
170
|
+
const providerId = process.env.TKE_PROVIDER_ID;
|
171
|
+
if (!providerId) {
|
172
|
+
throw new Error('env TKE_PROVIDER_ID not exist');
|
173
|
+
}
|
174
|
+
const tokenFile = process.env.TKE_WEB_IDENTITY_TOKEN_FILE;
|
175
|
+
if (!tokenFile) {
|
176
|
+
throw new Error('env TKE_WEB_IDENTITY_TOKEN_FILE not exist');
|
177
|
+
}
|
178
|
+
let wbIdentityToken;
|
179
|
+
try {
|
180
|
+
wbIdentityToken = fs_1.default.readFileSync(tokenFile).toString();
|
181
|
+
}
|
182
|
+
catch (error) {
|
183
|
+
throw new Error(`failed to read token file: ${error.message}`);
|
184
|
+
}
|
185
|
+
const roleArn = process.env.TKE_ROLE_ARN;
|
186
|
+
if (!roleArn) {
|
187
|
+
throw new Error('env TKE_ROLE_ARN not exist');
|
188
|
+
}
|
189
|
+
this.clientConfig.region = region;
|
190
|
+
this.assumeRoleWithWebIdentityParams = {
|
191
|
+
RoleArn: roleArn,
|
192
|
+
RoleSessionName: `${this.defaultSessionName}${Date.now() * 1000}`,
|
193
|
+
WebIdentityToken: wbIdentityToken,
|
194
|
+
ProviderId: providerId,
|
195
|
+
};
|
196
|
+
}
|
197
|
+
async getCredentialWithStsAssumeRoleWithWebIdentity() {
|
198
|
+
try {
|
199
|
+
if (this.isTke) {
|
200
|
+
this.initFromTke();
|
201
|
+
}
|
202
|
+
const { endpoint, version, action, region, clientConfig, assumeRoleWithWebIdentityParams } = this;
|
203
|
+
const client = new common_client_1.CommonClient(endpoint, version, {
|
204
|
+
region: region,
|
205
|
+
...clientConfig,
|
206
|
+
});
|
207
|
+
const result = await client.request(action, assumeRoleWithWebIdentityParams);
|
208
|
+
return {
|
209
|
+
TmpSecretId: result.Credentials.TmpSecretId,
|
210
|
+
TmpSecretKey: result.Credentials.TmpSecretKey,
|
211
|
+
Token: result.Credentials.Token,
|
212
|
+
ExpiredTime: result.ExpiredTime,
|
213
|
+
Expiration: result.Expiration,
|
214
|
+
};
|
215
|
+
}
|
216
|
+
catch (error) {
|
217
|
+
throw new Error(`Get STS AssumeRoleWithWebIdentity failed: ${error.message}`);
|
218
|
+
}
|
219
|
+
}
|
220
|
+
async getCredential() {
|
221
|
+
if (!this.credentialTask) {
|
222
|
+
this.credentialTask = this.getCredentialWithStsAssumeRoleWithWebIdentity();
|
223
|
+
}
|
224
|
+
const credential = await this.credentialTask;
|
225
|
+
// Check if the credential is expired
|
226
|
+
if (credential.ExpiredTime * 1000 - this.expirationReservationTime <= Date.now()) {
|
227
|
+
this.credentialTask = null;
|
228
|
+
return this.getCredential();
|
229
|
+
}
|
230
|
+
return {
|
231
|
+
secretId: credential.TmpSecretId,
|
232
|
+
secretKey: credential.TmpSecretKey,
|
233
|
+
token: credential.Token,
|
234
|
+
};
|
235
|
+
}
|
236
|
+
}
|
237
|
+
exports.OIDCRoleArnCredential = OIDCRoleArnCredential;
|
238
|
+
/**
|
239
|
+
* Tencent Cloud DefaultCredentialProvider
|
240
|
+
*/
|
241
|
+
class DefaultCredentialProvider {
|
242
|
+
constructor() {
|
243
|
+
this.providers = [
|
244
|
+
new EnvironmentVariableCredential(),
|
245
|
+
new ProfileCredential(),
|
246
|
+
new cvm_role_credential_1.default(),
|
247
|
+
new OIDCRoleArnCredential()
|
248
|
+
];
|
249
|
+
}
|
250
|
+
async getCredential() {
|
251
|
+
for (const provider of this.providers) {
|
252
|
+
try {
|
253
|
+
const credential = await provider.getCredential();
|
254
|
+
if (credential.secretId && credential.secretKey) {
|
255
|
+
return credential;
|
256
|
+
}
|
257
|
+
}
|
258
|
+
catch (error) {
|
259
|
+
// Continue to next provider if current one fails
|
260
|
+
console.error(error);
|
261
|
+
continue;
|
262
|
+
}
|
263
|
+
}
|
264
|
+
return new BasicCredential('', '');
|
265
|
+
}
|
266
|
+
}
|
267
|
+
exports.DefaultCredentialProvider = DefaultCredentialProvider;
|
@@ -1,10 +1,5 @@
|
|
1
|
-
import { Credential, DynamicCredential } from "./interface";
|
2
|
-
interface CvmRoleCredentialResult {
|
3
|
-
TmpSecretId: string;
|
4
|
-
TmpSecretKey: string;
|
5
|
-
ExpiredTime: 1671330188;
|
6
|
-
Expiration: string;
|
7
|
-
Token: string;
|
1
|
+
import { Credential, DynamicCredential, CredentialResult } from "./interface";
|
2
|
+
interface CvmRoleCredentialResult extends CredentialResult {
|
8
3
|
Code: string;
|
9
4
|
}
|
10
5
|
/**
|
@@ -113,3 +113,10 @@ export interface Credential {
|
|
113
113
|
export interface DynamicCredential {
|
114
114
|
getCredential(): Promise<Credential>;
|
115
115
|
}
|
116
|
+
export interface CredentialResult {
|
117
|
+
TmpSecretId: string;
|
118
|
+
TmpSecretKey: string;
|
119
|
+
ExpiredTime: number;
|
120
|
+
Expiration: string;
|
121
|
+
Token: string;
|
122
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export declare const sdkVersion = "4.1.
|
1
|
+
export declare const sdkVersion = "4.1.121";
|
@@ -14,12 +14,12 @@ export declare class Client extends AbstractClient {
|
|
14
14
|
QueryHunyuanTo3DJob(req: QueryHunyuanTo3DJobRequest, cb?: (error: string, rep: QueryHunyuanTo3DJobResponse) => void): Promise<QueryHunyuanTo3DJobResponse>;
|
15
15
|
/**
|
16
16
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
17
|
-
默认提供
|
17
|
+
默认提供3个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
18
18
|
*/
|
19
19
|
SubmitHunyuanTo3DProJob(req: SubmitHunyuanTo3DProJobRequest, cb?: (error: string, rep: SubmitHunyuanTo3DProJobResponse) => void): Promise<SubmitHunyuanTo3DProJobResponse>;
|
20
20
|
/**
|
21
21
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
22
|
-
默认提供
|
22
|
+
默认提供1个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
23
23
|
*/
|
24
24
|
QueryHunyuanTo3DRapidJob(req: QueryHunyuanTo3DRapidJobRequest, cb?: (error: string, rep: QueryHunyuanTo3DRapidJobResponse) => void): Promise<QueryHunyuanTo3DRapidJobResponse>;
|
25
25
|
/**
|
@@ -29,12 +29,12 @@ export declare class Client extends AbstractClient {
|
|
29
29
|
SubmitHunyuanTo3DJob(req: SubmitHunyuanTo3DJobRequest, cb?: (error: string, rep: SubmitHunyuanTo3DJobResponse) => void): Promise<SubmitHunyuanTo3DJobResponse>;
|
30
30
|
/**
|
31
31
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
32
|
-
默认提供
|
32
|
+
默认提供3个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
33
33
|
*/
|
34
34
|
QueryHunyuanTo3DProJob(req: QueryHunyuanTo3DProJobRequest, cb?: (error: string, rep: QueryHunyuanTo3DProJobResponse) => void): Promise<QueryHunyuanTo3DProJobResponse>;
|
35
35
|
/**
|
36
36
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
37
|
-
默认提供
|
37
|
+
默认提供1个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
38
38
|
*/
|
39
39
|
SubmitHunyuanTo3DRapidJob(req: SubmitHunyuanTo3DRapidJobRequest, cb?: (error: string, rep: SubmitHunyuanTo3DRapidJobResponse) => void): Promise<SubmitHunyuanTo3DRapidJobResponse>;
|
40
40
|
}
|
@@ -36,14 +36,14 @@ class Client extends abstract_client_1.AbstractClient {
|
|
36
36
|
}
|
37
37
|
/**
|
38
38
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
39
|
-
默认提供
|
39
|
+
默认提供3个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
40
40
|
*/
|
41
41
|
async SubmitHunyuanTo3DProJob(req, cb) {
|
42
42
|
return this.request("SubmitHunyuanTo3DProJob", req, cb);
|
43
43
|
}
|
44
44
|
/**
|
45
45
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
46
|
-
默认提供
|
46
|
+
默认提供1个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
47
47
|
*/
|
48
48
|
async QueryHunyuanTo3DRapidJob(req, cb) {
|
49
49
|
return this.request("QueryHunyuanTo3DRapidJob", req, cb);
|
@@ -57,14 +57,14 @@ class Client extends abstract_client_1.AbstractClient {
|
|
57
57
|
}
|
58
58
|
/**
|
59
59
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
60
|
-
默认提供
|
60
|
+
默认提供3个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
61
61
|
*/
|
62
62
|
async QueryHunyuanTo3DProJob(req, cb) {
|
63
63
|
return this.request("QueryHunyuanTo3DProJob", req, cb);
|
64
64
|
}
|
65
65
|
/**
|
66
66
|
* 混元生3D接口,基于混元大模型,根据输入的文本描述/图片智能生成3D。
|
67
|
-
默认提供
|
67
|
+
默认提供1个并发,代表最多能同时处理1个已提交的任务,上一个任务处理完毕后,才能开始处理下一个任务。
|
68
68
|
*/
|
69
69
|
async SubmitHunyuanTo3DRapidJob(req, cb) {
|
70
70
|
return this.request("SubmitHunyuanTo3DRapidJob", req, cb);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { AbstractClient } from "../../../common/abstract_client";
|
2
2
|
import { ClientConfig } from "../../../common/interface";
|
3
|
-
import { ModifyApmInstanceRequest, CreateApmInstanceRequest, ModifyGeneralApmApplicationConfigRequest, DescribeServiceOverviewResponse, TerminateApmInstanceRequest, DescribeApmInstancesResponse, DescribeTagValuesResponse, DescribeServiceOverviewRequest, DescribeApmAgentResponse, DescribeTagValuesRequest, DescribeGeneralSpanListResponse, CreateProfileTaskResponse, DescribeGeneralSpanListRequest, DescribeMetricRecordsResponse, DescribeGeneralOTSpanListResponse, DescribeGeneralOTSpanListRequest, DescribeApmAgentRequest, DescribeMetricRecordsRequest, DescribeGeneralApmApplicationConfigResponse, DescribeGeneralMetricDataRequest, CreateApmInstanceResponse, CreateProfileTaskRequest, DescribeGeneralApmApplicationConfigRequest, ModifyApmInstanceResponse, DescribeApmInstancesRequest, DescribeGeneralMetricDataResponse, ModifyGeneralApmApplicationConfigResponse, TerminateApmInstanceResponse } from "./apm_models";
|
3
|
+
import { ModifyApmInstanceRequest, CreateApmInstanceRequest, ModifyGeneralApmApplicationConfigRequest, DescribeApmServiceMetricRequest, DescribeServiceOverviewResponse, TerminateApmInstanceRequest, DescribeApmInstancesResponse, DescribeTagValuesResponse, DescribeServiceOverviewRequest, DescribeApmAgentResponse, DescribeTagValuesRequest, DescribeGeneralSpanListResponse, CreateProfileTaskResponse, DescribeGeneralSpanListRequest, DescribeApmServiceMetricResponse, DescribeMetricRecordsResponse, DescribeGeneralOTSpanListResponse, DescribeGeneralOTSpanListRequest, DescribeApmAgentRequest, DescribeMetricRecordsRequest, DescribeGeneralApmApplicationConfigResponse, DescribeGeneralMetricDataRequest, CreateApmInstanceResponse, CreateProfileTaskRequest, DescribeGeneralApmApplicationConfigRequest, ModifyApmInstanceResponse, DescribeApmInstancesRequest, DescribeGeneralMetricDataResponse, ModifyGeneralApmApplicationConfigResponse, TerminateApmInstanceResponse } from "./apm_models";
|
4
4
|
/**
|
5
5
|
* apm client
|
6
6
|
* @class
|
@@ -60,6 +60,10 @@ export declare class Client extends AbstractClient {
|
|
60
60
|
* 业务购买 APM 业务系统,调用该接口创建
|
61
61
|
*/
|
62
62
|
CreateApmInstance(req: CreateApmInstanceRequest, cb?: (error: string, rep: CreateApmInstanceResponse) => void): Promise<CreateApmInstanceResponse>;
|
63
|
+
/**
|
64
|
+
* 获取 APM 应用指标列表
|
65
|
+
*/
|
66
|
+
DescribeApmServiceMetric(req: DescribeApmServiceMetricRequest, cb?: (error: string, rep: DescribeApmServiceMetricResponse) => void): Promise<DescribeApmServiceMetricResponse>;
|
63
67
|
/**
|
64
68
|
* 应用概览数据拉取
|
65
69
|
*/
|
@@ -106,6 +106,12 @@ class Client extends abstract_client_1.AbstractClient {
|
|
106
106
|
async CreateApmInstance(req, cb) {
|
107
107
|
return this.request("CreateApmInstance", req, cb);
|
108
108
|
}
|
109
|
+
/**
|
110
|
+
* 获取 APM 应用指标列表
|
111
|
+
*/
|
112
|
+
async DescribeApmServiceMetric(req, cb) {
|
113
|
+
return this.request("DescribeApmServiceMetric", req, cb);
|
114
|
+
}
|
109
115
|
/**
|
110
116
|
* 应用概览数据拉取
|
111
117
|
*/
|