mirror of
https://github.com/certd/certd.git
synced 2026-06-27 14:07:33 +08:00
feat: 通过插件配置懒加载依赖,动态加载第三方依赖包,精简安装镜像大小
This commit is contained in:
@@ -8,6 +8,9 @@ import { TencentAccess } from "../../plugin-lib/tencent/access.js";
|
||||
title: "腾讯云验证码",
|
||||
desc: "",
|
||||
showTest: false,
|
||||
dependPackages: {
|
||||
"tencentcloud-sdk-nodejs": "^4.1.112",
|
||||
},
|
||||
})
|
||||
export class TencentCaptcha extends BaseAddon implements ICaptchaAddon {
|
||||
@AddonInput({
|
||||
@@ -50,7 +53,7 @@ export class TencentCaptcha extends BaseAddon implements ICaptchaAddon {
|
||||
|
||||
const access = await this.getAccess<TencentAccess>(this.accessId);
|
||||
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/captcha/v20190722/index.js");
|
||||
const sdk = await this.importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/captcha/v20190722/index.js");
|
||||
|
||||
const CaptchaClient = sdk.v20190722.Client;
|
||||
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import { IsAccess, AccessInput, BaseAccess } from "@certd/pipeline";
|
||||
|
||||
@IsAccess({
|
||||
const tencentAccessDefine: any = {
|
||||
name: "tencent",
|
||||
title: "腾讯云",
|
||||
icon: "svg:icon-tencentcloud",
|
||||
order: 0,
|
||||
})
|
||||
dependPackages: {
|
||||
"tencentcloud-sdk-nodejs": "^4.1.112",
|
||||
},
|
||||
};
|
||||
|
||||
@IsAccess(tencentAccessDefine)
|
||||
export class TencentAccess extends BaseAccess {
|
||||
@AccessInput({
|
||||
title: "secretId",
|
||||
@@ -104,7 +109,7 @@ export class TencentAccess extends BaseAccess {
|
||||
}
|
||||
|
||||
async getStsClient() {
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/sts/v20180813/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/sts/v20180813/index.js");
|
||||
const StsClient = sdk.v20180813.Client;
|
||||
|
||||
const clientConfig = {
|
||||
|
||||
@@ -15,7 +15,7 @@ export class TencentSslClient {
|
||||
this.region = opts.region;
|
||||
}
|
||||
async getSslClient(): Promise<any> {
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js");
|
||||
const sdk = await this.access.importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js");
|
||||
const SslClient = sdk.v20191205.Client;
|
||||
|
||||
const clientConfig = {
|
||||
|
||||
+8
-3
@@ -2,13 +2,18 @@ import { AbstractDnsProvider, CreateRecordOptions, DnsResolveRecord, DomainRecor
|
||||
import { TencentAccess } from "../../plugin-lib/tencent/index.js";
|
||||
import { Pager, PageRes, PageSearch } from "@certd/pipeline";
|
||||
|
||||
@IsDnsProvider({
|
||||
const tencentDnsProviderDefine: any = {
|
||||
name: "tencent",
|
||||
title: "腾讯云",
|
||||
desc: "腾讯云域名DNS解析提供者",
|
||||
accessType: "tencent",
|
||||
icon: "svg:icon-tencentcloud",
|
||||
})
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
};
|
||||
|
||||
@IsDnsProvider(tencentDnsProviderDefine)
|
||||
export class TencentDnsProvider extends AbstractDnsProvider {
|
||||
access!: TencentAccess;
|
||||
|
||||
@@ -27,7 +32,7 @@ export class TencentDnsProvider extends AbstractDnsProvider {
|
||||
},
|
||||
},
|
||||
};
|
||||
const dnspodSdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/dnspod/v20210323/index.js");
|
||||
const dnspodSdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/dnspod/v20210323/index.js");
|
||||
const DnspodClient = dnspodSdk.v20210323.Client;
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
this.client = new DnspodClient(clientConfig);
|
||||
|
||||
+4
-1
@@ -7,6 +7,9 @@ import { TencentAccess } from "../../plugin-lib/tencent/access.js";
|
||||
desc: "腾讯云EO DNS解析提供者",
|
||||
accessType: "tencent",
|
||||
icon: "svg:icon-tencentcloud",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
})
|
||||
export class TencentEoDnsProvider extends AbstractDnsProvider {
|
||||
access!: TencentAccess;
|
||||
@@ -24,7 +27,7 @@ export class TencentEoDnsProvider extends AbstractDnsProvider {
|
||||
},
|
||||
},
|
||||
};
|
||||
const teosdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/teo/v20220901/index.js");
|
||||
const teosdk = await this.importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/teo/v20220901/index.js");
|
||||
const TeoClient = teosdk.v20220901.Client;
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
this.client = new TeoClient(clientConfig);
|
||||
|
||||
+3
@@ -10,6 +10,9 @@ import { TencentAccess, TencentSslClient } from "../../../plugin-lib/tencent/ind
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "仅删除未使用的证书",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.AlwaysRun,
|
||||
|
||||
@@ -9,6 +9,9 @@ import { TencentSslClient } from "../../../plugin-lib/tencent/index.js";
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "支持负载均衡、CDN、DDoS、直播、点播、Web应用防火墙、API网关、TEO、容器服务、对象存储、轻应用服务器、云原生微服务、云开发",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -108,7 +111,7 @@ export class DeployCertToTencentAll extends AbstractTaskPlugin {
|
||||
async execute(): Promise<void> {
|
||||
const access = await this.getAccess(this.accessId);
|
||||
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js");
|
||||
const Client = sdk.v20191205.Client;
|
||||
const client = new Client({
|
||||
credential: {
|
||||
|
||||
+4
-2
@@ -9,6 +9,9 @@ import { CertApplyPluginNames } from "@certd/plugin-cert";
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "推荐使用,支持CDN域名以及COS加速域名",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -29,7 +32,6 @@ export class TencentDeployCertToCDNv2 extends AbstractTaskPlugin {
|
||||
|
||||
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
|
||||
certDomains!: string[];
|
||||
|
||||
@TaskInput({
|
||||
title: "Access提供者",
|
||||
helper: "access 授权",
|
||||
@@ -89,7 +91,7 @@ export class TencentDeployCertToCDNv2 extends AbstractTaskPlugin {
|
||||
|
||||
async getCdnClient() {
|
||||
const accessProvider = await this.getAccess<TencentAccess>(this.accessId);
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/cdn/v20180606/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/cdn/v20180606/index.js");
|
||||
const CdnClient = sdk.v20180606.Client;
|
||||
|
||||
const clientConfig = {
|
||||
|
||||
@@ -8,6 +8,9 @@ import { CertApplyPluginNames } from "@certd/plugin-cert";
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "已废弃,请使用v2版",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -63,7 +66,7 @@ export class DeployToCdnPlugin extends AbstractTaskPlugin {
|
||||
Client: any;
|
||||
|
||||
async onInstance() {
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/cdn/v20180606/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/cdn/v20180606/index.js");
|
||||
this.Client = sdk.v20180606.Client;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "暂时只支持单向认证证书,暂时只支持通用负载均衡",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -106,7 +109,7 @@ export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
||||
}
|
||||
|
||||
async getClient() {
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/clb/v20180317/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/clb/v20180317/index.js");
|
||||
const ClbClient = sdk.v20180317.Client;
|
||||
|
||||
const accessProvider = (await this.getAccess(this.accessId)) as TencentAccess;
|
||||
|
||||
@@ -3,19 +3,28 @@ import { CertInfo } from "@certd/plugin-cert";
|
||||
import { createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
import { TencentSslClient } from "../../../plugin-lib/tencent/index.js";
|
||||
import { CertApplyPluginNames } from "@certd/plugin-cert";
|
||||
@IsTaskPlugin({
|
||||
|
||||
const deployCertToTencentCosDefine: any = {
|
||||
name: "DeployCertToTencentCosPlugin",
|
||||
title: "腾讯云-部署证书到COS",
|
||||
needPlus: false,
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "部署到腾讯云COS源站域名证书,注意是源站域名,加速域名请使用腾讯云CDN v2插件【注意:很不稳定,需要重试很多次偶尔才能成功一次】",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
dependPackages: {
|
||||
"cos-nodejs-sdk-v5": "^2.14.6",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
},
|
||||
},
|
||||
})
|
||||
};
|
||||
|
||||
@IsTaskPlugin(deployCertToTencentCosDefine)
|
||||
export class DeployCertToTencentCosPlugin extends AbstractTaskPlugin {
|
||||
/**
|
||||
* AccessProvider的id
|
||||
@@ -133,7 +142,7 @@ export class DeployCertToTencentCosPlugin extends AbstractTaskPlugin {
|
||||
async onGetDomainList(data: any) {
|
||||
const access = await this.getAccess(this.accessId);
|
||||
|
||||
const cosv5 = await import("cos-nodejs-sdk-v5");
|
||||
const cosv5 = await (this as any).importRuntime("cos-nodejs-sdk-v5");
|
||||
const cos = new cosv5.default({
|
||||
SecretId: access.secretId,
|
||||
SecretKey: access.secretKey,
|
||||
|
||||
@@ -11,6 +11,9 @@ import { TencentSslClient } from "../../../plugin-lib/tencent/index.js";
|
||||
icon: "svg:icon-tencentcloud",
|
||||
desc: "腾讯云边缘安全加速平台EdgeOne(EO)",
|
||||
group: pluginGroups.tencent.key,
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -85,7 +88,7 @@ export class DeployCertToTencentEO extends AbstractTaskPlugin {
|
||||
Client: any;
|
||||
|
||||
async onInstance() {
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/teo/v20220901/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/teo/v20220901/index.js");
|
||||
this.Client = sdk.v20220901.Client;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ import { TencentSslClient } from "../../../plugin-lib/tencent/index.js";
|
||||
desc: "https://console.cloud.tencent.com/live/",
|
||||
group: pluginGroups.tencent.key,
|
||||
needPlus: false,
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -92,7 +95,7 @@ export class TencentDeployCertToLive extends AbstractTaskPlugin {
|
||||
|
||||
async getLiveClient() {
|
||||
const accessProvider = await this.getAccess<TencentAccess>(this.accessId);
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/live/v20180801/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/live/v20180801/index.js");
|
||||
const CssClient = sdk.v20180801.Client;
|
||||
|
||||
const clientConfig = {
|
||||
|
||||
+4
-1
@@ -11,6 +11,9 @@ import yaml from "js-yaml";
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "修改TKE集群密钥配置,支持Opaque和TLS证书类型。注意:\n1. serverless集群请使用K8S部署插件;\n2. Opaque类型需要【上传到腾讯云】作为前置任务;\n3. ApiServer需要开通公网访问(或者certd可访问),实际上底层仍然是通过KubeClient进行部署",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
@@ -203,7 +206,7 @@ export class DeployCertToTencentTKEIngressPlugin extends AbstractTaskPlugin {
|
||||
}
|
||||
|
||||
async getTkeClient(accessProvider: any, region = "ap-guangzhou") {
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/tke/v20180525/index.js");
|
||||
const sdk = await this.importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/tke/v20180525/index.js");
|
||||
const TkeClient = sdk.v20180525.Client;
|
||||
const clientConfig = {
|
||||
credential: {
|
||||
|
||||
@@ -14,6 +14,9 @@ import { omit } from "lodash-es";
|
||||
group: pluginGroups.tencent.key,
|
||||
needPlus: false,
|
||||
deprecated: "腾讯更新证书(Id不变)接口已失效,本插件已下架,请使用其他接口",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
//默认值配置照抄即可
|
||||
strategy: {
|
||||
|
||||
@@ -8,6 +8,9 @@ import { TencentAccess } from "../../../plugin-lib/tencent/access.js";
|
||||
icon: "svg:icon-tencentcloud",
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: "腾讯云实例开关机",
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.AlwaysRun,
|
||||
@@ -137,7 +140,7 @@ export class TencentActionInstancesPlugin extends AbstractTaskPlugin {
|
||||
|
||||
async getCvmClient() {
|
||||
const accessProvider = await this.getAccess<TencentAccess>(this.accessId);
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/cvm/v20170312/index.js");
|
||||
const sdk = await this.importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/cvm/v20170312/index.js");
|
||||
const CvmClient = sdk.v20170312.Client;
|
||||
|
||||
if (!this.region) {
|
||||
|
||||
+8
-3
@@ -3,18 +3,23 @@ import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
|
||||
import { TencentAccess } from "../../../plugin-lib/tencent/access.js";
|
||||
import { TencentSslClient } from "../../../plugin-lib/tencent/index.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
const uploadCertToTencentDefine: any = {
|
||||
name: "UploadCertToTencent",
|
||||
title: "腾讯云-上传证书到腾讯云",
|
||||
icon: "svg:icon-tencentcloud",
|
||||
desc: "上传成功后输出:tencentCertId",
|
||||
group: pluginGroups.tencent.key,
|
||||
dependPlugins: {
|
||||
"access:tencent": "*",
|
||||
},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
},
|
||||
},
|
||||
})
|
||||
};
|
||||
|
||||
@IsTaskPlugin(uploadCertToTencentDefine)
|
||||
export class UploadCertToTencent extends AbstractTaskPlugin {
|
||||
// @TaskInput({ title: '证书名称' })
|
||||
// name!: string;
|
||||
@@ -48,7 +53,7 @@ export class UploadCertToTencent extends AbstractTaskPlugin {
|
||||
|
||||
Client: any;
|
||||
async onInstance() {
|
||||
const sdk = await import("tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js");
|
||||
const sdk = await (this as any).importRuntime("tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js");
|
||||
this.Client = sdk.v20191205.Client;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user