@cloudbase/manager-node 5.6.6 → 5.6.7
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/CHANGELOG.md +7 -0
- package/lib/cloudrun/index.js +97 -0
- package/package.json +1 -1
- package/types/cloudrun/index.d.ts +36 -1
- package/types/cloudrun/type.d.ts +130 -0
package/CHANGELOG.md
CHANGED
package/lib/cloudrun/index.js
CHANGED
|
@@ -88,6 +88,19 @@ class CloudRunService {
|
|
|
88
88
|
throw new Error(`云托管代码下载地址为空(请求ID: ${cloudBaseBuildServiceRes.RequestId})`);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* 查询服务管理任务信息
|
|
93
|
+
* @param {Object} params 查询参数
|
|
94
|
+
* @param {string} params.serverName 服务名
|
|
95
|
+
* @param {number} [params.taskId=0] 任务 ID,传 0 表示查询该服务当前最新的任务
|
|
96
|
+
* @param {string} [params.operatorRemark] 操作标识
|
|
97
|
+
* @returns {Promise<{ IsExist?: boolean; Task?: IServerManageTaskInfo; RequestId?: string }>} 任务是否存在及任务信息
|
|
98
|
+
*/
|
|
99
|
+
async describeServerManageTask(params) {
|
|
100
|
+
var _a;
|
|
101
|
+
const envConfig = this.environment.lazyEnvironmentConfig;
|
|
102
|
+
return this.tcbrService.request('DescribeServerManageTask', Object.assign({ EnvId: envConfig.EnvId, ServerName: params.serverName, TaskId: (_a = params.taskId) !== null && _a !== void 0 ? _a : 0 }, (params.operatorRemark ? { OperatorRemark: params.operatorRemark } : {})));
|
|
103
|
+
}
|
|
91
104
|
/**
|
|
92
105
|
* 获取云托管服务列表
|
|
93
106
|
* @param {Object} [params] 查询参数
|
|
@@ -197,6 +210,78 @@ class CloudRunService {
|
|
|
197
210
|
OperateType: 'go_back',
|
|
198
211
|
});
|
|
199
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* 回滚版本(SubmitServerRollback)
|
|
215
|
+
* @param {ISubmitServerRollbackParams} params 回滚参数(服务名、当前版本名、目标回滚版本名)
|
|
216
|
+
* @returns {Promise<ISubmitServerRollbackResponse>} 返回任务 ID 和请求 ID
|
|
217
|
+
*/
|
|
218
|
+
async submitServerRollback(params) {
|
|
219
|
+
var _a, _b, _c, _d;
|
|
220
|
+
const envConfig = this.environment.lazyEnvironmentConfig;
|
|
221
|
+
const serverName = (_a = params === null || params === void 0 ? void 0 : params.ServerName) === null || _a === void 0 ? void 0 : _a.trim();
|
|
222
|
+
const currentVersionName = (_b = params === null || params === void 0 ? void 0 : params.CurrentVersionName) === null || _b === void 0 ? void 0 : _b.trim();
|
|
223
|
+
const rollbackVersionName = (_c = params === null || params === void 0 ? void 0 : params.RollbackVersionName) === null || _c === void 0 ? void 0 : _c.trim();
|
|
224
|
+
const operatorRemark = (_d = params === null || params === void 0 ? void 0 : params.OperatorRemark) === null || _d === void 0 ? void 0 : _d.trim();
|
|
225
|
+
if (!serverName) {
|
|
226
|
+
throw new Error('Missing required parameters: ServerName');
|
|
227
|
+
}
|
|
228
|
+
if (!currentVersionName) {
|
|
229
|
+
throw new Error('Missing required parameters: CurrentVersionName');
|
|
230
|
+
}
|
|
231
|
+
if (!rollbackVersionName) {
|
|
232
|
+
throw new Error('Missing required parameters: RollbackVersionName');
|
|
233
|
+
}
|
|
234
|
+
return this.tcbrService.request('SubmitServerRollback', Object.assign({ EnvId: envConfig.EnvId, ServerName: serverName, CurrentVersionName: currentVersionName, RollbackVersionName: rollbackVersionName }, (operatorRemark ? { OperatorRemark: operatorRemark } : {})));
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* 批量删除版本
|
|
238
|
+
* @param {IDeleteCloudRunVersionsParams} params 删除参数
|
|
239
|
+
* @returns {Promise<IDeleteCloudRunVersionsResponse>} 删除结果
|
|
240
|
+
*/
|
|
241
|
+
async deleteCloudRunVersions(params) {
|
|
242
|
+
var _a;
|
|
243
|
+
const envConfig = this.environment.lazyEnvironmentConfig;
|
|
244
|
+
const operatorRemark = (_a = params === null || params === void 0 ? void 0 : params.OperatorRemark) === null || _a === void 0 ? void 0 : _a.trim();
|
|
245
|
+
if (!Array.isArray(params === null || params === void 0 ? void 0 : params.SimpleVersions) || params.SimpleVersions.length === 0) {
|
|
246
|
+
throw new Error('Missing required parameters: SimpleVersions');
|
|
247
|
+
}
|
|
248
|
+
const simpleVersions = params.SimpleVersions.map((item, index) => {
|
|
249
|
+
var _a, _b, _c;
|
|
250
|
+
const serverName = (_a = item === null || item === void 0 ? void 0 : item.ServerName) === null || _a === void 0 ? void 0 : _a.trim();
|
|
251
|
+
const versionName = (_b = item === null || item === void 0 ? void 0 : item.VersionName) === null || _b === void 0 ? void 0 : _b.trim();
|
|
252
|
+
if (!serverName) {
|
|
253
|
+
throw new Error(`Invalid SimpleVersions[${index}].ServerName`);
|
|
254
|
+
}
|
|
255
|
+
if (!versionName) {
|
|
256
|
+
throw new Error(`Invalid SimpleVersions[${index}].VersionName`);
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
EnvId: ((_c = item === null || item === void 0 ? void 0 : item.EnvId) === null || _c === void 0 ? void 0 : _c.trim()) || envConfig.EnvId,
|
|
260
|
+
ServerName: serverName,
|
|
261
|
+
VersionName: versionName
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
return this.tcbrService.request('DeleteCloudRunVersions', Object.assign({ EnvId: envConfig.EnvId, IsDeleteServer: params.IsDeleteServer, IsDeleteImage: params.IsDeleteImage, SimpleVersions: simpleVersions }, (operatorRemark ? { OperatorRemark: operatorRemark } : {})));
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* 查询版本详情
|
|
268
|
+
* @param {IDescribeVersionDetailParams} params 查询参数(服务名、版本名、可选渠道)
|
|
269
|
+
* @returns {Promise<IDescribeVersionDetailResponse>} 版本详情
|
|
270
|
+
*/
|
|
271
|
+
async describeVersionDetail(params) {
|
|
272
|
+
var _a, _b, _c;
|
|
273
|
+
const envConfig = this.environment.lazyEnvironmentConfig;
|
|
274
|
+
const serverName = (_a = params === null || params === void 0 ? void 0 : params.ServerName) === null || _a === void 0 ? void 0 : _a.trim();
|
|
275
|
+
const versionName = (_b = params === null || params === void 0 ? void 0 : params.VersionName) === null || _b === void 0 ? void 0 : _b.trim();
|
|
276
|
+
const channel = (_c = params === null || params === void 0 ? void 0 : params.Channel) === null || _c === void 0 ? void 0 : _c.trim();
|
|
277
|
+
if (!serverName) {
|
|
278
|
+
throw new Error('Missing required parameters: ServerName');
|
|
279
|
+
}
|
|
280
|
+
if (!versionName) {
|
|
281
|
+
throw new Error('Missing required parameters: VersionName');
|
|
282
|
+
}
|
|
283
|
+
return this.tcbrService.request('DescribeVersionDetail', Object.assign({ EnvId: envConfig.EnvId, ServerName: serverName, VersionName: versionName }, (channel ? { Channel: channel } : {})));
|
|
284
|
+
}
|
|
200
285
|
/**
|
|
201
286
|
*查询云托管服务详情
|
|
202
287
|
* @param {Object} params 查询参数
|
|
@@ -433,6 +518,9 @@ __decorate([
|
|
|
433
518
|
__decorate([
|
|
434
519
|
(0, utils_1.preLazy)()
|
|
435
520
|
], CloudRunService.prototype, "download", null);
|
|
521
|
+
__decorate([
|
|
522
|
+
(0, utils_1.preLazy)()
|
|
523
|
+
], CloudRunService.prototype, "describeServerManageTask", null);
|
|
436
524
|
__decorate([
|
|
437
525
|
(0, utils_1.preLazy)()
|
|
438
526
|
], CloudRunService.prototype, "list", null);
|
|
@@ -445,6 +533,15 @@ __decorate([
|
|
|
445
533
|
__decorate([
|
|
446
534
|
(0, utils_1.preLazy)()
|
|
447
535
|
], CloudRunService.prototype, "rollback", null);
|
|
536
|
+
__decorate([
|
|
537
|
+
(0, utils_1.preLazy)()
|
|
538
|
+
], CloudRunService.prototype, "submitServerRollback", null);
|
|
539
|
+
__decorate([
|
|
540
|
+
(0, utils_1.preLazy)()
|
|
541
|
+
], CloudRunService.prototype, "deleteCloudRunVersions", null);
|
|
542
|
+
__decorate([
|
|
543
|
+
(0, utils_1.preLazy)()
|
|
544
|
+
], CloudRunService.prototype, "describeVersionDetail", null);
|
|
448
545
|
__decorate([
|
|
449
546
|
(0, utils_1.preLazy)()
|
|
450
547
|
], CloudRunService.prototype, "detail", null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
2
|
import { IResponseInfo } from '../interfaces';
|
|
3
|
-
import { CloudrunServerType, ICloudrunDetailResponse, ICloudrunListResponse, ICloudrunServerBaseConfig, ICreateVpcInfo, IBuildLogResponse, IProcessLogResponse, IDiffConfigItem, ITemplate, ReleaseTypeEnum, IDescribeCloudRunDeployRecordResponse } from './type';
|
|
3
|
+
import { CloudrunServerType, ICloudrunDetailResponse, ICloudrunListResponse, ICloudrunServerBaseConfig, ICreateVpcInfo, IBuildLogResponse, IProcessLogResponse, IDiffConfigItem, ITemplate, ReleaseTypeEnum, IServerManageTaskInfo, IDescribeCloudRunDeployRecordResponse, IDescribeVersionDetailParams, IDescribeVersionDetailResponse, ISubmitServerRollbackParams, ISubmitServerRollbackResponse, IDeleteCloudRunVersionsParams, IDeleteCloudRunVersionsResponse } from './type';
|
|
4
4
|
/**
|
|
5
5
|
* 云托管服务管理类
|
|
6
6
|
* 提供云托管服务的初始化、下载、列表查询和删除等功能
|
|
@@ -41,6 +41,23 @@ export declare class CloudRunService {
|
|
|
41
41
|
serverName: string;
|
|
42
42
|
targetPath: string;
|
|
43
43
|
}): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* 查询服务管理任务信息
|
|
46
|
+
* @param {Object} params 查询参数
|
|
47
|
+
* @param {string} params.serverName 服务名
|
|
48
|
+
* @param {number} [params.taskId=0] 任务 ID,传 0 表示查询该服务当前最新的任务
|
|
49
|
+
* @param {string} [params.operatorRemark] 操作标识
|
|
50
|
+
* @returns {Promise<{ IsExist?: boolean; Task?: IServerManageTaskInfo; RequestId?: string }>} 任务是否存在及任务信息
|
|
51
|
+
*/
|
|
52
|
+
describeServerManageTask(params: {
|
|
53
|
+
serverName: string;
|
|
54
|
+
taskId?: number;
|
|
55
|
+
operatorRemark?: string;
|
|
56
|
+
}): Promise<{
|
|
57
|
+
IsExist?: boolean;
|
|
58
|
+
Task?: IServerManageTaskInfo;
|
|
59
|
+
RequestId?: string;
|
|
60
|
+
}>;
|
|
44
61
|
/**
|
|
45
62
|
* 获取云托管服务列表
|
|
46
63
|
* @param {Object} [params] 查询参数
|
|
@@ -82,6 +99,24 @@ export declare class CloudRunService {
|
|
|
82
99
|
rollback(serverName: string): Promise<{
|
|
83
100
|
RequestId?: string;
|
|
84
101
|
}>;
|
|
102
|
+
/**
|
|
103
|
+
* 回滚版本(SubmitServerRollback)
|
|
104
|
+
* @param {ISubmitServerRollbackParams} params 回滚参数(服务名、当前版本名、目标回滚版本名)
|
|
105
|
+
* @returns {Promise<ISubmitServerRollbackResponse>} 返回任务 ID 和请求 ID
|
|
106
|
+
*/
|
|
107
|
+
submitServerRollback(params: ISubmitServerRollbackParams): Promise<ISubmitServerRollbackResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* 批量删除版本
|
|
110
|
+
* @param {IDeleteCloudRunVersionsParams} params 删除参数
|
|
111
|
+
* @returns {Promise<IDeleteCloudRunVersionsResponse>} 删除结果
|
|
112
|
+
*/
|
|
113
|
+
deleteCloudRunVersions(params: IDeleteCloudRunVersionsParams): Promise<IDeleteCloudRunVersionsResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* 查询版本详情
|
|
116
|
+
* @param {IDescribeVersionDetailParams} params 查询参数(服务名、版本名、可选渠道)
|
|
117
|
+
* @returns {Promise<IDescribeVersionDetailResponse>} 版本详情
|
|
118
|
+
*/
|
|
119
|
+
describeVersionDetail(params: IDescribeVersionDetailParams): Promise<IDescribeVersionDetailResponse>;
|
|
85
120
|
/**
|
|
86
121
|
*查询云托管服务详情
|
|
87
122
|
* @param {Object} params 查询参数
|
package/types/cloudrun/type.d.ts
CHANGED
|
@@ -426,6 +426,136 @@ export interface IReleaseOrderInfo {
|
|
|
426
426
|
CreateTime?: string;
|
|
427
427
|
IsReleasing?: boolean;
|
|
428
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* DescribeVersionDetail 请求参数
|
|
431
|
+
*/
|
|
432
|
+
export interface IDescribeVersionDetailParams {
|
|
433
|
+
/** 服务名 */
|
|
434
|
+
ServerName: string;
|
|
435
|
+
/** 版本名 */
|
|
436
|
+
VersionName: string;
|
|
437
|
+
/** 可选渠道 */
|
|
438
|
+
Channel?: string;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* BuildPacksInfo(CreateCloudRunServer / DescribeVersionDetail / UpdateCloudRunServer)
|
|
442
|
+
*/
|
|
443
|
+
export interface IBuildPacksInfo {
|
|
444
|
+
/** 基础镜像 */
|
|
445
|
+
BaseImage: string;
|
|
446
|
+
/** 启动命令 */
|
|
447
|
+
EntryPoint: string;
|
|
448
|
+
/** 语言 */
|
|
449
|
+
RepoLanguage: string;
|
|
450
|
+
/** 上传文件名 */
|
|
451
|
+
UploadFilename: string;
|
|
452
|
+
/** 语言版本 */
|
|
453
|
+
LanguageVersion?: string;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* DescribeVersionDetail 响应
|
|
457
|
+
*/
|
|
458
|
+
export interface IDescribeVersionDetailResponse {
|
|
459
|
+
Name: string;
|
|
460
|
+
Port: number;
|
|
461
|
+
Cpu: number;
|
|
462
|
+
Mem: number;
|
|
463
|
+
MinNum: number;
|
|
464
|
+
MaxNum: number;
|
|
465
|
+
PolicyDetails: ICloudrunHpaPolicy[];
|
|
466
|
+
Dockerfile: string;
|
|
467
|
+
BuildDir: string;
|
|
468
|
+
EnvParams: string;
|
|
469
|
+
Status: string;
|
|
470
|
+
CreatedTime: string;
|
|
471
|
+
UpdatedTime: string;
|
|
472
|
+
LogPath: string;
|
|
473
|
+
EntryPoint: string | null;
|
|
474
|
+
Cmd: string | null;
|
|
475
|
+
VpcConf: IVpcConf | null;
|
|
476
|
+
VolumesConf: IVolumeConf[] | null;
|
|
477
|
+
BuildPacks: IBuildPacksInfo | null;
|
|
478
|
+
RequestId: string;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* SubmitServerRollback 请求参数
|
|
482
|
+
*/
|
|
483
|
+
export interface ISubmitServerRollbackParams {
|
|
484
|
+
/** 服务名 */
|
|
485
|
+
ServerName: string;
|
|
486
|
+
/** 当前版本名 */
|
|
487
|
+
CurrentVersionName: string;
|
|
488
|
+
/** 目标回滚版本名 */
|
|
489
|
+
RollbackVersionName: string;
|
|
490
|
+
/** 操作标识 */
|
|
491
|
+
OperatorRemark?: string;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* SubmitServerRollback 响应
|
|
495
|
+
*/
|
|
496
|
+
export interface ISubmitServerRollbackResponse {
|
|
497
|
+
/** 任务 ID */
|
|
498
|
+
TaskId: number;
|
|
499
|
+
/** 请求 ID */
|
|
500
|
+
RequestId: string;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* DeleteCloudRunVersions 版本信息
|
|
504
|
+
*/
|
|
505
|
+
export interface ISimpleVersion {
|
|
506
|
+
/** 环境 ID(可选,不传时由 SDK 自动注入当前环境) */
|
|
507
|
+
EnvId?: string;
|
|
508
|
+
/** 服务名 */
|
|
509
|
+
ServerName: string;
|
|
510
|
+
/** 版本名 */
|
|
511
|
+
VersionName: string;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* DeleteCloudRunVersions 请求参数
|
|
515
|
+
*/
|
|
516
|
+
export interface IDeleteCloudRunVersionsParams {
|
|
517
|
+
/** 是否删除服务(仅最后一个版本时生效) */
|
|
518
|
+
IsDeleteServer: boolean;
|
|
519
|
+
/** 是否删除镜像(仅删除服务时生效) */
|
|
520
|
+
IsDeleteImage: boolean;
|
|
521
|
+
/** 待删除版本列表 */
|
|
522
|
+
SimpleVersions: ISimpleVersion[];
|
|
523
|
+
/** 操作标识 */
|
|
524
|
+
OperatorRemark?: string;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* FailDeleteVersions(删除失败版本信息)
|
|
528
|
+
*/
|
|
529
|
+
export interface IFailDeleteVersions {
|
|
530
|
+
/** 删除失败版本信息 */
|
|
531
|
+
Version: ISimpleVersion;
|
|
532
|
+
/** 删除失败错误码 */
|
|
533
|
+
ErrorCode: number;
|
|
534
|
+
/** 删除失败错误信息 */
|
|
535
|
+
ErrorMsg: string;
|
|
536
|
+
/** 删除操作 RequestId */
|
|
537
|
+
RequestId: string;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* SuccessDeleteVersions(删除成功的版本信息)
|
|
541
|
+
*/
|
|
542
|
+
export interface ISuccessDeleteVersions {
|
|
543
|
+
/** 版本简化信息 */
|
|
544
|
+
Version: ISimpleVersion;
|
|
545
|
+
/** 删除版本的 RequestId */
|
|
546
|
+
RequestId: string;
|
|
547
|
+
/** 删除版本结果 */
|
|
548
|
+
Result: string;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* DeleteCloudRunVersions 响应
|
|
552
|
+
*/
|
|
553
|
+
export interface IDeleteCloudRunVersionsResponse {
|
|
554
|
+
Result: 'succ' | 'fail' | 'partial' | string;
|
|
555
|
+
FailVersions: IFailDeleteVersions[];
|
|
556
|
+
SuccessVersions: ISuccessDeleteVersions[];
|
|
557
|
+
RequestId: string;
|
|
558
|
+
}
|
|
429
559
|
/**
|
|
430
560
|
* DescribeCloudRunDeployRecord 单条部署记录
|
|
431
561
|
*/
|