Files
certd/packages/plugins/plugin-cert/src/dns-provider/api.ts

38 lines
916 B
TypeScript
Raw Normal View History

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 = {
domain: string;
2022-10-26 09:02:47 +08:00
fullRecord: string;
hostRecord: string;
2022-10-26 09:02:47 +08:00
type: string;
value: any;
};
export type RemoveRecordOptions<T> = {
recordReq: CreateRecordOptions;
2024-06-15 02:17:34 +08:00
// 本次创建的dns解析记录实际上就是createRecord接口的返回值
recordRes: T;
2022-10-26 09:02:47 +08:00
};
export type DnsProviderContext = {
access: IAccess;
logger: ILogger;
http: HttpClient;
utils: typeof utils;
};
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>;
setCtx(ctx: DnsProviderContext): void;
2022-10-26 09:02:47 +08:00
}