@cloudbase/manager-node 4.4.7 → 4.4.9-beta.0
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/lib/function/index.js
CHANGED
|
@@ -258,20 +258,96 @@ class FunctionService {
|
|
|
258
258
|
});
|
|
259
259
|
return data;
|
|
260
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* 列出所有函数
|
|
263
|
+
* @param {IListFunctionOptions} options
|
|
264
|
+
* @returns {Promise<Record<string, string>[]>}
|
|
265
|
+
*/
|
|
266
|
+
async listAllFunctions(options) {
|
|
267
|
+
const allFunctions = [];
|
|
268
|
+
let currentOffset = 0;
|
|
269
|
+
const pageSize = 20;
|
|
270
|
+
const { envId } = options;
|
|
271
|
+
while (true) {
|
|
272
|
+
try {
|
|
273
|
+
const res = await this.scfService.request('ListFunctions', {
|
|
274
|
+
Namespace: envId,
|
|
275
|
+
Limit: pageSize,
|
|
276
|
+
Offset: currentOffset
|
|
277
|
+
});
|
|
278
|
+
const { Functions = [], TotalCount } = res;
|
|
279
|
+
if (Functions.length === 0) {
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
allFunctions.push(...Functions);
|
|
283
|
+
// 检查是否已获取所有函数
|
|
284
|
+
if (allFunctions.length >= TotalCount || Functions.length < pageSize) {
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
currentOffset += pageSize;
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
throw new error_1.CloudBaseError(`获取函数列表失败: ${error.message}`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// 格式化数据
|
|
294
|
+
const data = [];
|
|
295
|
+
allFunctions.forEach(func => {
|
|
296
|
+
const { FunctionId, FunctionName, Runtime, AddTime, ModTime, Status } = func;
|
|
297
|
+
data.push({
|
|
298
|
+
FunctionId,
|
|
299
|
+
FunctionName,
|
|
300
|
+
Runtime,
|
|
301
|
+
AddTime,
|
|
302
|
+
ModTime,
|
|
303
|
+
Status
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
return data;
|
|
307
|
+
}
|
|
261
308
|
/**
|
|
262
309
|
* 删除云函数
|
|
263
310
|
* @param {string} name 云函数名称
|
|
264
311
|
* @param {string} qualifier 需要删除的版本号,不填默认删除函数下全部版本。
|
|
265
312
|
* @returns {Promise<IResponseInfo>}
|
|
266
313
|
*/
|
|
267
|
-
async deleteFunction(name
|
|
314
|
+
async deleteFunction({ name }) {
|
|
315
|
+
var _a;
|
|
268
316
|
const { namespace } = this.getFunctionConfig();
|
|
269
|
-
|
|
317
|
+
// 检测是否绑定了 API 网关
|
|
318
|
+
const accessService = this.environment.getAccessService();
|
|
319
|
+
const res = await accessService.getAccessList({
|
|
320
|
+
name
|
|
321
|
+
});
|
|
322
|
+
// 删除绑定的 API 网关
|
|
323
|
+
if (((_a = res === null || res === void 0 ? void 0 : res.APISet) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
324
|
+
await accessService.deleteAccess({
|
|
325
|
+
name
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
await this.scfService.request('DeleteFunction', {
|
|
270
329
|
FunctionName: name,
|
|
271
|
-
Namespace: namespace
|
|
272
|
-
Qualifier: qualifier
|
|
330
|
+
Namespace: namespace
|
|
273
331
|
});
|
|
274
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* 批量删除云函数
|
|
335
|
+
* @param {Object} options
|
|
336
|
+
* @param {string[]} options.names 云函数名称列表
|
|
337
|
+
* @returns {Promise<void>}
|
|
338
|
+
*/
|
|
339
|
+
async batchDeleteFunctions({ names }) {
|
|
340
|
+
const promises = names.map(name => (async () => {
|
|
341
|
+
try {
|
|
342
|
+
await this.deleteFunction({ name });
|
|
343
|
+
(0, utils_1.successLog)(`[${name}] 函数删除成功!`);
|
|
344
|
+
}
|
|
345
|
+
catch (e) {
|
|
346
|
+
throw new error_1.CloudBaseError(e.message);
|
|
347
|
+
}
|
|
348
|
+
})());
|
|
349
|
+
await Promise.all(promises);
|
|
350
|
+
}
|
|
275
351
|
/**
|
|
276
352
|
* 获取云函数详细信息
|
|
277
353
|
* @param {string} name 云函数名称
|
|
@@ -306,13 +382,35 @@ class FunctionService {
|
|
|
306
382
|
}
|
|
307
383
|
catch (e) {
|
|
308
384
|
data.VpcConfig = {
|
|
309
|
-
vpc: '',
|
|
310
|
-
subnet: ''
|
|
385
|
+
vpc: 'VpcId',
|
|
386
|
+
subnet: 'SubnetId'
|
|
311
387
|
};
|
|
312
388
|
}
|
|
313
389
|
}
|
|
314
390
|
return data;
|
|
315
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* 批量获取云函数详细信息
|
|
394
|
+
* @param {Object} options
|
|
395
|
+
* @param {string[]} options.names 云函数名称列表
|
|
396
|
+
* @param {string} options.envId 环境 ID
|
|
397
|
+
* @param {string} options.codeSecret
|
|
398
|
+
* @returns {Promise<IFunctionInfo[]>}
|
|
399
|
+
*/
|
|
400
|
+
async batchGetFunctionsDetail({ names, envId, codeSecret }) {
|
|
401
|
+
const data = [];
|
|
402
|
+
const promises = names.map(name => (async () => {
|
|
403
|
+
try {
|
|
404
|
+
const info = await this.getFunctionDetail(name, codeSecret);
|
|
405
|
+
data.push(info);
|
|
406
|
+
}
|
|
407
|
+
catch (e) {
|
|
408
|
+
throw new error_1.CloudBaseError(`${name} 获取信息失败:${e.message}`);
|
|
409
|
+
}
|
|
410
|
+
})());
|
|
411
|
+
await Promise.all(promises);
|
|
412
|
+
return data;
|
|
413
|
+
}
|
|
316
414
|
/**
|
|
317
415
|
* 获取函数日志
|
|
318
416
|
* @deprecated 请使用 getFunctionLogsV2 代替
|
|
@@ -409,6 +507,33 @@ class FunctionService {
|
|
|
409
507
|
const res = await this.tcbService.request('GetFunctionLogDetail', params);
|
|
410
508
|
return res;
|
|
411
509
|
}
|
|
510
|
+
/**
|
|
511
|
+
* 获取函数的完整调用日志
|
|
512
|
+
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
513
|
+
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
514
|
+
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
515
|
+
*/
|
|
516
|
+
async getCompleteFunctionLogs(options) {
|
|
517
|
+
// 调用 getFunctionLogsV2 获取日志请求ID列表
|
|
518
|
+
const { name } = options;
|
|
519
|
+
const logs = await this.getFunctionLogsV2(options);
|
|
520
|
+
// 如果没有日志,直接返回空数组
|
|
521
|
+
if (logs.LogList.length === 0) {
|
|
522
|
+
return [];
|
|
523
|
+
}
|
|
524
|
+
const detailPromises = logs.LogList.map(async (log) => {
|
|
525
|
+
// 对每一个日志ID,调用 getFunctionLogDetail
|
|
526
|
+
const res = await this.getFunctionLogDetail({
|
|
527
|
+
logRequestId: log.RequestId,
|
|
528
|
+
startTime: options.startTime,
|
|
529
|
+
endTime: options.endTime
|
|
530
|
+
});
|
|
531
|
+
return Object.assign(Object.assign({}, res), { RetCode: log.RetCode, FunctionName: name });
|
|
532
|
+
});
|
|
533
|
+
// 并发执行所有详情查询,等待它们全部完成
|
|
534
|
+
const detailedLogs = await Promise.all(detailPromises);
|
|
535
|
+
return detailedLogs;
|
|
536
|
+
}
|
|
412
537
|
/**
|
|
413
538
|
* 更新云函数配置
|
|
414
539
|
* @param {ICloudFunction} func 云函数配置
|
|
@@ -544,6 +669,28 @@ class FunctionService {
|
|
|
544
669
|
throw new error_1.CloudBaseError(`[${name}] 调用失败:\n${e.message}`);
|
|
545
670
|
}
|
|
546
671
|
}
|
|
672
|
+
/**
|
|
673
|
+
* 批量调用云函数
|
|
674
|
+
* @param {IFunctionBatchOptions} options
|
|
675
|
+
* @returns {Promise<IFunctionInvokeRes[]>}
|
|
676
|
+
*/
|
|
677
|
+
async batchInvokeFunctions(options) {
|
|
678
|
+
const { functions, envId, log = false } = options;
|
|
679
|
+
const promises = functions.map(func => (async () => {
|
|
680
|
+
try {
|
|
681
|
+
const result = await this.invokeFunction(func.name, func.params);
|
|
682
|
+
if (log) {
|
|
683
|
+
(0, utils_1.successLog)(`[${func.name}] 调用成功\n响应结果:\n`);
|
|
684
|
+
console.log(result);
|
|
685
|
+
}
|
|
686
|
+
return result;
|
|
687
|
+
}
|
|
688
|
+
catch (e) {
|
|
689
|
+
throw new error_1.CloudBaseError(`${func.name} 函数调用失败:${e.message}`);
|
|
690
|
+
}
|
|
691
|
+
})());
|
|
692
|
+
return Promise.all(promises);
|
|
693
|
+
}
|
|
547
694
|
/**
|
|
548
695
|
* 复制云函数
|
|
549
696
|
* @param {string} name 云函数名称
|
|
@@ -608,6 +755,24 @@ class FunctionService {
|
|
|
608
755
|
Type: 'timer'
|
|
609
756
|
});
|
|
610
757
|
}
|
|
758
|
+
/**
|
|
759
|
+
* 下载云函数代码
|
|
760
|
+
* @param {IFunctionCodeOptions} options
|
|
761
|
+
* @returns {Promise<void>}
|
|
762
|
+
*/
|
|
763
|
+
async downloadFunctionCode(options) {
|
|
764
|
+
const { destPath, envId, functionName, codeSecret } = options;
|
|
765
|
+
// 检验路径是否存在
|
|
766
|
+
(0, utils_1.checkFullAccess)(destPath, true);
|
|
767
|
+
// 获取下载链接
|
|
768
|
+
const { Url } = await this.scfService.request('GetFunctionAddress', {
|
|
769
|
+
FunctionName: functionName,
|
|
770
|
+
Namespace: envId,
|
|
771
|
+
CodeSecret: codeSecret
|
|
772
|
+
});
|
|
773
|
+
// 下载文件
|
|
774
|
+
return (0, utils_1.downloadAndExtractRemoteZip)(Url, destPath);
|
|
775
|
+
}
|
|
611
776
|
/**
|
|
612
777
|
* 获取云函数代码下载 链接
|
|
613
778
|
* @param {string} functionName
|
|
@@ -995,7 +1160,7 @@ class FunctionService {
|
|
|
995
1160
|
}, 300000);
|
|
996
1161
|
ticker = setInterval(async () => {
|
|
997
1162
|
try {
|
|
998
|
-
const { Status, StatusDesc, StatusReasons } = await this.getFunctionDetail(funcName, codeSecret);
|
|
1163
|
+
const { Status, StatusDesc, StatusReasons, RequestId } = await this.getFunctionDetail(funcName, codeSecret);
|
|
999
1164
|
// 更新中
|
|
1000
1165
|
if (Status === constant_1.SCF_STATUS.CREATING || Status === constant_1.SCF_STATUS.UPDATING)
|
|
1001
1166
|
return;
|
|
@@ -1003,8 +1168,7 @@ class FunctionService {
|
|
|
1003
1168
|
if (Status === constant_1.SCF_STATUS.CREATE_FAILED) {
|
|
1004
1169
|
StatusDesc && console.log(`函数状态描述: ${StatusDesc}`);
|
|
1005
1170
|
const errorDetails = StatusReasons.map(item => `[${item.ErrorCode}] ${item.ErrorMessage}`).join('\n');
|
|
1006
|
-
|
|
1007
|
-
throw new error_1.CloudBaseError('云函数创建失败');
|
|
1171
|
+
throw new error_1.CloudBaseError(`云函数创建失败\n失败信息: ${errorDetails}\nRequestId: ${RequestId}`);
|
|
1008
1172
|
}
|
|
1009
1173
|
// 函数状态正常
|
|
1010
1174
|
clearInterval(ticker);
|
|
@@ -1034,12 +1198,18 @@ __decorate([
|
|
|
1034
1198
|
__decorate([
|
|
1035
1199
|
(0, utils_1.preLazy)()
|
|
1036
1200
|
], FunctionService.prototype, "listFunctions", null);
|
|
1201
|
+
__decorate([
|
|
1202
|
+
(0, utils_1.preLazy)()
|
|
1203
|
+
], FunctionService.prototype, "listAllFunctions", null);
|
|
1037
1204
|
__decorate([
|
|
1038
1205
|
(0, utils_1.preLazy)()
|
|
1039
1206
|
], FunctionService.prototype, "deleteFunction", null);
|
|
1040
1207
|
__decorate([
|
|
1041
1208
|
(0, utils_1.preLazy)()
|
|
1042
1209
|
], FunctionService.prototype, "getFunctionDetail", null);
|
|
1210
|
+
__decorate([
|
|
1211
|
+
(0, utils_1.preLazy)()
|
|
1212
|
+
], FunctionService.prototype, "batchGetFunctionsDetail", null);
|
|
1043
1213
|
__decorate([
|
|
1044
1214
|
(0, utils_1.preLazy)()
|
|
1045
1215
|
], FunctionService.prototype, "getFunctionLogs", null);
|
|
@@ -1049,6 +1219,9 @@ __decorate([
|
|
|
1049
1219
|
__decorate([
|
|
1050
1220
|
(0, utils_1.preLazy)()
|
|
1051
1221
|
], FunctionService.prototype, "getFunctionLogDetail", null);
|
|
1222
|
+
__decorate([
|
|
1223
|
+
(0, utils_1.preLazy)()
|
|
1224
|
+
], FunctionService.prototype, "getCompleteFunctionLogs", null);
|
|
1052
1225
|
__decorate([
|
|
1053
1226
|
(0, utils_1.preLazy)()
|
|
1054
1227
|
], FunctionService.prototype, "updateFunctionConfig", null);
|
|
@@ -1058,6 +1231,9 @@ __decorate([
|
|
|
1058
1231
|
__decorate([
|
|
1059
1232
|
(0, utils_1.preLazy)()
|
|
1060
1233
|
], FunctionService.prototype, "invokeFunction", null);
|
|
1234
|
+
__decorate([
|
|
1235
|
+
(0, utils_1.preLazy)()
|
|
1236
|
+
], FunctionService.prototype, "batchInvokeFunctions", null);
|
|
1061
1237
|
__decorate([
|
|
1062
1238
|
(0, utils_1.preLazy)()
|
|
1063
1239
|
], FunctionService.prototype, "copyFunction", null);
|
package/lib/utils/index.js
CHANGED
|
@@ -28,6 +28,7 @@ exports.sleep = sleep;
|
|
|
28
28
|
exports.upperCaseStringFisrt = upperCaseStringFisrt;
|
|
29
29
|
exports.upperCaseObjKey = upperCaseObjKey;
|
|
30
30
|
exports.fetchTemplates = fetchTemplates;
|
|
31
|
+
exports.successLog = successLog;
|
|
31
32
|
const archiver_1 = __importDefault(require("archiver"));
|
|
32
33
|
const crypto_1 = __importDefault(require("crypto"));
|
|
33
34
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -36,6 +37,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
36
37
|
const unzipper_1 = __importDefault(require("unzipper"));
|
|
37
38
|
const constant_1 = require("../constant");
|
|
38
39
|
const http_request_1 = require("./http-request");
|
|
40
|
+
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
39
41
|
__exportStar(require("./auth"), exports);
|
|
40
42
|
__exportStar(require("./cloud-api-request"), exports);
|
|
41
43
|
__exportStar(require("./cloudbase-request"), exports);
|
|
@@ -265,3 +267,7 @@ const getCompleteTimeRange = (timeRange) => {
|
|
|
265
267
|
};
|
|
266
268
|
};
|
|
267
269
|
exports.getCompleteTimeRange = getCompleteTimeRange;
|
|
270
|
+
function successLog(msg) {
|
|
271
|
+
// 空格,兼容中文字符编码长度问题
|
|
272
|
+
console.log(`${log_symbols_1.default.success} ${msg}`);
|
|
273
|
+
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
|
-
import { IResponseInfo, ICloudFunction, IFunctionLogOptions, ICloudFunctionTrigger, IFunctionInvokeRes, IFunctionLogRes, IFunctionDownloadUrlRes, IFunctionLogDetailOptions, IFunctionLogDetailRes, IFunctionLogOptionsV2, IFunctionLogResV2 } from '../interfaces';
|
|
2
|
+
import { IResponseInfo, ICloudFunction, ICloudFunctionV2, IFunctionLogOptions, ICloudFunctionTrigger, IFunctionInvokeRes, IFunctionLogRes, IFunctionDownloadUrlRes, IFunctionLogDetailOptions, IFunctionLogDetailRes, IFunctionLogOptionsV2, IFunctionLogResV2 } from '../interfaces';
|
|
3
3
|
import { IFunctionInfo } from './types';
|
|
4
4
|
export interface IFunctionCode {
|
|
5
5
|
func: ICloudFunction;
|
|
@@ -173,6 +173,31 @@ export interface IGetFunctionAliasRes extends IResponseInfo {
|
|
|
173
173
|
AddTime: string;
|
|
174
174
|
ModTime: string;
|
|
175
175
|
}
|
|
176
|
+
export interface IListFunctionOptions {
|
|
177
|
+
limit?: number;
|
|
178
|
+
offset?: number;
|
|
179
|
+
envId: string;
|
|
180
|
+
}
|
|
181
|
+
export interface IFunctionBatchOptions {
|
|
182
|
+
functions: ICloudFunctionV2[];
|
|
183
|
+
envId: string;
|
|
184
|
+
log?: boolean;
|
|
185
|
+
}
|
|
186
|
+
export interface IGetAsyncEventStatusRes extends IResponseInfo {
|
|
187
|
+
Result: IAsyncEventStatus;
|
|
188
|
+
RequestId: string;
|
|
189
|
+
}
|
|
190
|
+
export interface IAsyncEventStatus {
|
|
191
|
+
InvokeRequestId: string;
|
|
192
|
+
Status: string;
|
|
193
|
+
StatusCode: number;
|
|
194
|
+
}
|
|
195
|
+
export interface IFunctionCodeOptions {
|
|
196
|
+
envId: string;
|
|
197
|
+
destPath: string;
|
|
198
|
+
functionName: string;
|
|
199
|
+
codeSecret?: string;
|
|
200
|
+
}
|
|
176
201
|
export declare class FunctionService {
|
|
177
202
|
private environment;
|
|
178
203
|
private vpcService;
|
|
@@ -214,19 +239,49 @@ export declare class FunctionService {
|
|
|
214
239
|
* @returns {Promise<Record<string, string>[]>}
|
|
215
240
|
*/
|
|
216
241
|
listFunctions(limit?: number, offset?: number): Promise<Record<string, string>[]>;
|
|
242
|
+
/**
|
|
243
|
+
* 列出所有函数
|
|
244
|
+
* @param {IListFunctionOptions} options
|
|
245
|
+
* @returns {Promise<Record<string, string>[]>}
|
|
246
|
+
*/
|
|
247
|
+
listAllFunctions(options: IListFunctionOptions): Promise<Record<string, string>[]>;
|
|
217
248
|
/**
|
|
218
249
|
* 删除云函数
|
|
219
250
|
* @param {string} name 云函数名称
|
|
220
251
|
* @param {string} qualifier 需要删除的版本号,不填默认删除函数下全部版本。
|
|
221
252
|
* @returns {Promise<IResponseInfo>}
|
|
222
253
|
*/
|
|
223
|
-
deleteFunction(name
|
|
254
|
+
deleteFunction({ name }: {
|
|
255
|
+
name: any;
|
|
256
|
+
}): Promise<void>;
|
|
257
|
+
/**
|
|
258
|
+
* 批量删除云函数
|
|
259
|
+
* @param {Object} options
|
|
260
|
+
* @param {string[]} options.names 云函数名称列表
|
|
261
|
+
* @returns {Promise<void>}
|
|
262
|
+
*/
|
|
263
|
+
batchDeleteFunctions({ names }: {
|
|
264
|
+
names: any;
|
|
265
|
+
}): Promise<void>;
|
|
224
266
|
/**
|
|
225
267
|
* 获取云函数详细信息
|
|
226
268
|
* @param {string} name 云函数名称
|
|
227
269
|
* @returns {Promise<Record<string, string>>}
|
|
228
270
|
*/
|
|
229
271
|
getFunctionDetail(name: string, codeSecret?: string): Promise<IFunctionInfo>;
|
|
272
|
+
/**
|
|
273
|
+
* 批量获取云函数详细信息
|
|
274
|
+
* @param {Object} options
|
|
275
|
+
* @param {string[]} options.names 云函数名称列表
|
|
276
|
+
* @param {string} options.envId 环境 ID
|
|
277
|
+
* @param {string} options.codeSecret
|
|
278
|
+
* @returns {Promise<IFunctionInfo[]>}
|
|
279
|
+
*/
|
|
280
|
+
batchGetFunctionsDetail({ names, envId, codeSecret }: {
|
|
281
|
+
names: any;
|
|
282
|
+
envId: any;
|
|
283
|
+
codeSecret: any;
|
|
284
|
+
}): Promise<IFunctionInfo[]>;
|
|
230
285
|
/**
|
|
231
286
|
* 获取函数日志
|
|
232
287
|
* @deprecated 请使用 getFunctionLogsV2 代替
|
|
@@ -267,6 +322,13 @@ export declare class FunctionService {
|
|
|
267
322
|
* @returns {Promise<IFunctionLogDetailRes>}
|
|
268
323
|
*/
|
|
269
324
|
getFunctionLogDetail(options: IFunctionLogDetailOptions): Promise<IFunctionLogDetailRes>;
|
|
325
|
+
/**
|
|
326
|
+
* 获取函数的完整调用日志
|
|
327
|
+
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
328
|
+
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
329
|
+
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
330
|
+
*/
|
|
331
|
+
getCompleteFunctionLogs(options: IFunctionLogOptionsV2): Promise<IFunctionLogDetailRes[]>;
|
|
270
332
|
/**
|
|
271
333
|
* 更新云函数配置
|
|
272
334
|
* @param {ICloudFunction} func 云函数配置
|
|
@@ -287,6 +349,12 @@ export declare class FunctionService {
|
|
|
287
349
|
* @returns {Promise<IFunctionInvokeRes>}
|
|
288
350
|
*/
|
|
289
351
|
invokeFunction(name: string, params?: Record<string, any>): Promise<IFunctionInvokeRes>;
|
|
352
|
+
/**
|
|
353
|
+
* 批量调用云函数
|
|
354
|
+
* @param {IFunctionBatchOptions} options
|
|
355
|
+
* @returns {Promise<IFunctionInvokeRes[]>}
|
|
356
|
+
*/
|
|
357
|
+
batchInvokeFunctions(options: IFunctionBatchOptions): Promise<IFunctionInvokeRes[]>;
|
|
290
358
|
/**
|
|
291
359
|
* 复制云函数
|
|
292
360
|
* @param {string} name 云函数名称
|
|
@@ -310,6 +378,12 @@ export declare class FunctionService {
|
|
|
310
378
|
* @returns {Promise<IResponseInfo>}
|
|
311
379
|
*/
|
|
312
380
|
deleteFunctionTrigger(name: string, triggerName: string): Promise<IResponseInfo>;
|
|
381
|
+
/**
|
|
382
|
+
* 下载云函数代码
|
|
383
|
+
* @param {IFunctionCodeOptions} options
|
|
384
|
+
* @returns {Promise<void>}
|
|
385
|
+
*/
|
|
386
|
+
downloadFunctionCode(options: IFunctionCodeOptions): Promise<void>;
|
|
313
387
|
/**
|
|
314
388
|
* 获取云函数代码下载 链接
|
|
315
389
|
* @param {string} functionName
|
|
@@ -121,6 +121,62 @@ export interface IFunctionInfo {
|
|
|
121
121
|
ErrorCode: string;
|
|
122
122
|
ErrorMessage: string;
|
|
123
123
|
}[];
|
|
124
|
+
RequestId: string;
|
|
125
|
+
Layers: ILayerVersionInfo[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 层版本信息
|
|
129
|
+
* 被 GetFunction, ListLayerVersions, ListLayers 接口引用
|
|
130
|
+
*/
|
|
131
|
+
export interface ILayerVersionInfo {
|
|
132
|
+
/**
|
|
133
|
+
* 版本适用的运行时
|
|
134
|
+
* @example ["Python3.10","Python3.9"]
|
|
135
|
+
*/
|
|
136
|
+
CompatibleRuntimes?: string[];
|
|
137
|
+
/**
|
|
138
|
+
* 创建时间
|
|
139
|
+
* @example 2024-11-22 16:52:21
|
|
140
|
+
*/
|
|
141
|
+
AddTime?: string;
|
|
142
|
+
/**
|
|
143
|
+
* 版本描述
|
|
144
|
+
* @example "a layer"
|
|
145
|
+
*/
|
|
146
|
+
Description?: string;
|
|
147
|
+
/**
|
|
148
|
+
* 许可证信息
|
|
149
|
+
* @example " "
|
|
150
|
+
*/
|
|
151
|
+
LicenseInfo?: string | null;
|
|
152
|
+
/**
|
|
153
|
+
* 版本号
|
|
154
|
+
* @example 1
|
|
155
|
+
*/
|
|
156
|
+
LayerVersion?: number;
|
|
157
|
+
/**
|
|
158
|
+
* 层名称
|
|
159
|
+
* @example "layer-name1"
|
|
160
|
+
*/
|
|
161
|
+
LayerName?: string;
|
|
162
|
+
/**
|
|
163
|
+
* 层的具体版本当前状态
|
|
164
|
+
* Active:正常状态
|
|
165
|
+
*/
|
|
166
|
+
Status?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Stamp
|
|
169
|
+
* @example "Default"
|
|
170
|
+
*/
|
|
171
|
+
Stamp?: string;
|
|
172
|
+
/**
|
|
173
|
+
* 返回层绑定的标签信息
|
|
174
|
+
*/
|
|
175
|
+
Tags?: ITag1[];
|
|
176
|
+
}
|
|
177
|
+
export interface ITag1 {
|
|
178
|
+
Key: string;
|
|
179
|
+
Value: string[];
|
|
124
180
|
}
|
|
125
181
|
export interface IFunctionCode {
|
|
126
182
|
CosBucketName?: string;
|
|
@@ -33,6 +33,21 @@ export interface ICloudFunction extends ICloudFunctionConfig {
|
|
|
33
33
|
}[];
|
|
34
34
|
triggers?: ICloudFunctionTrigger[];
|
|
35
35
|
}
|
|
36
|
+
export interface ICloudFunctionV2 {
|
|
37
|
+
name: string;
|
|
38
|
+
config?: ICloudFunctionConfig;
|
|
39
|
+
triggers?: ICloudFunctionTrigger[];
|
|
40
|
+
params?: Record<string, string>;
|
|
41
|
+
handler?: string;
|
|
42
|
+
ignore?: string | string[];
|
|
43
|
+
timeout?: number;
|
|
44
|
+
envVariables?: Record<string, string | number | boolean>;
|
|
45
|
+
runtime?: string;
|
|
46
|
+
vpc?: IFunctionVPC;
|
|
47
|
+
l5?: boolean;
|
|
48
|
+
installDependency?: boolean;
|
|
49
|
+
isWaitInstall?: boolean;
|
|
50
|
+
}
|
|
36
51
|
export interface IFunctionLogOptions {
|
|
37
52
|
name: string;
|
|
38
53
|
offset?: number;
|
|
@@ -66,6 +81,7 @@ export interface IFunctionInvokeRes {
|
|
|
66
81
|
Duration: number;
|
|
67
82
|
BillDuration: number;
|
|
68
83
|
FunctionRequestId: string;
|
|
84
|
+
InvokeResult: number;
|
|
69
85
|
}
|
|
70
86
|
export interface IFunctionLogRes {
|
|
71
87
|
RequestId: string;
|
package/types/utils/index.d.ts
CHANGED