@geek-fun/serverlessinsight 0.8.1 → 0.8.3
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/.serverlessinsight/state-cdn-flow-app-cdn-flow-service.json.backup +14 -0
- package/.serverlessinsight/state-iam-test-app-iam-test-service.json.backup +14 -0
- package/.serverlessinsight/state-insight-poc-deploy-app-insight-poc-deploy.json.backup +348 -0
- package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +14 -0
- package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +114 -0
- package/.serverlessinsight/state-insight-volc-destroy-app-insight-volc-destroy.json.backup +1 -0
- package/README.md +26 -18
- package/README.zh-CN.md +19 -6
- package/dist/package.json +3 -1
- package/dist/src/commands/deploy.js +87 -4
- package/dist/src/commands/destroy.js +61 -10
- package/dist/src/commands/forceUnlock.js +8 -0
- package/dist/src/commands/index.js +34 -2
- package/dist/src/commands/login.js +195 -0
- package/dist/src/commands/logout.js +17 -0
- package/dist/src/commands/show.js +15 -7
- package/dist/src/commands/whoami.js +20 -0
- package/dist/src/common/aliyunClient/apigwOperations.js +332 -32
- package/dist/src/common/aliyunClient/esOperations.js +43 -29
- package/dist/src/common/aliyunClient/fc3Operations.js +481 -207
- package/dist/src/common/aliyunClient/ossOperations.js +165 -13
- package/dist/src/common/aliyunClient/rdsOperations.js +143 -39
- package/dist/src/common/aliyunClient/slsOperations.js +56 -26
- package/dist/src/common/aliyunClient/tablestoreOperations.js +25 -22
- package/dist/src/common/apiClient.js +102 -0
- package/dist/src/common/constants.js +9 -4
- package/dist/src/common/credentialStore.js +94 -0
- package/dist/src/common/credentials.js +2 -0
- package/dist/src/common/eventQueue.js +208 -0
- package/dist/src/common/hashUtils.js +87 -11
- package/dist/src/common/imsClient.js +1 -0
- package/dist/src/common/index.js +3 -0
- package/dist/src/common/lockManager.js +61 -54
- package/dist/src/common/logger.js +2 -0
- package/dist/src/common/polling.js +54 -0
- package/dist/src/common/reportResourceEvent.js +8 -0
- package/dist/src/common/runtimeMapper.js +11 -12
- package/dist/src/common/stateBackend/index.js +10 -1
- package/dist/src/common/stateBackend/localStateBackend.js +4 -1
- package/dist/src/common/stateBackend/remoteStateBackend.js +6 -3
- package/dist/src/common/stateBackend/saasStateBackend.js +266 -0
- package/dist/src/common/stateManager.js +135 -13
- package/dist/src/common/tencentClient/cosOperations.js +180 -3
- package/dist/src/common/tencentClient/esOperations.js +110 -46
- package/dist/src/common/tencentClient/index.js +22 -1
- package/dist/src/common/tencentClient/scfOperations.js +255 -133
- package/dist/src/common/tencentClient/tdsqlcClusterMapper.js +81 -0
- package/dist/src/common/tencentClient/tdsqlcOperations.js +93 -99
- package/dist/src/common/triggerMapper.js +36 -0
- package/dist/src/common/volcengineClient/apigwOperations.js +539 -159
- package/dist/src/common/volcengineClient/iamOperations.js +58 -48
- package/dist/src/common/volcengineClient/index.js +46 -21
- package/dist/src/common/volcengineClient/stsOperations.js +32 -0
- package/dist/src/common/volcengineClient/tlsOperations.js +229 -178
- package/dist/src/common/volcengineClient/tosOperations.js +78 -19
- package/dist/src/common/volcengineClient/vefaasOperations.js +272 -54
- package/dist/src/lang/en.js +84 -0
- package/dist/src/lang/zh-CN.js +84 -0
- package/dist/src/parser/eventParser.js +2 -0
- package/dist/src/parser/functionParser.js +96 -65
- package/dist/src/parser/index.js +7 -4
- package/dist/src/stack/aliyunStack/apigwExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/apigwPlanner.js +14 -10
- package/dist/src/stack/aliyunStack/apigwResource.js +230 -125
- package/dist/src/stack/aliyunStack/apigwTypes.js +16 -3
- package/dist/src/stack/aliyunStack/databaseExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/databasePlanner.js +13 -1
- package/dist/src/stack/aliyunStack/databaseResource.js +135 -40
- package/dist/src/stack/aliyunStack/deployer.js +2 -2
- package/dist/src/stack/aliyunStack/destroyer.js +2 -2
- package/dist/src/stack/aliyunStack/fc3Executor.js +25 -2
- package/dist/src/stack/aliyunStack/fc3Planner.js +11 -1
- package/dist/src/stack/aliyunStack/fc3Resource.js +327 -64
- package/dist/src/stack/aliyunStack/ossExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/ossPlanner.js +15 -1
- package/dist/src/stack/aliyunStack/ossResource.js +267 -219
- package/dist/src/stack/aliyunStack/tablestoreExecutor.js +39 -1
- package/dist/src/stack/aliyunStack/tablestorePlanner.js +13 -1
- package/dist/src/stack/aliyunStack/tablestoreResource.js +54 -20
- package/dist/src/stack/alreadyExists.js +26 -0
- package/dist/src/stack/ownershipTag.js +40 -0
- package/dist/src/stack/rfsStack/index.js +3 -1
- package/dist/src/stack/scfStack/cosExecutor.js +39 -1
- package/dist/src/stack/scfStack/cosPlanner.js +11 -1
- package/dist/src/stack/scfStack/cosResource.js +167 -64
- package/dist/src/stack/scfStack/deployer.js +2 -2
- package/dist/src/stack/scfStack/destroyer.js +2 -2
- package/dist/src/stack/scfStack/esServerlessExecutor.js +39 -1
- package/dist/src/stack/scfStack/esServerlessPlanner.js +11 -1
- package/dist/src/stack/scfStack/esServerlessResource.js +88 -23
- package/dist/src/stack/scfStack/scfExecutor.js +39 -1
- package/dist/src/stack/scfStack/scfPlanner.js +12 -2
- package/dist/src/stack/scfStack/scfResource.js +484 -14
- package/dist/src/stack/scfStack/tdsqlcExecutor.js +39 -1
- package/dist/src/stack/scfStack/tdsqlcPlanner.js +12 -1
- package/dist/src/stack/scfStack/tdsqlcResource.js +95 -16
- package/dist/src/stack/scfStack/tdsqlcTypes.js +5 -1
- package/dist/src/stack/volcengineStack/apigwExecutor.js +39 -1
- package/dist/src/stack/volcengineStack/apigwPlanner.js +25 -53
- package/dist/src/stack/volcengineStack/apigwResource.js +418 -222
- package/dist/src/stack/volcengineStack/apigwTypes.js +76 -66
- package/dist/src/stack/volcengineStack/deployer.js +49 -14
- package/dist/src/stack/volcengineStack/destroyer.js +1 -1
- package/dist/src/stack/volcengineStack/index.js +1 -2
- package/dist/src/stack/volcengineStack/tosExecutor.js +25 -2
- package/dist/src/stack/volcengineStack/tosPlanner.js +11 -1
- package/dist/src/stack/volcengineStack/tosResource.js +82 -27
- package/dist/src/stack/volcengineStack/tosTypes.js +12 -0
- package/dist/src/stack/volcengineStack/vefaasExecutor.js +25 -2
- package/dist/src/stack/volcengineStack/vefaasPlanner.js +71 -2
- package/dist/src/stack/volcengineStack/vefaasResource.js +148 -98
- package/dist/src/stack/volcengineStack/vefaasTypes.js +1 -3
- package/dist/src/types/domains/backend.js +1 -0
- package/dist/src/types/domains/state.js +29 -1
- package/dist/src/validator/eventSchema.js +10 -0
- package/dist/src/validator/functionSchema.js +37 -12
- package/dist/src/validator/iacSchema.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -1
|
@@ -4,7 +4,7 @@ exports.createIamOperations = void 0;
|
|
|
4
4
|
const iamStatements_1 = require("../iamStatements");
|
|
5
5
|
const logger_1 = require("../logger");
|
|
6
6
|
const lang_1 = require("../../lang");
|
|
7
|
-
const DEFAULT_TRUST_POLICY_SERVICES = ['vefaas
|
|
7
|
+
const DEFAULT_TRUST_POLICY_SERVICES = ['vefaas'];
|
|
8
8
|
const buildTrustPolicyDocument = (trustedServices) => {
|
|
9
9
|
return JSON.stringify({
|
|
10
10
|
Statement: [
|
|
@@ -64,10 +64,10 @@ const createIamOperations = (iamClient) => {
|
|
|
64
64
|
try {
|
|
65
65
|
await iamClient.fetchOpenAPI({
|
|
66
66
|
Action: 'CreatePolicy',
|
|
67
|
-
Version: '
|
|
68
|
-
method: '
|
|
67
|
+
Version: '2018-01-01',
|
|
68
|
+
method: 'GET',
|
|
69
69
|
headers: { 'content-type': 'application/json' },
|
|
70
|
-
|
|
70
|
+
query: {
|
|
71
71
|
PolicyName: policyName,
|
|
72
72
|
PolicyDocument: buildExecutionPolicy(customStatements),
|
|
73
73
|
Description: `veFaaS execution policy for ${roleName}`,
|
|
@@ -76,7 +76,12 @@ const createIamOperations = (iamClient) => {
|
|
|
76
76
|
}
|
|
77
77
|
catch (error) {
|
|
78
78
|
if (error && typeof error === 'object' && 'code' in error) {
|
|
79
|
-
|
|
79
|
+
const code = String(error.code);
|
|
80
|
+
// volcengine uses the singular PolicyAlreadyExist (observed live)
|
|
81
|
+
if (code === 'PolicyAlreadyExists' ||
|
|
82
|
+
code === 'PolicyAlreadyExist' ||
|
|
83
|
+
code === 'Conflict' ||
|
|
84
|
+
code.startsWith('PolicyAlready')) {
|
|
80
85
|
logger_1.logger.info(lang_1.lang.__('IAM_POLICY_ALREADY_EXISTS', { policyName }));
|
|
81
86
|
}
|
|
82
87
|
else {
|
|
@@ -90,10 +95,10 @@ const createIamOperations = (iamClient) => {
|
|
|
90
95
|
try {
|
|
91
96
|
await iamClient.fetchOpenAPI({
|
|
92
97
|
Action: 'AttachRolePolicy',
|
|
93
|
-
Version: '
|
|
94
|
-
method: '
|
|
98
|
+
Version: '2018-01-01',
|
|
99
|
+
method: 'GET',
|
|
95
100
|
headers: { 'content-type': 'application/json' },
|
|
96
|
-
|
|
101
|
+
query: {
|
|
97
102
|
RoleName: roleName,
|
|
98
103
|
PolicyName: policyName,
|
|
99
104
|
PolicyType: 'Custom',
|
|
@@ -102,7 +107,12 @@ const createIamOperations = (iamClient) => {
|
|
|
102
107
|
}
|
|
103
108
|
catch (error) {
|
|
104
109
|
if (error && typeof error === 'object' && 'code' in error) {
|
|
105
|
-
|
|
110
|
+
const code = String(error.code);
|
|
111
|
+
// volcengine reports PolicyAttachConflict when the policy is already attached
|
|
112
|
+
if (code === 'PolicyAlreadyAttached' ||
|
|
113
|
+
code === 'PolicyAttachConflict' ||
|
|
114
|
+
code === 'Conflict' ||
|
|
115
|
+
code.startsWith('PolicyAttach')) {
|
|
106
116
|
logger_1.logger.info(lang_1.lang.__('IAM_POLICY_ALREADY_ATTACHED', { policyName, roleName }));
|
|
107
117
|
}
|
|
108
118
|
else {
|
|
@@ -120,10 +130,10 @@ const createIamOperations = (iamClient) => {
|
|
|
120
130
|
try {
|
|
121
131
|
await iamClient.fetchOpenAPI({
|
|
122
132
|
Action: 'DetachRolePolicy',
|
|
123
|
-
Version: '
|
|
124
|
-
method: '
|
|
133
|
+
Version: '2018-01-01',
|
|
134
|
+
method: 'GET',
|
|
125
135
|
headers: { 'content-type': 'application/json' },
|
|
126
|
-
|
|
136
|
+
query: {
|
|
127
137
|
RoleName: roleName,
|
|
128
138
|
PolicyName: policyName,
|
|
129
139
|
PolicyType: 'Custom',
|
|
@@ -136,10 +146,10 @@ const createIamOperations = (iamClient) => {
|
|
|
136
146
|
try {
|
|
137
147
|
await iamClient.fetchOpenAPI({
|
|
138
148
|
Action: 'DeletePolicy',
|
|
139
|
-
Version: '
|
|
140
|
-
method: '
|
|
149
|
+
Version: '2018-01-01',
|
|
150
|
+
method: 'GET',
|
|
141
151
|
headers: { 'content-type': 'application/json' },
|
|
142
|
-
|
|
152
|
+
query: {
|
|
143
153
|
PolicyName: policyName,
|
|
144
154
|
PolicyType: 'Custom',
|
|
145
155
|
},
|
|
@@ -153,10 +163,10 @@ const createIamOperations = (iamClient) => {
|
|
|
153
163
|
try {
|
|
154
164
|
await iamClient.fetchOpenAPI({
|
|
155
165
|
Action: 'AttachRolePolicy',
|
|
156
|
-
Version: '
|
|
157
|
-
method: '
|
|
166
|
+
Version: '2018-01-01',
|
|
167
|
+
method: 'GET',
|
|
158
168
|
headers: { 'content-type': 'application/json' },
|
|
159
|
-
|
|
169
|
+
query: {
|
|
160
170
|
RoleName: roleName,
|
|
161
171
|
PolicyName: policyName,
|
|
162
172
|
PolicyType: policyType,
|
|
@@ -178,10 +188,10 @@ const createIamOperations = (iamClient) => {
|
|
|
178
188
|
try {
|
|
179
189
|
await iamClient.fetchOpenAPI({
|
|
180
190
|
Action: 'DetachRolePolicy',
|
|
181
|
-
Version: '
|
|
182
|
-
method: '
|
|
191
|
+
Version: '2018-01-01',
|
|
192
|
+
method: 'GET',
|
|
183
193
|
headers: { 'content-type': 'application/json' },
|
|
184
|
-
|
|
194
|
+
query: {
|
|
185
195
|
RoleName: roleName,
|
|
186
196
|
PolicyName: policyName,
|
|
187
197
|
PolicyType: policyType,
|
|
@@ -203,13 +213,13 @@ const createIamOperations = (iamClient) => {
|
|
|
203
213
|
try {
|
|
204
214
|
const response = await iamClient.fetchOpenAPI({
|
|
205
215
|
Action: 'ListAttachedRolePolicies',
|
|
206
|
-
Version: '
|
|
207
|
-
method: '
|
|
216
|
+
Version: '2018-01-01',
|
|
217
|
+
method: 'GET',
|
|
208
218
|
headers: { 'content-type': 'application/json' },
|
|
209
|
-
|
|
219
|
+
query: { RoleName: roleName },
|
|
210
220
|
});
|
|
211
221
|
const result = (response.Result || {});
|
|
212
|
-
const attachedPolicies = result.
|
|
222
|
+
const attachedPolicies = result.AttachedPolicyMetadata;
|
|
213
223
|
if (!attachedPolicies) {
|
|
214
224
|
return [];
|
|
215
225
|
}
|
|
@@ -228,10 +238,10 @@ const createIamOperations = (iamClient) => {
|
|
|
228
238
|
try {
|
|
229
239
|
const response = await iamClient.fetchOpenAPI({
|
|
230
240
|
Action: 'CreateRole',
|
|
231
|
-
Version: '
|
|
232
|
-
method: '
|
|
241
|
+
Version: '2018-01-01',
|
|
242
|
+
method: 'GET',
|
|
233
243
|
headers: { 'content-type': 'application/json' },
|
|
234
|
-
|
|
244
|
+
query: {
|
|
235
245
|
RoleName: roleName,
|
|
236
246
|
TrustPolicyDocument: trustPolicyDocument,
|
|
237
247
|
DisplayName: config.displayName,
|
|
@@ -251,7 +261,7 @@ const createIamOperations = (iamClient) => {
|
|
|
251
261
|
return {
|
|
252
262
|
roleName: roleData.RoleName,
|
|
253
263
|
roleId: roleData.RoleId,
|
|
254
|
-
trn: roleData.TRN,
|
|
264
|
+
trn: (roleData.TRN ?? roleData.trn ?? roleData.Trn),
|
|
255
265
|
description: roleData.Description,
|
|
256
266
|
createdTime: roleData.CreateTime,
|
|
257
267
|
maxSessionDuration: roleData.MaxSessionDuration,
|
|
@@ -267,17 +277,17 @@ const createIamOperations = (iamClient) => {
|
|
|
267
277
|
try {
|
|
268
278
|
const existingRole = await iamClient.fetchOpenAPI({
|
|
269
279
|
Action: 'GetRole',
|
|
270
|
-
Version: '
|
|
271
|
-
method: '
|
|
280
|
+
Version: '2018-01-01',
|
|
281
|
+
method: 'GET',
|
|
272
282
|
headers: { 'content-type': 'application/json' },
|
|
273
|
-
|
|
283
|
+
query: { RoleName: roleName },
|
|
274
284
|
});
|
|
275
285
|
await iamClient.fetchOpenAPI({
|
|
276
|
-
Action: '
|
|
277
|
-
Version: '
|
|
278
|
-
method: '
|
|
286
|
+
Action: 'UpdateRole',
|
|
287
|
+
Version: '2018-01-01',
|
|
288
|
+
method: 'GET',
|
|
279
289
|
headers: { 'content-type': 'application/json' },
|
|
280
|
-
|
|
290
|
+
query: {
|
|
281
291
|
RoleName: roleName,
|
|
282
292
|
TrustPolicyDocument: trustPolicyDocument,
|
|
283
293
|
},
|
|
@@ -293,7 +303,7 @@ const createIamOperations = (iamClient) => {
|
|
|
293
303
|
return {
|
|
294
304
|
roleName: roleData?.RoleName,
|
|
295
305
|
roleId: roleData?.RoleId,
|
|
296
|
-
trn: roleData?.TRN,
|
|
306
|
+
trn: (roleData?.TRN ?? roleData?.trn ?? roleData?.Trn),
|
|
297
307
|
description: roleData?.Description,
|
|
298
308
|
createdTime: roleData?.CreateTime,
|
|
299
309
|
maxSessionDuration: roleData?.MaxSessionDuration,
|
|
@@ -318,10 +328,10 @@ const createIamOperations = (iamClient) => {
|
|
|
318
328
|
try {
|
|
319
329
|
const response = await iamClient.fetchOpenAPI({
|
|
320
330
|
Action: 'GetRole',
|
|
321
|
-
Version: '
|
|
322
|
-
method: '
|
|
331
|
+
Version: '2018-01-01',
|
|
332
|
+
method: 'GET',
|
|
323
333
|
headers: { 'content-type': 'application/json' },
|
|
324
|
-
|
|
334
|
+
query: { RoleName: roleName },
|
|
325
335
|
});
|
|
326
336
|
const roleData = (response.Result || {}).Role;
|
|
327
337
|
if (!roleData) {
|
|
@@ -330,7 +340,7 @@ const createIamOperations = (iamClient) => {
|
|
|
330
340
|
return {
|
|
331
341
|
roleName: roleData.RoleName,
|
|
332
342
|
roleId: roleData.RoleId,
|
|
333
|
-
trn: roleData.TRN,
|
|
343
|
+
trn: (roleData.TRN ?? roleData.trn ?? roleData.Trn),
|
|
334
344
|
description: roleData.Description,
|
|
335
345
|
createdTime: roleData.CreateTime,
|
|
336
346
|
maxSessionDuration: roleData.MaxSessionDuration,
|
|
@@ -351,11 +361,11 @@ const createIamOperations = (iamClient) => {
|
|
|
351
361
|
const trustPolicyDocument = JSON.stringify(trustPolicy);
|
|
352
362
|
try {
|
|
353
363
|
await iamClient.fetchOpenAPI({
|
|
354
|
-
Action: '
|
|
355
|
-
Version: '
|
|
356
|
-
method: '
|
|
364
|
+
Action: 'UpdateRole',
|
|
365
|
+
Version: '2018-01-01',
|
|
366
|
+
method: 'GET',
|
|
357
367
|
headers: { 'content-type': 'application/json' },
|
|
358
|
-
|
|
368
|
+
query: {
|
|
359
369
|
RoleName: roleName,
|
|
360
370
|
TrustPolicyDocument: trustPolicyDocument,
|
|
361
371
|
},
|
|
@@ -382,10 +392,10 @@ const createIamOperations = (iamClient) => {
|
|
|
382
392
|
try {
|
|
383
393
|
await iamClient.fetchOpenAPI({
|
|
384
394
|
Action: 'DeleteRole',
|
|
385
|
-
Version: '
|
|
386
|
-
method: '
|
|
395
|
+
Version: '2018-01-01',
|
|
396
|
+
method: 'GET',
|
|
387
397
|
headers: { 'content-type': 'application/json' },
|
|
388
|
-
|
|
398
|
+
query: { RoleName: roleName },
|
|
389
399
|
});
|
|
390
400
|
logger_1.logger.info(lang_1.lang.__('IAM_ROLE_DELETED', { roleName }));
|
|
391
401
|
}
|
|
@@ -16,10 +16,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.createVolcengineClient = void 0;
|
|
18
18
|
const openapi_1 = require("@volcengine/openapi");
|
|
19
|
+
const tls_1 = require("@volcengine/openapi/lib/services/tls");
|
|
19
20
|
const vefaasOperations_1 = require("./vefaasOperations");
|
|
20
21
|
const tosOperations_1 = require("./tosOperations");
|
|
21
22
|
const iamOperations_1 = require("./iamOperations");
|
|
22
23
|
const apigwOperations_1 = require("./apigwOperations");
|
|
24
|
+
const stsOperations_1 = require("./stsOperations");
|
|
23
25
|
const tlsOperations_1 = require("./tlsOperations");
|
|
24
26
|
__exportStar(require("./types"), exports);
|
|
25
27
|
__exportStar(require("./vefaasOperations"), exports);
|
|
@@ -27,63 +29,85 @@ __exportStar(require("./tosOperations"), exports);
|
|
|
27
29
|
__exportStar(require("./iamOperations"), exports);
|
|
28
30
|
__exportStar(require("./apigwOperations"), exports);
|
|
29
31
|
__exportStar(require("./tlsOperations"), exports);
|
|
32
|
+
/**
|
|
33
|
+
* fetchOpenAPI resolves with { ResponseMetadata: { Error } } on API errors
|
|
34
|
+
* (validateStatus: null) — rethrow with .code so callers' error.code checks work.
|
|
35
|
+
*/
|
|
36
|
+
const wrapService = (service) => {
|
|
37
|
+
const fetchOpenAPI = service.fetchOpenAPI.bind(service);
|
|
38
|
+
service.fetchOpenAPI = async (params, options) => {
|
|
39
|
+
const response = await fetchOpenAPI(params, options);
|
|
40
|
+
const apiError = response?.ResponseMetadata?.Error;
|
|
41
|
+
if (apiError?.Code) {
|
|
42
|
+
const requestId = response?.ResponseMetadata?.RequestId;
|
|
43
|
+
const action = params.Action || '';
|
|
44
|
+
const error = new Error(`Volcengine ${action} failed: ${apiError.Code}: ${apiError.Message ?? ''}` +
|
|
45
|
+
(requestId ? ` (RequestId: ${requestId})` : ''));
|
|
46
|
+
error.code = apiError.Code;
|
|
47
|
+
error.requestId = requestId;
|
|
48
|
+
error.action = action;
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
return response;
|
|
52
|
+
};
|
|
53
|
+
return service;
|
|
54
|
+
};
|
|
30
55
|
const initializeSdkClients = (context) => {
|
|
31
|
-
const vefaasService = new openapi_1.Service({
|
|
56
|
+
const vefaasService = wrapService(new openapi_1.Service({
|
|
32
57
|
serviceName: 'vefaas',
|
|
33
58
|
defaultVersion: '2024-06-06',
|
|
34
|
-
protocol: 'https',
|
|
35
|
-
host: 'vefaas.volcengineapi.com',
|
|
36
59
|
accessKeyId: context.accessKeyId,
|
|
37
60
|
secretKey: context.accessKeySecret,
|
|
38
61
|
region: context.region,
|
|
39
62
|
...(context.securityToken && { sessionToken: context.securityToken }),
|
|
40
|
-
});
|
|
41
|
-
const tosService = new openapi_1.Service({
|
|
63
|
+
}));
|
|
64
|
+
const tosService = wrapService(new openapi_1.Service({
|
|
42
65
|
serviceName: 'tos',
|
|
43
66
|
defaultVersion: '2018-08-01',
|
|
44
|
-
protocol: 'https',
|
|
45
67
|
host: `tos-${context.region}.volces.com`,
|
|
46
68
|
accessKeyId: context.accessKeyId,
|
|
47
69
|
secretKey: context.accessKeySecret,
|
|
48
70
|
region: context.region,
|
|
49
71
|
...(context.securityToken && { sessionToken: context.securityToken }),
|
|
50
|
-
});
|
|
51
|
-
const iamService = new openapi_1.Service({
|
|
72
|
+
}));
|
|
73
|
+
const iamService = wrapService(new openapi_1.Service({
|
|
52
74
|
serviceName: 'iam',
|
|
53
75
|
defaultVersion: '2024-01-01',
|
|
54
|
-
protocol: 'https',
|
|
55
|
-
host: 'iam.volcengineapi.com',
|
|
56
76
|
accessKeyId: context.accessKeyId,
|
|
57
77
|
secretKey: context.accessKeySecret,
|
|
58
78
|
region: context.region,
|
|
59
79
|
...(context.securityToken && { sessionToken: context.securityToken }),
|
|
60
|
-
});
|
|
61
|
-
const tlsService = new
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
protocol: 'https',
|
|
65
|
-
host: `tls.${context.region}.volces.com`,
|
|
80
|
+
}));
|
|
81
|
+
const tlsService = new tls_1.TlsService({
|
|
82
|
+
region: context.region,
|
|
83
|
+
host: `tls-${context.region}.volces.com`,
|
|
66
84
|
accessKeyId: context.accessKeyId,
|
|
67
85
|
secretKey: context.accessKeySecret,
|
|
68
|
-
region: context.region,
|
|
69
86
|
...(context.securityToken && { sessionToken: context.securityToken }),
|
|
70
87
|
});
|
|
71
|
-
const apigwService = new openapi_1.Service({
|
|
88
|
+
const apigwService = wrapService(new openapi_1.Service({
|
|
72
89
|
serviceName: 'apig',
|
|
73
90
|
defaultVersion: '2021-03-03',
|
|
74
|
-
protocol: 'https',
|
|
75
|
-
host: 'apig.volcengineapi.com',
|
|
76
91
|
accessKeyId: context.accessKeyId,
|
|
77
92
|
secretKey: context.accessKeySecret,
|
|
78
93
|
region: context.region,
|
|
79
94
|
...(context.securityToken && { sessionToken: context.securityToken }),
|
|
80
|
-
});
|
|
95
|
+
}));
|
|
96
|
+
const stsService = wrapService(new openapi_1.Service({
|
|
97
|
+
serviceName: 'sts',
|
|
98
|
+
defaultVersion: '2018-01-01',
|
|
99
|
+
accessKeyId: context.accessKeyId,
|
|
100
|
+
secretKey: context.accessKeySecret,
|
|
101
|
+
region: context.region,
|
|
102
|
+
...(context.securityToken && { sessionToken: context.securityToken }),
|
|
103
|
+
}));
|
|
81
104
|
return {
|
|
82
105
|
vefaas: vefaasService,
|
|
83
106
|
tos: tosService,
|
|
84
107
|
iam: iamService,
|
|
85
108
|
tls: tlsService,
|
|
86
109
|
apigw: apigwService,
|
|
110
|
+
sts: stsService,
|
|
87
111
|
};
|
|
88
112
|
};
|
|
89
113
|
const createVolcengineClient = (context) => {
|
|
@@ -94,6 +118,7 @@ const createVolcengineClient = (context) => {
|
|
|
94
118
|
iam: (0, iamOperations_1.createIamOperations)(sdkClients.iam),
|
|
95
119
|
tls: (0, tlsOperations_1.createTlsOperations)(sdkClients.tls),
|
|
96
120
|
apigw: (0, apigwOperations_1.createApigwOperations)(sdkClients.apigw),
|
|
121
|
+
sts: (0, stsOperations_1.createStsOperations)(sdkClients.sts),
|
|
97
122
|
};
|
|
98
123
|
};
|
|
99
124
|
exports.createVolcengineClient = createVolcengineClient;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStsOperations = void 0;
|
|
4
|
+
/* istanbul ignore next */ const createStsOperations = (client) => {
|
|
5
|
+
if (!client) {
|
|
6
|
+
return {
|
|
7
|
+
getAccountId: async () => undefined,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
getAccountId: async () => {
|
|
12
|
+
try {
|
|
13
|
+
const response = await client.fetchOpenAPI({
|
|
14
|
+
Action: 'GetCallerIdentity',
|
|
15
|
+
Version: '2018-01-01',
|
|
16
|
+
method: 'GET',
|
|
17
|
+
query: {},
|
|
18
|
+
});
|
|
19
|
+
const data = (response.Result || {});
|
|
20
|
+
const accountId = data.AccountId;
|
|
21
|
+
if (typeof accountId === 'number') {
|
|
22
|
+
return String(accountId);
|
|
23
|
+
}
|
|
24
|
+
return accountId ?? undefined;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.createStsOperations = createStsOperations;
|