2024-11-04 15:14:56 +08:00
|
|
|
|
import { HttpClient, ILogger, utils } from "@certd/basic";
|
|
|
|
|
|
import { IAccess, Registrable } from "@certd/pipeline";
|
2022-10-26 09:02:47 +08:00
|
|
|
|
|
|
|
|
|
|
export type DnsProviderDefine = Registrable & {
|
|
|
|
|
|
accessType: string;
|
2024-11-30 01:57:09 +08:00
|
|
|
|
icon?: string;
|
2023-01-11 20:39:48 +08:00
|
|
|
|
autowire?: {
|
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
|
};
|
2022-10-26 09:02:47 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type CreateRecordOptions = {
|
2024-10-07 03:21:16 +08:00
|
|
|
|
domain: string;
|
2022-10-26 09:02:47 +08:00
|
|
|
|
fullRecord: string;
|
2024-10-07 03:21:16 +08:00
|
|
|
|
hostRecord: string;
|
2022-10-26 09:02:47 +08:00
|
|
|
|
type: string;
|
|
|
|
|
|
value: any;
|
|
|
|
|
|
};
|
2024-10-07 03:21:16 +08:00
|
|
|
|
export type RemoveRecordOptions<T> = {
|
|
|
|
|
|
recordReq: CreateRecordOptions;
|
2024-06-15 02:17:34 +08:00
|
|
|
|
// 本次创建的dns解析记录,实际上就是createRecord接口的返回值
|
2024-10-07 03:21:16 +08:00
|
|
|
|
recordRes: T;
|
2022-10-26 09:02:47 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-14 01:22:07 +08:00
|
|
|
|
export type DnsProviderContext = {
|
|
|
|
|
|
access: IAccess;
|
|
|
|
|
|
logger: ILogger;
|
|
|
|
|
|
http: HttpClient;
|
2024-10-01 23:34:01 +08:00
|
|
|
|
utils: typeof utils;
|
2024-06-14 01:22:07 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2024-06-15 02:17:34 +08:00
|
|
|
|
export interface IDnsProvider<T = any> {
|
2023-05-09 10:16:49 +08:00
|
|
|
|
onInstance(): Promise<void>;
|
2024-06-15 02:17:34 +08:00
|
|
|
|
createRecord(options: CreateRecordOptions): Promise<T>;
|
|
|
|
|
|
removeRecord(options: RemoveRecordOptions<T>): Promise<void>;
|
2024-06-14 01:22:07 +08:00
|
|
|
|
setCtx(ctx: DnsProviderContext): void;
|
2022-10-26 09:02:47 +08:00
|
|
|
|
}
|