@cloudbase/manager-node 4.11.0-alpha.1 → 4.11.0-alpha.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/lib/database/index.js +79 -0
- package/lib/docs/index.js +288 -0
- package/lib/docs/types.js +2 -0
- package/lib/environment.js +5 -0
- package/lib/index.js +3 -0
- package/lib/mysql/index.js +551 -0
- package/lib/mysql/types/account.js +2 -0
- package/lib/mysql/types/backup.js +2 -0
- package/lib/mysql/types/base.js +2 -0
- package/lib/mysql/types/index.js +19 -0
- package/package.json +1 -1
- package/types/database/index.d.ts +112 -0
- package/types/docs/index.d.ts +37 -0
- package/types/docs/types.d.ts +24 -0
- package/types/environment.d.ts +3 -0
- package/types/index.d.ts +2 -0
- package/types/mysql/index.d.ts +261 -0
- package/types/mysql/types/account.d.ts +160 -0
- package/types/mysql/types/backup.d.ts +161 -0
- package/types/mysql/types/base.d.ts +579 -0
- package/types/mysql/types/index.d.ts +3 -0
|
@@ -15,6 +15,38 @@ interface IMgoQueryInfo {
|
|
|
15
15
|
MgoLimit?: number;
|
|
16
16
|
MgoOffset?: number;
|
|
17
17
|
}
|
|
18
|
+
/** 待执行命令参数 */
|
|
19
|
+
interface IMgoCommandParam {
|
|
20
|
+
/** 表名 */
|
|
21
|
+
TableName: string;
|
|
22
|
+
/** 操作类型:UPDATE / QUERY / INSERT / DELETE / COMMAND */
|
|
23
|
+
CommandType: string;
|
|
24
|
+
/** 待执行命令(JSON 字符串) */
|
|
25
|
+
Command: string;
|
|
26
|
+
}
|
|
27
|
+
/** MongoDB 连接器配置 */
|
|
28
|
+
interface IMongoConnector {
|
|
29
|
+
/** 连接器实例 ID */
|
|
30
|
+
InstanceId?: string;
|
|
31
|
+
/** MongoDB 数据库名 */
|
|
32
|
+
DatabaseName?: string;
|
|
33
|
+
}
|
|
34
|
+
/** RunCommands 请求参数 */
|
|
35
|
+
interface IRunCommandsOptions {
|
|
36
|
+
/** 待执行命令列表 */
|
|
37
|
+
MgoCommands: IMgoCommandParam[];
|
|
38
|
+
/** 实例 ID,如 tnt-xxxx。不传则自动使用当前环境的数据库实例 ID */
|
|
39
|
+
Tag?: string;
|
|
40
|
+
/** 环境 ID。不传则自动使用当前环境 ID */
|
|
41
|
+
EnvId?: string;
|
|
42
|
+
/** Mongo 连接器实例信息 */
|
|
43
|
+
MongoConnector?: IMongoConnector;
|
|
44
|
+
}
|
|
45
|
+
/** RunCommands 返回结果 */
|
|
46
|
+
interface IRunCommandsResult extends IResponseInfo {
|
|
47
|
+
/** 返回结果,每个元素是一个 JSON 字符串 */
|
|
48
|
+
Data: string[];
|
|
49
|
+
}
|
|
18
50
|
interface ICollectionInfo extends IResponseInfo {
|
|
19
51
|
Collections: Array<TableInfo>;
|
|
20
52
|
Pager: Pager;
|
|
@@ -38,6 +70,52 @@ interface IDatabaseMigrateQueryInfo extends IResponseInfo {
|
|
|
38
70
|
interface IDatabaseImportAndExportInfo extends IResponseInfo {
|
|
39
71
|
JobId: number;
|
|
40
72
|
}
|
|
73
|
+
/** 回档表格名称映射信息 */
|
|
74
|
+
interface IModifyTableNamesInfo {
|
|
75
|
+
/** 原表名 */
|
|
76
|
+
OldTableName: string;
|
|
77
|
+
/** 新表名 */
|
|
78
|
+
NewTableName: string;
|
|
79
|
+
}
|
|
80
|
+
/** 回档任务信息 */
|
|
81
|
+
interface IRestoreTask {
|
|
82
|
+
/** 恢复任务ID */
|
|
83
|
+
TaskId?: string;
|
|
84
|
+
/** 任务状态 */
|
|
85
|
+
Status?: string;
|
|
86
|
+
/** 任务创建时间 */
|
|
87
|
+
Time?: string;
|
|
88
|
+
/** 环境ID */
|
|
89
|
+
EnvId?: string;
|
|
90
|
+
/** 恢复类型 */
|
|
91
|
+
Type?: string;
|
|
92
|
+
}
|
|
93
|
+
/** 任意时间回档范围 */
|
|
94
|
+
interface IRestoreTableTimeRange {
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
}
|
|
97
|
+
/** 获取可回档表格返回结果 */
|
|
98
|
+
interface IDescribeRestoreTablesResult extends IResponseInfo {
|
|
99
|
+
/** 可回档表格列表 */
|
|
100
|
+
Tables: string[];
|
|
101
|
+
}
|
|
102
|
+
/** 获取回档任务返回结果 */
|
|
103
|
+
interface IDescribeRestoreTaskResult extends IResponseInfo {
|
|
104
|
+
/** 回档任务列表 */
|
|
105
|
+
Tasks: IRestoreTask[];
|
|
106
|
+
}
|
|
107
|
+
/** 获取可回档时间返回结果 */
|
|
108
|
+
interface IDescribeRestoreTimeResult extends IResponseInfo {
|
|
109
|
+
/** 可回档时间列表 */
|
|
110
|
+
RestoreTimes: string[];
|
|
111
|
+
/** 任意时间回档列表 */
|
|
112
|
+
RestoreTimeRanges: IRestoreTableTimeRange[];
|
|
113
|
+
}
|
|
114
|
+
/** 实例表格回档返回结果 */
|
|
115
|
+
interface IRestoreTCBTablesResult extends IResponseInfo {
|
|
116
|
+
/** 流程ID */
|
|
117
|
+
FlowId: number;
|
|
118
|
+
}
|
|
41
119
|
export declare class DatabaseService {
|
|
42
120
|
static tcbServiceVersion: IServiceVersion;
|
|
43
121
|
static flexdbServiceVersion: IServiceVersion;
|
|
@@ -62,5 +140,39 @@ export declare class DatabaseService {
|
|
|
62
140
|
migrateStatus(jobId: number): Promise<IDatabaseMigrateQueryInfo>;
|
|
63
141
|
import(collectionName: string, file: any, options: any): Promise<IDatabaseImportAndExportInfo>;
|
|
64
142
|
export(collectionName: string, file: any, options: any): Promise<IDatabaseImportAndExportInfo>;
|
|
143
|
+
/**
|
|
144
|
+
* 获取可回档表格
|
|
145
|
+
* @param time 回档时间,格式 YYYY-MM-DD HH:MM:SS
|
|
146
|
+
* @param filters 过滤器(可选)
|
|
147
|
+
* @param instanceId 实例ID(可选,不传则自动使用当前环境的数据库实例 ID)
|
|
148
|
+
* @returns 可回档表格列表
|
|
149
|
+
*/
|
|
150
|
+
describeRestoreTables(time: string, filters?: string[], instanceId?: string): Promise<IDescribeRestoreTablesResult>;
|
|
151
|
+
/**
|
|
152
|
+
* 获取回档任务
|
|
153
|
+
* @param instanceId 实例ID(可选,不传则自动使用当前环境的数据库实例 ID)
|
|
154
|
+
* @returns 回档任务列表
|
|
155
|
+
*/
|
|
156
|
+
describeRestoreTask(instanceId?: string): Promise<IDescribeRestoreTaskResult>;
|
|
157
|
+
/**
|
|
158
|
+
* 获取可回档时间
|
|
159
|
+
* @param instanceId 实例ID(可选,不传则自动使用当前环境的数据库实例 ID)
|
|
160
|
+
* @returns 可回档时间列表及任意时间回档列表
|
|
161
|
+
*/
|
|
162
|
+
describeRestoreTime(instanceId?: string): Promise<IDescribeRestoreTimeResult>;
|
|
163
|
+
/**
|
|
164
|
+
* 实例表格回档
|
|
165
|
+
* @param time 回档时间,格式 YYYY-MM-DD HH:MM:SS
|
|
166
|
+
* @param modifyTableNamesInfo 回档表格信息(原表名 → 新表名映射)
|
|
167
|
+
* @param instanceId 实例ID(可选,不传则自动使用当前环境的数据库实例 ID)
|
|
168
|
+
* @returns 流程ID
|
|
169
|
+
*/
|
|
170
|
+
restoreTables(time: string, modifyTableNamesInfo: IModifyTableNamesInfo[], instanceId?: string): Promise<IRestoreTCBTablesResult>;
|
|
171
|
+
/**
|
|
172
|
+
* 执行文档型数据库命令
|
|
173
|
+
* @param options 命令参数(命令列表、可选的 Tag/EnvId/MongoConnector)
|
|
174
|
+
* @returns 执行结果,Data 为 JSON 字符串数组
|
|
175
|
+
*/
|
|
176
|
+
runCommands(options: IRunCommandsOptions): Promise<IRunCommandsResult>;
|
|
65
177
|
}
|
|
66
178
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SearchResult, ModuleDocs } from './types';
|
|
2
|
+
export declare class DocsService {
|
|
3
|
+
listModules(): Promise<string[]>;
|
|
4
|
+
/**
|
|
5
|
+
* Case: tcb docs read 快速开始
|
|
6
|
+
* 根据模块名获取该模块下的所有文档(返回嵌套的对象结构)
|
|
7
|
+
*/
|
|
8
|
+
listModuleDocs(moduleName: string): Promise<ModuleDocs>;
|
|
9
|
+
/**
|
|
10
|
+
* Case: tcb docs read <任意输入>
|
|
11
|
+
* 统一的查找入口,自动识别输入格式并返回模块数据或文档URL
|
|
12
|
+
*
|
|
13
|
+
* 支持的输入格式:
|
|
14
|
+
* 1. URL路径格式(包含 /,相对或完整): tcb docs read quick-start/create-env
|
|
15
|
+
* 2. 点分隔路径: tcb docs read 云托管.快速开始..NET 快速开始
|
|
16
|
+
* 3. 模块名: tcb docs read 快速开始 「命中第一个 底下其他同理」
|
|
17
|
+
* 4. 嵌套模块名: tcb docs read 微信生态(嵌套在"社区.最佳实践"下)
|
|
18
|
+
* 5. 文档标题: tcb docs read 小程序快速开始
|
|
19
|
+
* 6. 前缀模糊匹配: tcb docs read PHP(匹配 "PHP 快速开始")
|
|
20
|
+
*/
|
|
21
|
+
findByName(input: string): Promise<{
|
|
22
|
+
type: 'module';
|
|
23
|
+
data: ModuleDocs;
|
|
24
|
+
} | {
|
|
25
|
+
type: 'doc';
|
|
26
|
+
data: string;
|
|
27
|
+
}>;
|
|
28
|
+
readDoc(docPath: string): Promise<string>;
|
|
29
|
+
searchDocs(query: string): Promise<SearchResult[]>;
|
|
30
|
+
private getCategory;
|
|
31
|
+
private findByKeyPrefix;
|
|
32
|
+
private findByDotPath;
|
|
33
|
+
private searchDotPathInTree;
|
|
34
|
+
private matchDotPath;
|
|
35
|
+
private findNestedModule;
|
|
36
|
+
private findDocPathByTitle;
|
|
37
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type CategoryNode = string | {
|
|
2
|
+
[key: string]: CategoryNode;
|
|
3
|
+
};
|
|
4
|
+
export interface Category {
|
|
5
|
+
[key: string]: CategoryNode;
|
|
6
|
+
}
|
|
7
|
+
export interface ModuleDocs {
|
|
8
|
+
[key: string]: CategoryNode;
|
|
9
|
+
}
|
|
10
|
+
export interface DocEntry {
|
|
11
|
+
title: string;
|
|
12
|
+
path: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SearchHit {
|
|
15
|
+
url: string;
|
|
16
|
+
content: string | null;
|
|
17
|
+
type: string;
|
|
18
|
+
hierarchy: Record<string, string | null>;
|
|
19
|
+
}
|
|
20
|
+
export interface SearchResult {
|
|
21
|
+
url: string;
|
|
22
|
+
title: string;
|
|
23
|
+
content: string | null;
|
|
24
|
+
}
|
package/types/environment.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ThirdService } from './third';
|
|
|
11
11
|
import { AccessService } from './access';
|
|
12
12
|
import { UserService } from './user';
|
|
13
13
|
import { CloudBaseRunService } from './cloudBaseRun';
|
|
14
|
+
import { MysqlService } from './mysql';
|
|
14
15
|
import { EnvInfo } from './interfaces';
|
|
15
16
|
export declare class Environment {
|
|
16
17
|
inited: boolean;
|
|
@@ -29,6 +30,7 @@ export declare class Environment {
|
|
|
29
30
|
private accessService;
|
|
30
31
|
private userService;
|
|
31
32
|
private cloudBaseRunService;
|
|
33
|
+
private mysqlService;
|
|
32
34
|
constructor(context: CloudBaseContext, envId: string);
|
|
33
35
|
lazyInit(): Promise<any>;
|
|
34
36
|
getEnvId(): string;
|
|
@@ -44,6 +46,7 @@ export declare class Environment {
|
|
|
44
46
|
getAccessService(): AccessService;
|
|
45
47
|
getUserService(): UserService;
|
|
46
48
|
getCloudBaseRunService(): CloudBaseRunService;
|
|
49
|
+
getMysqlService(): MysqlService;
|
|
47
50
|
getCommonService(serviceType: string, serviceVersion: any): CommonService;
|
|
48
51
|
getServicesEnvInfo(): Promise<any>;
|
|
49
52
|
getAuthConfig(): {
|
package/types/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { ThirdService } from './third';
|
|
|
12
12
|
import { AccessService } from './access';
|
|
13
13
|
import { UserService } from './user';
|
|
14
14
|
import { CloudBaseRunService } from './cloudBaseRun';
|
|
15
|
+
import { MysqlService } from './mysql';
|
|
15
16
|
import { DocsService } from './docs';
|
|
16
17
|
interface CloudBaseConfig {
|
|
17
18
|
secretId?: string;
|
|
@@ -49,6 +50,7 @@ declare class CloudBase {
|
|
|
49
50
|
get database(): DatabaseService;
|
|
50
51
|
get hosting(): HostingService;
|
|
51
52
|
get access(): AccessService;
|
|
53
|
+
get mysql(): MysqlService;
|
|
52
54
|
get cloudApp(): CloudBaseRunService;
|
|
53
55
|
commonService(service?: string, version?: string): CommonService;
|
|
54
56
|
get env(): EnvService;
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Environment } from '../environment';
|
|
2
|
+
import { IResponseInfo } from '../interfaces';
|
|
3
|
+
import { ICreateMySQLOptions, ICreateMySQLResult, IDescribeCreateMySQLResult, IMySQLClusterDetail, IDestroyMySQLResult, IMySQLTaskStatus, IRunSqlOptions, IRunSqlResult, ICreateAccountsOptions, IDeleteAccountsOptions, IDescribeAccountsOptions, IDescribeAccountsResult, IModifyAccountDescriptionOptions, IModifyAccountHostOptions, IModifyAccountParamsOptions, IModifyAccountPrivilegesOptions, IDescribeAccountPrivilegesOptions, IDescribeAccountPrivilegesResult, IDescribeAccountAllGrantPrivilegesResult, IResetAccountPasswordOptions, IInputAccount, IWanOptions, IWanResult, ICreateBackupOptions, ICreateBackupResult, IDeleteBackupOptions, IModifyBackupConfigOptions, IDescribeBackupListOptions, IDescribeBackupListResult, IDescribeBackupDownloadUrlOptions, IDescribeBackupDownloadUrlResult, IRollBackClusterOptions, IRollBackClusterResult, IDescribeTasksOptions, IDescribeTasksResult, IDescribeClusterDatabasesOptions, IDescribeClusterDatabasesResult, IDescribeClusterDatabaseTablesOptions, IDescribeClusterDatabaseTablesResult, IDescribeClusterInstanceGroupsResult, IDescribeInstancesOptions, IDescribeInstancesResult, IRestartInstanceOptions, IRestartInstanceResult, IDescribeInstanceDetailOptions, IDescribeInstanceDetailResult, IUpgradeInstanceOptions, IUpgradeInstanceResult, IDescribeInstanceSlowQueriesOptions, IDescribeInstanceSlowQueriesResult, IDescribeInstanceErrorLogsOptions, IDescribeInstanceErrorLogsResult } from './types/index';
|
|
4
|
+
export * from './types/index';
|
|
5
|
+
export declare class MysqlService {
|
|
6
|
+
static tcbServiceVersion: {
|
|
7
|
+
service: string;
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
10
|
+
static cynosdbServiceVersion: {
|
|
11
|
+
service: string;
|
|
12
|
+
version: string;
|
|
13
|
+
};
|
|
14
|
+
private environment;
|
|
15
|
+
private envId;
|
|
16
|
+
private cynosdbService;
|
|
17
|
+
private tcbService;
|
|
18
|
+
private _clusterId;
|
|
19
|
+
private _instanceGroupId;
|
|
20
|
+
constructor(environment: Environment);
|
|
21
|
+
/**
|
|
22
|
+
* 获取集群 ID(如未手动设置,则自动通过 describeClusterDetail 获取并缓存)
|
|
23
|
+
*/
|
|
24
|
+
get clusterId(): string;
|
|
25
|
+
/**
|
|
26
|
+
* 手动设置集群 ID(适用于已知 clusterId 的场景,避免额外 API 调用)
|
|
27
|
+
*/
|
|
28
|
+
set clusterId(id: string);
|
|
29
|
+
/**
|
|
30
|
+
* 开通 MySQL
|
|
31
|
+
* 开通后可通过 describeCreateResult 查询开通结果
|
|
32
|
+
* @param options 开通参数
|
|
33
|
+
* @returns 返回包含 TaskId 的结果
|
|
34
|
+
*/
|
|
35
|
+
createMySQL(options: ICreateMySQLOptions): Promise<{
|
|
36
|
+
Data: ICreateMySQLResult;
|
|
37
|
+
} & IResponseInfo>;
|
|
38
|
+
/**
|
|
39
|
+
* 开通 MySQL 结果查询
|
|
40
|
+
* @param taskId OpenMySQL 返回的任务 ID(可选)
|
|
41
|
+
* @returns 开通结果状态
|
|
42
|
+
*/
|
|
43
|
+
describeCreateResult(taskId?: string): Promise<{
|
|
44
|
+
Data: IDescribeCreateMySQLResult;
|
|
45
|
+
} & IResponseInfo>;
|
|
46
|
+
/**
|
|
47
|
+
* 查询 MySQL 集群信息
|
|
48
|
+
* @returns MySQL 集群详情
|
|
49
|
+
*/
|
|
50
|
+
describeClusterDetail(): Promise<{
|
|
51
|
+
Data: IMySQLClusterDetail;
|
|
52
|
+
} & IResponseInfo>;
|
|
53
|
+
/**
|
|
54
|
+
* 销毁 MySQL
|
|
55
|
+
* 销毁后可通过 describeTaskStatus 查询销毁结果
|
|
56
|
+
* @returns 销毁结果(包含 TaskId、TaskName)
|
|
57
|
+
*/
|
|
58
|
+
destroyMySQL(): Promise<{
|
|
59
|
+
Data: IDestroyMySQLResult;
|
|
60
|
+
} & IResponseInfo>;
|
|
61
|
+
/**
|
|
62
|
+
* 查询 MySQL 任务状态(销毁等异步任务的结果查询)
|
|
63
|
+
* @param options 查询参数
|
|
64
|
+
* @param options.taskId 任务 ID
|
|
65
|
+
* @param options.taskName 任务名称
|
|
66
|
+
* @returns 任务状态
|
|
67
|
+
*/
|
|
68
|
+
describeTaskStatus(options?: {
|
|
69
|
+
taskId?: string;
|
|
70
|
+
taskName?: string;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
Data: IMySQLTaskStatus;
|
|
73
|
+
} & IResponseInfo>;
|
|
74
|
+
/**
|
|
75
|
+
* 执行 SQL 语句
|
|
76
|
+
* @param options SQL 执行参数
|
|
77
|
+
* @returns 查询结果(Items、Infos、RowsAffected)
|
|
78
|
+
*/
|
|
79
|
+
runSql(options: IRunSqlOptions): Promise<IRunSqlResult>;
|
|
80
|
+
/**
|
|
81
|
+
* 查询集群实例组信息
|
|
82
|
+
* 通过 CynosDB 原生接口获取真实的 InstanceGroupId 等信息
|
|
83
|
+
* @returns 实例组列表
|
|
84
|
+
*/
|
|
85
|
+
describeClusterInstanceGroups(): Promise<IDescribeClusterInstanceGroupsResult & IResponseInfo>;
|
|
86
|
+
/**
|
|
87
|
+
* 关闭外网访问
|
|
88
|
+
* @param options 实例 ID 或实例组 ID(二选一);均不传时自动获取实例组 ID
|
|
89
|
+
* @returns 任务流 ID
|
|
90
|
+
*/
|
|
91
|
+
closeWan(options?: IWanOptions): Promise<IWanResult & IResponseInfo>;
|
|
92
|
+
/**
|
|
93
|
+
* 开启外网访问
|
|
94
|
+
* @param options 实例 ID 或实例组 ID(二选一);均不传时自动获取实例组 ID
|
|
95
|
+
* @returns 任务流 ID
|
|
96
|
+
*/
|
|
97
|
+
openWan(options?: IWanOptions): Promise<IWanResult & IResponseInfo>;
|
|
98
|
+
/**
|
|
99
|
+
* 查询任务列表
|
|
100
|
+
* @param options 查询参数
|
|
101
|
+
* @returns 任务列表
|
|
102
|
+
*/
|
|
103
|
+
describeTasks(options?: IDescribeTasksOptions): Promise<IDescribeTasksResult & IResponseInfo>;
|
|
104
|
+
/**
|
|
105
|
+
* 查询实例列表
|
|
106
|
+
* @param options 查询参数(分页、排序、过滤条件等)
|
|
107
|
+
* @returns 实例列表和总数
|
|
108
|
+
*/
|
|
109
|
+
describeInstances(options?: IDescribeInstancesOptions): Promise<IDescribeInstancesResult & IResponseInfo>;
|
|
110
|
+
/**
|
|
111
|
+
* 查询实例详情
|
|
112
|
+
* @param options 包含实例 ID
|
|
113
|
+
* @returns 实例详细信息
|
|
114
|
+
*/
|
|
115
|
+
describeInstanceDetail(options: IDescribeInstanceDetailOptions): Promise<IDescribeInstanceDetailResult & IResponseInfo>;
|
|
116
|
+
/**
|
|
117
|
+
* 重启实例
|
|
118
|
+
* @param options 包含实例 ID
|
|
119
|
+
* @returns 异步任务 FlowId
|
|
120
|
+
*/
|
|
121
|
+
restartInstance(options: IRestartInstanceOptions): Promise<IRestartInstanceResult & IResponseInfo>;
|
|
122
|
+
/**
|
|
123
|
+
* 实例变配(升级/降级实例规格)
|
|
124
|
+
* @param options 变配参数(实例 ID、CPU、内存、升级类型等)
|
|
125
|
+
* @returns 订单号和冻结流水 ID
|
|
126
|
+
*/
|
|
127
|
+
upgradeInstance(options: IUpgradeInstanceOptions): Promise<IUpgradeInstanceResult & IResponseInfo>;
|
|
128
|
+
/**
|
|
129
|
+
* 查询实例慢查询日志
|
|
130
|
+
* @param options 查询参数(实例 ID、时间范围、分页、排序等)
|
|
131
|
+
* @returns 慢查询日志列表和总数
|
|
132
|
+
*/
|
|
133
|
+
describeInstanceSlowQueries(options: IDescribeInstanceSlowQueriesOptions): Promise<IDescribeInstanceSlowQueriesResult & IResponseInfo>;
|
|
134
|
+
/**
|
|
135
|
+
* 查询实例错误日志
|
|
136
|
+
* @param options 查询参数(实例 ID、时间范围、分页、排序、日志等级等)
|
|
137
|
+
* @returns 错误日志列表和总数
|
|
138
|
+
*/
|
|
139
|
+
describeInstanceErrorLogs(options: IDescribeInstanceErrorLogsOptions): Promise<IDescribeInstanceErrorLogsResult & IResponseInfo>;
|
|
140
|
+
/**
|
|
141
|
+
* 查询集群数据库列表
|
|
142
|
+
* @param options 分页参数
|
|
143
|
+
* @returns 数据库名称列表
|
|
144
|
+
*/
|
|
145
|
+
describeClusterDatabases(options?: IDescribeClusterDatabasesOptions): Promise<IDescribeClusterDatabasesResult & IResponseInfo>;
|
|
146
|
+
/**
|
|
147
|
+
* 查询集群数据库表列表
|
|
148
|
+
* @param options 查询参数(包含数据库名)
|
|
149
|
+
* @returns 数据库表列表
|
|
150
|
+
*/
|
|
151
|
+
describeClusterDatabaseTables(options: IDescribeClusterDatabaseTablesOptions): Promise<IDescribeClusterDatabaseTablesResult & IResponseInfo>;
|
|
152
|
+
/**
|
|
153
|
+
* 创建用户账号
|
|
154
|
+
* @param options 账号信息
|
|
155
|
+
* @returns RequestId
|
|
156
|
+
*/
|
|
157
|
+
createAccounts(options: ICreateAccountsOptions): Promise<IResponseInfo>;
|
|
158
|
+
/**
|
|
159
|
+
* 删除用户账号
|
|
160
|
+
* @param options 要删除的账号列表
|
|
161
|
+
* @returns RequestId
|
|
162
|
+
*/
|
|
163
|
+
deleteAccounts(options: IDeleteAccountsOptions): Promise<IResponseInfo>;
|
|
164
|
+
/**
|
|
165
|
+
* 查询账号所有可授予权限
|
|
166
|
+
* @param account 账号信息
|
|
167
|
+
* @returns 全局权限、数据库权限、表权限等
|
|
168
|
+
*/
|
|
169
|
+
describeAccountAllGrantPrivileges(account: IInputAccount): Promise<IDescribeAccountAllGrantPrivilegesResult & IResponseInfo>;
|
|
170
|
+
/**
|
|
171
|
+
* 查询数据库账号列表
|
|
172
|
+
* @param options 查询参数
|
|
173
|
+
* @returns 账号列表和总数
|
|
174
|
+
*/
|
|
175
|
+
describeAccounts(options?: IDescribeAccountsOptions): Promise<IDescribeAccountsResult & IResponseInfo>;
|
|
176
|
+
/**
|
|
177
|
+
* 查询账号已有权限
|
|
178
|
+
* @param options 查询参数
|
|
179
|
+
* @returns 权限列表
|
|
180
|
+
*/
|
|
181
|
+
describeAccountPrivileges(options: IDescribeAccountPrivilegesOptions): Promise<IDescribeAccountPrivilegesResult & IResponseInfo>;
|
|
182
|
+
/**
|
|
183
|
+
* 修改数据库账号描述信息
|
|
184
|
+
* @param options 修改参数
|
|
185
|
+
* @returns RequestId
|
|
186
|
+
*/
|
|
187
|
+
modifyAccountDescription(options: IModifyAccountDescriptionOptions): Promise<IResponseInfo>;
|
|
188
|
+
/**
|
|
189
|
+
* 修改账号主机
|
|
190
|
+
* @param options 修改参数
|
|
191
|
+
* @returns RequestId
|
|
192
|
+
*/
|
|
193
|
+
modifyAccountHost(options: IModifyAccountHostOptions): Promise<IResponseInfo>;
|
|
194
|
+
/**
|
|
195
|
+
* 修改账号配置
|
|
196
|
+
* @param options 修改参数
|
|
197
|
+
* @returns RequestId
|
|
198
|
+
*/
|
|
199
|
+
modifyAccountParams(options: IModifyAccountParamsOptions): Promise<IResponseInfo>;
|
|
200
|
+
/**
|
|
201
|
+
* 修改账号库表权限
|
|
202
|
+
* @param options 修改参数
|
|
203
|
+
* @returns RequestId
|
|
204
|
+
*/
|
|
205
|
+
modifyAccountPrivileges(options: IModifyAccountPrivilegesOptions): Promise<IResponseInfo>;
|
|
206
|
+
/**
|
|
207
|
+
* 重置数据库账号密码
|
|
208
|
+
* @param options 重置参数
|
|
209
|
+
* @returns RequestId
|
|
210
|
+
*/
|
|
211
|
+
resetAccountPassword(options: IResetAccountPasswordOptions): Promise<IResponseInfo>;
|
|
212
|
+
/**
|
|
213
|
+
* 创建手动备份
|
|
214
|
+
* @param options 备份参数
|
|
215
|
+
* @returns 异步任务流 ID
|
|
216
|
+
*/
|
|
217
|
+
createBackup(options?: ICreateBackupOptions): Promise<ICreateBackupResult & IResponseInfo>;
|
|
218
|
+
/**
|
|
219
|
+
* 删除手动备份(无法删除自动备份)
|
|
220
|
+
* @param options 要删除的备份 ID
|
|
221
|
+
* @returns RequestId
|
|
222
|
+
*/
|
|
223
|
+
deleteBackup(options: IDeleteBackupOptions): Promise<IResponseInfo>;
|
|
224
|
+
/**
|
|
225
|
+
* 修改备份配置
|
|
226
|
+
* @param options 备份配置参数
|
|
227
|
+
* @returns RequestId
|
|
228
|
+
*/
|
|
229
|
+
modifyBackupConfig(options: IModifyBackupConfigOptions): Promise<IResponseInfo>;
|
|
230
|
+
/**
|
|
231
|
+
* 查询备份文件列表
|
|
232
|
+
* @param options 查询参数
|
|
233
|
+
* @returns 备份文件列表
|
|
234
|
+
*/
|
|
235
|
+
describeBackupList(options?: IDescribeBackupListOptions): Promise<IDescribeBackupListResult & IResponseInfo>;
|
|
236
|
+
/**
|
|
237
|
+
* 查询备份下载地址
|
|
238
|
+
* @param options 备份 ID
|
|
239
|
+
* @returns 备份下载地址
|
|
240
|
+
*/
|
|
241
|
+
describeBackupDownloadUrl(options: IDescribeBackupDownloadUrlOptions): Promise<IDescribeBackupDownloadUrlResult & IResponseInfo>;
|
|
242
|
+
/**
|
|
243
|
+
* 集群回档
|
|
244
|
+
* @param options 回档参数
|
|
245
|
+
* @returns 任务流 ID
|
|
246
|
+
*/
|
|
247
|
+
rollBackCluster(options: IRollBackClusterOptions): Promise<IRollBackClusterResult & IResponseInfo>;
|
|
248
|
+
/**
|
|
249
|
+
* 确保 clusterId 已获取(内部使用,自动从集群信息中获取并缓存)
|
|
250
|
+
*/
|
|
251
|
+
private ensureClusterId;
|
|
252
|
+
/**
|
|
253
|
+
* 确保 instanceGroupId 已获取(内部使用,通过 CynosDB 原生接口获取真实值并缓存)
|
|
254
|
+
*/
|
|
255
|
+
private ensureInstanceGroupId;
|
|
256
|
+
/**
|
|
257
|
+
* 解析 Wan 操作的请求参数
|
|
258
|
+
* 若用户未显式传入 InstanceId / InstanceGroupId,则自动获取实例组 ID
|
|
259
|
+
*/
|
|
260
|
+
private resolveWanParams;
|
|
261
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/** 账号输入信息(用于删除、查询权限等操作) */
|
|
2
|
+
export interface IInputAccount {
|
|
3
|
+
/** 账号名称 */
|
|
4
|
+
AccountName: string;
|
|
5
|
+
/** 主机,默认 '%' */
|
|
6
|
+
Host?: string;
|
|
7
|
+
}
|
|
8
|
+
/** 新建账号信息 */
|
|
9
|
+
export interface INewAccount {
|
|
10
|
+
/** 账号名称 */
|
|
11
|
+
AccountName: string;
|
|
12
|
+
/** 账号密码(8-64个字符,包含大小写英文字母、数字和符号) */
|
|
13
|
+
AccountPassword: string;
|
|
14
|
+
/** 允许访问的主机,可以是 IP 或 '%' */
|
|
15
|
+
Host: string;
|
|
16
|
+
/** 账号描述 */
|
|
17
|
+
Description?: string;
|
|
18
|
+
/** 用户最大连接数限制 */
|
|
19
|
+
MaxUserConnections?: number;
|
|
20
|
+
}
|
|
21
|
+
/** 创建账号请求参数 */
|
|
22
|
+
export interface ICreateAccountsOptions {
|
|
23
|
+
/** 新账户列表 */
|
|
24
|
+
Accounts: INewAccount[];
|
|
25
|
+
}
|
|
26
|
+
/** 删除账号请求参数 */
|
|
27
|
+
export interface IDeleteAccountsOptions {
|
|
28
|
+
/** 账号数组 */
|
|
29
|
+
Accounts?: IInputAccount[];
|
|
30
|
+
}
|
|
31
|
+
/** 查询账号列表请求参数 */
|
|
32
|
+
export interface IDescribeAccountsOptions {
|
|
33
|
+
/** 需要过滤的账户列表 */
|
|
34
|
+
AccountNames?: string[];
|
|
35
|
+
/** 需要过滤的主机列表 */
|
|
36
|
+
Hosts?: string[];
|
|
37
|
+
/** 限制量 */
|
|
38
|
+
Limit?: number;
|
|
39
|
+
/** 偏移量 */
|
|
40
|
+
Offset?: number;
|
|
41
|
+
/** 模糊匹配关键字(同时匹配 AccountName 和 Host,支持正则) */
|
|
42
|
+
AccountRegular?: string;
|
|
43
|
+
}
|
|
44
|
+
/** 账号信息 */
|
|
45
|
+
export interface IAccountInfo {
|
|
46
|
+
/** 账号名称 */
|
|
47
|
+
AccountName: string;
|
|
48
|
+
/** 账号描述 */
|
|
49
|
+
Description: string;
|
|
50
|
+
/** 创建时间 */
|
|
51
|
+
CreateTime: string;
|
|
52
|
+
/** 更新时间 */
|
|
53
|
+
UpdateTime: string;
|
|
54
|
+
/** 主机 */
|
|
55
|
+
Host: string;
|
|
56
|
+
/** 最大用户连接数 */
|
|
57
|
+
MaxUserConnections: number;
|
|
58
|
+
}
|
|
59
|
+
/** 查询账号列表返回结果 */
|
|
60
|
+
export interface IDescribeAccountsResult {
|
|
61
|
+
/** 账号列表 */
|
|
62
|
+
AccountSet: IAccountInfo[];
|
|
63
|
+
/** 账号总数 */
|
|
64
|
+
TotalCount: number;
|
|
65
|
+
}
|
|
66
|
+
/** 修改账号描述请求参数 */
|
|
67
|
+
export interface IModifyAccountDescriptionOptions {
|
|
68
|
+
/** 账号名称 */
|
|
69
|
+
AccountName: string;
|
|
70
|
+
/** 新的描述信息 */
|
|
71
|
+
Description: string;
|
|
72
|
+
/** 主机,默认 '%' */
|
|
73
|
+
Host?: string;
|
|
74
|
+
}
|
|
75
|
+
/** 修改账号主机请求参数 */
|
|
76
|
+
export interface IModifyAccountHostOptions {
|
|
77
|
+
/** 账号信息 */
|
|
78
|
+
Account: IInputAccount;
|
|
79
|
+
/** 新主机 */
|
|
80
|
+
NewHost: string;
|
|
81
|
+
}
|
|
82
|
+
/** 账号参数项 */
|
|
83
|
+
export interface IAccountParamItem {
|
|
84
|
+
/** 参数名称 */
|
|
85
|
+
ParamName: string;
|
|
86
|
+
/** 参数值 */
|
|
87
|
+
ParamValue: string;
|
|
88
|
+
}
|
|
89
|
+
/** 修改账号配置请求参数 */
|
|
90
|
+
export interface IModifyAccountParamsOptions {
|
|
91
|
+
/** 账号信息 */
|
|
92
|
+
Account: IInputAccount;
|
|
93
|
+
/** 账号参数列表 */
|
|
94
|
+
AccountParams: IAccountParamItem[];
|
|
95
|
+
}
|
|
96
|
+
/** 数据库权限 */
|
|
97
|
+
export interface IDatabasePrivilege {
|
|
98
|
+
/** 数据库名 */
|
|
99
|
+
Db: string;
|
|
100
|
+
/** 权限列表 */
|
|
101
|
+
Privileges: string[];
|
|
102
|
+
}
|
|
103
|
+
/** 表权限 */
|
|
104
|
+
export interface ITablePrivilege {
|
|
105
|
+
/** 数据库名 */
|
|
106
|
+
Db: string;
|
|
107
|
+
/** 表名 */
|
|
108
|
+
TableName: string;
|
|
109
|
+
/** 权限列表 */
|
|
110
|
+
Privileges: string[];
|
|
111
|
+
}
|
|
112
|
+
/** 修改账号权限请求参数 */
|
|
113
|
+
export interface IModifyAccountPrivilegesOptions {
|
|
114
|
+
/** 账号信息 */
|
|
115
|
+
Account: IInputAccount;
|
|
116
|
+
/** 全局权限 */
|
|
117
|
+
GlobalPrivileges?: string[];
|
|
118
|
+
/** 数据库权限 */
|
|
119
|
+
DatabasePrivileges?: IDatabasePrivilege[];
|
|
120
|
+
/** 表权限 */
|
|
121
|
+
TablePrivileges?: ITablePrivilege[];
|
|
122
|
+
}
|
|
123
|
+
/** 查询账号已有权限请求参数 */
|
|
124
|
+
export interface IDescribeAccountPrivilegesOptions {
|
|
125
|
+
/** 账号名 */
|
|
126
|
+
AccountName: string;
|
|
127
|
+
/** 主机 */
|
|
128
|
+
Host: string;
|
|
129
|
+
/** 数据库名,为 '*' 时忽略 Type/TableName,表示修改用户全局权限 */
|
|
130
|
+
Db: string;
|
|
131
|
+
/** 指定数据库下的对象类型,可选 'table' 或 '*' */
|
|
132
|
+
Type: string;
|
|
133
|
+
/** 当 Type='table' 时,用来指定表名 */
|
|
134
|
+
TableName?: string;
|
|
135
|
+
}
|
|
136
|
+
/** 查询账号已有权限返回结果 */
|
|
137
|
+
export interface IDescribeAccountPrivilegesResult {
|
|
138
|
+
/** 权限列表 */
|
|
139
|
+
Privileges: string[];
|
|
140
|
+
}
|
|
141
|
+
/** 查询账号所有可授予权限返回结果 */
|
|
142
|
+
export interface IDescribeAccountAllGrantPrivilegesResult {
|
|
143
|
+
/** 权限语句 */
|
|
144
|
+
PrivilegeStatements: string[];
|
|
145
|
+
/** 全局权限 */
|
|
146
|
+
GlobalPrivileges: string[];
|
|
147
|
+
/** 数据库权限 */
|
|
148
|
+
DatabasePrivileges: IDatabasePrivilege[];
|
|
149
|
+
/** 表权限 */
|
|
150
|
+
TablePrivileges: ITablePrivilege[];
|
|
151
|
+
}
|
|
152
|
+
/** 重置账号密码请求参数 */
|
|
153
|
+
export interface IResetAccountPasswordOptions {
|
|
154
|
+
/** 账号名称 */
|
|
155
|
+
AccountName: string;
|
|
156
|
+
/** 新密码 */
|
|
157
|
+
AccountPassword: string;
|
|
158
|
+
/** 主机,默认 '%' */
|
|
159
|
+
Host?: string;
|
|
160
|
+
}
|