mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
feat: midway注解方式编写插件
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IsAccess, IsAccessInput } from "@certd/pipeline";
|
||||
import { IsAccess, AccessInput } from "@certd/pipeline";
|
||||
|
||||
@IsAccess({
|
||||
name: "dnspod",
|
||||
@@ -6,7 +6,7 @@ import { IsAccess, IsAccessInput } from "@certd/pipeline";
|
||||
desc: "腾讯云的域名解析接口已迁移到dnspod",
|
||||
})
|
||||
export class DnspodAccess {
|
||||
@IsAccessInput({
|
||||
@AccessInput({
|
||||
title: "token",
|
||||
component: {
|
||||
placeholder: "开放接口token",
|
||||
@@ -14,7 +14,7 @@ export class DnspodAccess {
|
||||
rules: [{ required: true, message: "该项必填" }],
|
||||
})
|
||||
token = "";
|
||||
@IsAccessInput({
|
||||
@AccessInput({
|
||||
title: "账户id",
|
||||
component: {
|
||||
placeholder: "dnspod接口账户id",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { IsAccess, IsAccessInput } from "@certd/pipeline";
|
||||
import { IsAccess, AccessInput } from "@certd/pipeline";
|
||||
|
||||
@IsAccess({
|
||||
name: "tencent",
|
||||
title: "腾讯云",
|
||||
})
|
||||
export class TencentAccess {
|
||||
@IsAccessInput({
|
||||
@AccessInput({
|
||||
title: "secretId",
|
||||
component: {
|
||||
placeholder: "secretId",
|
||||
@@ -13,7 +13,7 @@ export class TencentAccess {
|
||||
rules: [{ required: true, message: "该项必填" }],
|
||||
})
|
||||
secretId = "";
|
||||
@IsAccessInput({
|
||||
@AccessInput({
|
||||
title: "secretKey",
|
||||
component: {
|
||||
placeholder: "secretKey",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { CreateRecordOptions, HttpClient, IDnsProvider, IsDnsProvider, RemoveRecordOptions } from "@certd/pipeline";
|
||||
import { Autowire, HttpClient, ILogger } from "@certd/pipeline";
|
||||
import { CreateRecordOptions, IDnsProvider, IsDnsProvider, RemoveRecordOptions } from "@certd/plugin-cert";
|
||||
import _ from "lodash";
|
||||
import { DnspodAccess } from "../access";
|
||||
import { Inject } from "@midwayjs/decorator";
|
||||
import { ILogger } from "@midwayjs/core";
|
||||
|
||||
@IsDnsProvider({
|
||||
name: "dnspod",
|
||||
@@ -11,12 +10,12 @@ import { ILogger } from "@midwayjs/core";
|
||||
accessType: "dnspod",
|
||||
})
|
||||
export class DnspodDnsProvider implements IDnsProvider {
|
||||
@Inject()
|
||||
@Autowire()
|
||||
http!: HttpClient;
|
||||
|
||||
@Inject()
|
||||
@Autowire()
|
||||
access!: DnspodAccess;
|
||||
@Inject()
|
||||
@Autowire()
|
||||
logger!: ILogger;
|
||||
|
||||
loginToken: any;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { IAccessService, IsTaskPlugin, RunStrategy, TaskInput, ITaskPlugin, LOGGER } from "@certd/pipeline";
|
||||
import { Autowire, IAccessService, IsTaskPlugin, ITaskPlugin, ILogger, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import tencentcloud from "tencentcloud-sdk-nodejs/index";
|
||||
import { TencentAccess } from "../../access";
|
||||
import { Inject } from "@midwayjs/decorator";
|
||||
import { CertInfo } from "@certd/plugin-cert";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "DeployCertToTencentCDN",
|
||||
@@ -22,7 +22,7 @@ export class DeployToCdnPlugin implements ITaskPlugin {
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
cert!: any;
|
||||
cert!: CertInfo;
|
||||
|
||||
@TaskInput({
|
||||
title: "Access提供者",
|
||||
@@ -47,11 +47,11 @@ export class DeployToCdnPlugin implements ITaskPlugin {
|
||||
})
|
||||
domainName!: string;
|
||||
|
||||
@Inject()
|
||||
@Autowire()
|
||||
accessService!: IAccessService;
|
||||
|
||||
@Inject()
|
||||
logger!: LOGGER;
|
||||
@Autowire()
|
||||
logger!: ILogger;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
async onInit() {}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { IAccessService, IsTaskPlugin, ITaskPlugin, LOGGER, RunStrategy, TaskInput, utils } from "@certd/pipeline";
|
||||
import { Autowire, IAccessService, IsTaskPlugin, ITaskPlugin, ILogger, RunStrategy, TaskInput, utils } from "@certd/pipeline";
|
||||
import tencentcloud from "tencentcloud-sdk-nodejs/index";
|
||||
import { TencentAccess } from "../../access";
|
||||
import dayjs from "dayjs";
|
||||
import { Inject } from "@midwayjs/decorator";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "DeployCertToTencentCLB",
|
||||
@@ -72,11 +71,11 @@ export class DeployToClbPlugin implements ITaskPlugin {
|
||||
})
|
||||
accessId!: string;
|
||||
|
||||
@Inject()
|
||||
@Autowire()
|
||||
accessService!: IAccessService;
|
||||
|
||||
@Inject()
|
||||
logger!: LOGGER;
|
||||
@Autowire()
|
||||
logger!: ILogger;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
async onInit() {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Autowire, IAccessService, IsTaskPlugin, ITaskPlugin, RunStrategy, TaskInput, TaskOutput, LOGGER } from "@certd/pipeline";
|
||||
import { Autowire, IAccessService, IsTaskPlugin, ITaskPlugin, RunStrategy, TaskInput, TaskOutput, ILogger } from "@certd/pipeline";
|
||||
import tencentcloud from "tencentcloud-sdk-nodejs/index";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
@@ -46,7 +46,7 @@ export class UploadToTencentPlugin implements ITaskPlugin {
|
||||
accessService!: IAccessService;
|
||||
|
||||
@Autowire()
|
||||
logger!: LOGGER;
|
||||
logger!: ILogger;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
async onInit() {}
|
||||
|
||||
Reference in New Issue
Block a user