2024-06-14 01:22:07 +08:00
|
|
|
|
import { HttpClient, IAccess, ILogger, Registrable } from "@certd/pipeline";
|
2022-10-26 09:02:47 +08:00
|
|
|
|
|
|
|
|
|
|
export type DnsProviderDefine = Registrable & {
|
|
|
|
|
|
accessType: string;
|
2023-01-11 20:39:48 +08:00
|
|
|
|
autowire?: {
|
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
|
};
|
2022-10-26 09:02:47 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export type CreateRecordOptions = {
|
|
|
|
|
|
fullRecord: string;
|
|
|
|
|
|
type: string;
|
|
|
|
|
|
value: any;
|
2024-06-14 01:22:07 +08:00
|
|
|
|
domain: string;
|
2022-10-26 09:02:47 +08:00
|
|
|
|
};
|
2024-06-15 02:17:34 +08:00
|
|
|
|
export type RemoveRecordOptions<T> = CreateRecordOptions & {
|
|
|
|
|
|
// 本次创建的dns解析记录,实际上就是createRecord接口的返回值
|
|
|
|
|
|
record: 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-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
|
|
|
|
}
|