mirror of
https://github.com/certd/certd.git
synced 2026-04-23 11:37:23 +08:00
feat: 【破坏性更新】插件改为metadata加载模式,plugin-cert、plugin-lib包部分代码转移到certd-server中,影响自定义插件,需要修改相关import引用
ssh、aliyun、tencent、qiniu、oss等 access和client需要转移import
This commit is contained in:
@@ -0,0 +1,277 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { utils } from "@certd/basic";
|
||||
|
||||
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
|
||||
import { AliyunAccess, AliyunClient } from "../../../plugin-lib/aliyun/index.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "DeployCertToAliyunAck",
|
||||
title: "阿里云-部署到Ack",
|
||||
icon: "svg:icon-aliyun",
|
||||
desc: "部署到阿里云Ack集群Ingress等通过Secret管理证书的应用",
|
||||
group: pluginGroups.aliyun.key,
|
||||
needPlus: false,
|
||||
input: {},
|
||||
output: {},
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
},
|
||||
},
|
||||
})
|
||||
export class DeployCertToAliyunAckPlugin extends AbstractTaskPlugin {
|
||||
@TaskInput({
|
||||
title: "域名证书",
|
||||
helper: "请选择前置任务输出的域名证书",
|
||||
component: {
|
||||
name: "output-selector",
|
||||
from: [...CertApplyPluginNames],
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
cert!: CertInfo;
|
||||
@TaskInput({
|
||||
title: "Access授权",
|
||||
helper: "阿里云授权AccessKeyId、AccessKeySecret",
|
||||
component: {
|
||||
name: "access-selector",
|
||||
type: "aliyun",
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
accessId!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: "大区",
|
||||
component: {
|
||||
name: "a-auto-complete",
|
||||
vModel: "value",
|
||||
options: [
|
||||
{ value: "cn-qingdao", label: "华北1(青岛)" },
|
||||
{ value: "cn-beijing", label: "华北2(北京)" },
|
||||
{ value: "cn-zhangjiakou", label: "华北3(张家口)" },
|
||||
{ value: "cn-huhehaote", label: "华北5(呼和浩特)" },
|
||||
{ value: "cn-wulanchabu", label: "华北6(乌兰察布)" },
|
||||
{ value: "cn-hangzhou", label: "华东1(杭州)" },
|
||||
{ value: "cn-shanghai", label: "华东2(上海)" },
|
||||
{ value: "cn-shenzhen", label: "华南1(深圳)" },
|
||||
{ value: "cn-guangzhou", label: "华南3(广州)" },
|
||||
{ value: "ap-southeast-2", label: "澳大利亚(悉尼)" },
|
||||
{ value: "ap-southeast-3", label: "马来西亚(吉隆坡)" },
|
||||
{ value: "ap-northeast-1", label: "日本(东京)" },
|
||||
{ value: "cn-chengdu", label: "西南1(成都)" },
|
||||
{ value: "ap-southeast-1", label: "新加坡" },
|
||||
{ value: "ap-southeast-5", label: "印度尼西亚(雅加达)" },
|
||||
{ value: "cn-hongkong", label: "中国香港" },
|
||||
{ value: "eu-central-1", label: "德国(法兰克福)" },
|
||||
{ value: "us-east-1", label: "美国(弗吉尼亚)" },
|
||||
{ value: "us-west-1", label: "美国(硅谷)" },
|
||||
{ value: "eu-west-1", label: "英国(伦敦)" },
|
||||
{ value: "me-east-1", label: "阿联酋(迪拜)" },
|
||||
//金融云
|
||||
{ value: "cn-beijing-finance-1", label: "华北2 金融云(邀测)" },
|
||||
{ value: "cn-hangzhou-finance", label: "华东1 金融云" },
|
||||
{ value: "cn-shanghai-finance-1", label: "华东2 金融云" },
|
||||
{ value: "cn-shenzhen-finance-1", label: "华南1 金融云" },
|
||||
],
|
||||
placeholder: "集群所属大区",
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
regionId!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: "集群id",
|
||||
component: {
|
||||
placeholder: "集群id",
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
clusterId!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: "保密字典Id",
|
||||
component: {
|
||||
placeholder: "保密字典Id",
|
||||
},
|
||||
helper: "原本存储证书的secret的name",
|
||||
required: true,
|
||||
})
|
||||
secretName!: string | string[];
|
||||
|
||||
@TaskInput({
|
||||
title: "命名空间",
|
||||
value: "default",
|
||||
component: {
|
||||
placeholder: "命名空间",
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
namespace = "default";
|
||||
|
||||
@TaskInput({
|
||||
title: "是否私网ip",
|
||||
value: false,
|
||||
component: {
|
||||
name: "a-switch",
|
||||
vModel: "checked",
|
||||
placeholder: "集群连接端点是否是私网ip",
|
||||
},
|
||||
helper: "如果您当前certd运行在同一个私网下,可以选择是。",
|
||||
required: true,
|
||||
})
|
||||
isPrivateIpAddress!: boolean;
|
||||
|
||||
@TaskInput({
|
||||
title: "忽略证书校验",
|
||||
required: false,
|
||||
helper: "是否忽略证书校验",
|
||||
component: {
|
||||
name: "a-switch",
|
||||
vModel: "checked",
|
||||
},
|
||||
})
|
||||
skipTLSVerify!: boolean;
|
||||
|
||||
@TaskInput({
|
||||
title: "Secret自动创建",
|
||||
helper: "如果Secret不存在,则创建",
|
||||
value: false,
|
||||
component: {
|
||||
name: "a-switch",
|
||||
vModel: "checked",
|
||||
},
|
||||
})
|
||||
createOnNotFound: boolean;
|
||||
|
||||
K8sClient: any;
|
||||
async onInstance() {
|
||||
const sdk = await import("@certd/lib-k8s");
|
||||
this.K8sClient = sdk.K8sClient;
|
||||
}
|
||||
async execute(): Promise<void> {
|
||||
this.logger.info("开始部署证书到阿里云Ack");
|
||||
const { regionId, clusterId, isPrivateIpAddress, cert } = this;
|
||||
const access = (await this.getAccess(this.accessId)) as AliyunAccess;
|
||||
const client = await this.getClient(access, regionId);
|
||||
const kubeConfigStr = await this.getKubeConfig(client, clusterId, isPrivateIpAddress);
|
||||
|
||||
this.logger.info("kubeconfig已成功获取");
|
||||
const k8sClient = new this.K8sClient({
|
||||
kubeConfigStr,
|
||||
logger: this.logger,
|
||||
skipTLSVerify: this.skipTLSVerify,
|
||||
});
|
||||
await this.patchCertSecret({ cert, k8sClient });
|
||||
|
||||
await utils.sleep(5000); // 停留5秒,等待secret部署完成
|
||||
|
||||
try {
|
||||
await this.restartIngress({ k8sClient });
|
||||
} catch (e) {
|
||||
this.logger.warn(`重启ingress失败:${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async restartIngress(options: { k8sClient: any }) {
|
||||
const { k8sClient } = options;
|
||||
const { namespace } = this;
|
||||
|
||||
const body = {
|
||||
metadata: {
|
||||
labels: {
|
||||
certd: this.appendTimeSuffix("certd"),
|
||||
},
|
||||
},
|
||||
};
|
||||
const ingressList = await k8sClient.getIngressList({ namespace });
|
||||
this.logger.info("ingressList:", ingressList);
|
||||
if (!ingressList || !ingressList.items) {
|
||||
return;
|
||||
}
|
||||
const ingressNames = ingressList.items
|
||||
.filter((item: any) => {
|
||||
if (!item.spec.tls) {
|
||||
return false;
|
||||
}
|
||||
for (const tls of item.spec.tls) {
|
||||
if (tls.secretName === this.secretName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.map((item: any) => {
|
||||
return item.metadata.name;
|
||||
});
|
||||
for (const ingress of ingressNames) {
|
||||
await k8sClient.patchIngress({ namespace, ingressName: ingress, body, createOnNotFound: this.createOnNotFound });
|
||||
this.logger.info(`ingress已重启:${ingress}`);
|
||||
}
|
||||
}
|
||||
|
||||
async patchCertSecret(options: { cert: CertInfo; k8sClient: any }) {
|
||||
const { cert, k8sClient } = options;
|
||||
const crt = cert.crt;
|
||||
const key = cert.key;
|
||||
const crtBase64 = Buffer.from(crt).toString("base64");
|
||||
const keyBase64 = Buffer.from(key).toString("base64");
|
||||
|
||||
const { namespace, secretName } = this;
|
||||
|
||||
const body = {
|
||||
data: {
|
||||
"tls.crt": crtBase64,
|
||||
"tls.key": keyBase64,
|
||||
},
|
||||
metadata: {
|
||||
labels: {
|
||||
certd: this.appendTimeSuffix("certd"),
|
||||
},
|
||||
},
|
||||
};
|
||||
let secretNames: any = secretName;
|
||||
if (typeof secretName === "string") {
|
||||
secretNames = [secretName];
|
||||
}
|
||||
for (const secret of secretNames) {
|
||||
await k8sClient.patchSecret({ namespace, secretName: secret, body });
|
||||
this.logger.info(`cert secret已更新: ${secret}`);
|
||||
}
|
||||
}
|
||||
|
||||
async getClient(aliyunProvider: any, regionId: string) {
|
||||
const client = new AliyunClient({ logger: this.logger, useROAClient: true });
|
||||
await client.init({
|
||||
accessKeyId: aliyunProvider.accessKeyId,
|
||||
accessKeySecret: aliyunProvider.accessKeySecret,
|
||||
endpoint: `https://cs.${regionId}.aliyuncs.com`,
|
||||
apiVersion: "2015-12-15",
|
||||
});
|
||||
return client;
|
||||
}
|
||||
|
||||
async getKubeConfig(client: any, clusterId: string, isPrivateIpAddress = false) {
|
||||
const httpMethod = "GET";
|
||||
const uriPath = `/k8s/${clusterId}/user_config`;
|
||||
const queries = {
|
||||
PrivateIpAddress: isPrivateIpAddress,
|
||||
TemporaryDurationMinutes: 15,
|
||||
};
|
||||
const body = {};
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
const requestOption = {};
|
||||
|
||||
try {
|
||||
const res = await client.request(httpMethod, uriPath, queries, body, headers, requestOption);
|
||||
return res.config;
|
||||
} catch (e) {
|
||||
console.error("请求出错:", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new DeployCertToAliyunAckPlugin();
|
||||
@@ -1,13 +1,11 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
import {
|
||||
AliyunAccess,
|
||||
AliyunClient,
|
||||
AliyunClientV2,
|
||||
AliyunSslClient,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from "@certd/plugin-lib";
|
||||
import { AliyunAccess, AliyunClientV2 } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
import { AliyunClient, AliyunSslClient } from "../../../plugin-lib/aliyun/lib/index.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "AliyunDeployCertToALB",
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
|
||||
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
import { AliyunSslClient } from "../../../plugin-lib/aliyun/lib/ssl-client.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "AliyunDeployCertToAll",
|
||||
title: "阿里云-部署至任意云资源",
|
||||
icon: "svg:icon-aliyun",
|
||||
group: pluginGroups.aliyun.key,
|
||||
desc: "【不建议使用】需要消耗阿里云自动部署次数,支持SLB、LIVE、webHosting、VOD、CR、DCDN、DDoS、CDN、ALB、APIGateway、FC、GA、MSE、NLB、OSS、SAE、WAF等云产品",
|
||||
needPlus: false,
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
},
|
||||
},
|
||||
})
|
||||
export class AliyunDeployCertToAll extends AbstractTaskPlugin {
|
||||
@TaskInput({
|
||||
title: "域名证书",
|
||||
helper: "请选择证书申请任务输出的域名证书\n或者选择前置任务“上传证书到阿里云”任务的证书ID,可以减少上传到阿里云的证书数量",
|
||||
component: {
|
||||
name: "output-selector",
|
||||
from: [...CertApplyPluginNames, "uploadCertToAliyun"],
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
cert!: CertInfo | number;
|
||||
|
||||
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
|
||||
certDomains!: string[];
|
||||
|
||||
@TaskInput({
|
||||
title: "接入点",
|
||||
helper: "不会选就按默认",
|
||||
value: "cas.aliyuncs.com",
|
||||
component: {
|
||||
name: "a-select",
|
||||
options: [
|
||||
{ value: "cas.aliyuncs.com", label: "中国大陆" },
|
||||
{ value: "cas.ap-southeast-1.aliyuncs.com", label: "新加坡" },
|
||||
{ value: "cas.eu-central-1.aliyuncs.com", label: "德国(法兰克福)" },
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
endpoint!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: "Access授权",
|
||||
helper: "阿里云授权AccessKeyId、AccessKeySecret",
|
||||
component: {
|
||||
name: "access-selector",
|
||||
type: "aliyun",
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
accessId!: string;
|
||||
|
||||
/**
|
||||
* SLB:传统型负载均衡 CLB(仅中国站)
|
||||
* LIVE:视频直播(仅中国站)
|
||||
* webHosting:云虚拟主机(仅中国站)
|
||||
* VOD:视频点播(仅中国站)
|
||||
* CR:容器镜像服务(仅中国站)
|
||||
* DCDN:全站加速
|
||||
* DDoS:DDos 防护
|
||||
* CDN:内容分发网络
|
||||
* ALB:应用负载均衡
|
||||
* APIGateway:API 网关
|
||||
* FC:函数计算
|
||||
* GA:全球加速
|
||||
* MSE:微服务引擎
|
||||
* NLB:网络型负载均衡
|
||||
* OSS:对象存储
|
||||
* SAE:Serverless 应用引擎
|
||||
* WAF:Web 应用防火墙
|
||||
*/
|
||||
@TaskInput({
|
||||
title: "云产品类型",
|
||||
helper: "请选择云产品类型",
|
||||
component: {
|
||||
name: "a-select",
|
||||
vModel: "value",
|
||||
options: [
|
||||
{ value: "SLB", label: "SLB-传统型负载均衡 CLB(仅中国站)" },
|
||||
{ value: "LIVE", label: "LIVE-视频直播(仅中国站)" },
|
||||
{ value: "webHosting", label: "webHosting-云虚拟主机(仅中国站)" },
|
||||
{ value: "VOD", label: "VOD-视频点播(仅中国站)" },
|
||||
{ value: "CR", label: "CR-容器镜像服务(仅中国站)" },
|
||||
{ value: "DCDN", label: "DCDN-全站加速" },
|
||||
{ value: "DDoS", label: "DDos 防护" },
|
||||
{ value: "CDN", label: "CDN-内容分发网络" },
|
||||
{ value: "ALB", label: "ALB-应用负载均衡" },
|
||||
{ value: "APIGateway", label: "APIGateway-API 网关" },
|
||||
{ value: "FC", label: "FC-函数计算" },
|
||||
{ value: "GA", label: "GA-全球加速" },
|
||||
{ value: "MSE", label: "MSE-微服务引擎" },
|
||||
{ value: "NLB", label: "NLB-网络型负载均衡" },
|
||||
{ value: "OSS", label: "OSS-对象存储" },
|
||||
{ value: "SAE", label: "SAE-Serverless应用引擎" },
|
||||
{ value: "WAF", label: "WAF-Web应用防火墙" },
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
cloudProduct!: string;
|
||||
|
||||
@TaskInput(
|
||||
createRemoteSelectInputDefine({
|
||||
title: "要部署证书的云产品",
|
||||
helper: "请选择要部署证书的云产品,注意:新创建的云产品资源可能需要过1-2小时才会在此处显示",
|
||||
typeName: "AliyunDeployCertToAll",
|
||||
action: AliyunDeployCertToAll.prototype.onGetProductList.name,
|
||||
watches: ["cloudProduct", "accessId"],
|
||||
})
|
||||
)
|
||||
productIds!: string[];
|
||||
|
||||
@TaskInput(
|
||||
createRemoteSelectInputDefine({
|
||||
title: "联系人",
|
||||
helper: "请选择联系人,如果没有,需要先到[阿里云控制台创建联系人](https://yundun.console.aliyun.com/?p=cas#/informationManagement/person/)",
|
||||
typeName: "AliyunDeployCertToAll",
|
||||
action: AliyunDeployCertToAll.prototype.onGetContactList.name,
|
||||
})
|
||||
)
|
||||
contactIds!: string[];
|
||||
|
||||
@TaskInput({
|
||||
title: "检查超时时间",
|
||||
helper: "检查部署任务超时时间,单位分钟",
|
||||
value: 10,
|
||||
component: {
|
||||
name: "a-input-number",
|
||||
vModel: "value",
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
checkTimeout!: number;
|
||||
|
||||
async onInstance() {}
|
||||
|
||||
async execute(): Promise<void> {
|
||||
this.logger.info("开始部署证书到阿里云");
|
||||
const access = await this.getAccess<AliyunAccess>(this.accessId);
|
||||
const sslClient = new AliyunSslClient({
|
||||
access,
|
||||
logger: this.logger,
|
||||
endpoint: this.endpoint,
|
||||
});
|
||||
|
||||
//
|
||||
let certId: any = this.cert;
|
||||
if (typeof this.cert === "object") {
|
||||
certId = await sslClient.uploadCert({
|
||||
name: this.appendTimeSuffix("certd"),
|
||||
cert: this.cert,
|
||||
});
|
||||
}
|
||||
|
||||
const jobId = await this.createDeployJob(sslClient, certId);
|
||||
|
||||
await this.updateJobStatus(sslClient, jobId, "scheduling");
|
||||
|
||||
this.logger.info("开始检查部署任务执行结果");
|
||||
const startTime = Date.now();
|
||||
while (Date.now() < startTime + this.checkTimeout * 60 * 1000) {
|
||||
this.checkSignal();
|
||||
await this.ctx.utils.sleep(10000);
|
||||
let res: any = {};
|
||||
try {
|
||||
res = await this.getJobDetail(sslClient, jobId);
|
||||
} catch (e: any) {
|
||||
this.logger.error(e);
|
||||
break;
|
||||
}
|
||||
const status = res.Status;
|
||||
if (status == "success") {
|
||||
this.logger.info("部署任务执行成功:", status);
|
||||
return;
|
||||
} else if (status == "error") {
|
||||
this.logger.error(`部署任务执行失败,请前往 https://yundun.console.aliyun.com/?p=cas#/deployDetail/user/${jobId} 查看失败原因: `, res);
|
||||
|
||||
throw new Error("部署任务执行失败,");
|
||||
} else {
|
||||
/**
|
||||
* pending:待执行
|
||||
* editing:编辑中
|
||||
* scheduling:调度中
|
||||
* processing:部署中
|
||||
* error:部署失败
|
||||
* success:部署成功
|
||||
*/
|
||||
this.logger.info("部署任务正在执行中: ", status);
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("部署任务执行超时,请手动检查任务状态");
|
||||
}
|
||||
|
||||
async updateJobStatus(sslClient: AliyunSslClient, jobId: string, status: string) {
|
||||
const params = {
|
||||
JobId: jobId,
|
||||
Status: status,
|
||||
};
|
||||
const requestOption = {
|
||||
method: "POST",
|
||||
formatParams: false,
|
||||
};
|
||||
const res = await sslClient.doRequest("UpdateDeploymentJobStatus", params, requestOption);
|
||||
this.logger.info("部署任务开始执行,部署需要时间,RequestId=", res.RequestId);
|
||||
}
|
||||
|
||||
async onGetProductList(data: any) {
|
||||
if (!this.accessId) {
|
||||
throw new Error("请选择Access授权");
|
||||
}
|
||||
const access = await this.getAccess<AliyunAccess>(this.accessId);
|
||||
const sslClient = new AliyunSslClient({
|
||||
access,
|
||||
logger: this.logger,
|
||||
endpoint: this.endpoint,
|
||||
});
|
||||
|
||||
if (!this.cloudProduct) {
|
||||
throw new Error("请选择云产品类型");
|
||||
}
|
||||
|
||||
const res = await sslClient.getResourceList({
|
||||
cloudProduct: this.cloudProduct,
|
||||
});
|
||||
if (!res?.Data || res?.Data.length === 0) {
|
||||
throw new Error("没有找到对应类型的云资源");
|
||||
}
|
||||
const options = res.Data.map((item: any) => {
|
||||
return {
|
||||
label: `${item.Domain}<${item.Id}>`,
|
||||
value: item.Id,
|
||||
title: `${item.CloudProduct}:${item.CertName || "证书未命名"}`,
|
||||
domain: item.Domain,
|
||||
};
|
||||
});
|
||||
return this.ctx.utils.options.buildGroupOptions(options, this.certDomains);
|
||||
}
|
||||
|
||||
async onGetContactList(data: any) {
|
||||
if (!this.accessId) {
|
||||
throw new Error("请选择Access授权");
|
||||
}
|
||||
const access = await this.getAccess<AliyunAccess>(this.accessId);
|
||||
const sslClient = new AliyunSslClient({
|
||||
access,
|
||||
logger: this.logger,
|
||||
endpoint: this.endpoint,
|
||||
});
|
||||
const res = await sslClient.getContactList();
|
||||
/*
|
||||
"Email": "@qq.com",
|
||||
"EmailStatus": 0,
|
||||
"MobileStatus": 0,
|
||||
"ContactId": 378992,
|
||||
"Mobile": "",
|
||||
"Name": ""
|
||||
*/
|
||||
if (!res?.ContactList || res?.ContactList.length === 0) {
|
||||
throw new Error("没有找到联系人");
|
||||
}
|
||||
return res.ContactList.map((item: any) => {
|
||||
return {
|
||||
label: `${item.Name}<${item.Email}:${item.ContactId}>`,
|
||||
value: item.ContactId,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async getJobDetail(sslClient: AliyunSslClient, jobId: number) {
|
||||
const params = {
|
||||
JobId: jobId,
|
||||
};
|
||||
|
||||
const requestOption = {
|
||||
method: "POST",
|
||||
formatParams: false,
|
||||
};
|
||||
|
||||
return await sslClient.doRequest("DescribeDeploymentJob", params, requestOption);
|
||||
}
|
||||
|
||||
private async createDeployJob(sslClient: AliyunSslClient, certId: any) {
|
||||
const res = await sslClient.createDeploymentJob({
|
||||
name: "自动部署证书(By Certd)",
|
||||
jobType: "user",
|
||||
contactIds: this.contactIds,
|
||||
resourceIds: this.productIds,
|
||||
certIds: [certId],
|
||||
});
|
||||
|
||||
const jobId = res.JobId;
|
||||
this.logger.info("部署任务创建成功: jobId=", jobId);
|
||||
return jobId;
|
||||
}
|
||||
}
|
||||
|
||||
new AliyunDeployCertToAll();
|
||||
@@ -1,10 +1,10 @@
|
||||
import {AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput} from '@certd/pipeline';
|
||||
import {
|
||||
AliyunAccess,
|
||||
AliyunSslClient,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from "@certd/plugin-lib";
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
import { AliyunSslClient } from "../../../plugin-lib/aliyun/lib/ssl-client.js";
|
||||
import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
import {optionsUtils} from "@certd/basic";
|
||||
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
import {AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput} from '@certd/pipeline';
|
||||
import {AliyunAccess, createCertDomainGetterInputDefine, createRemoteSelectInputDefine} from "@certd/plugin-lib";
|
||||
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine} from "@certd/plugin-lib";
|
||||
import {CertApplyPluginNames, CertInfo} from '@certd/plugin-cert';
|
||||
import {optionsUtils} from "@certd/basic";
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToAliyunApiGateway',
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { AliyunAccess, AliyunClient, AliyunSslClient, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
|
||||
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from '@certd/plugin-lib';
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
import { optionsUtils } from '@certd/basic';
|
||||
import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
|
||||
import { AliyunClient, AliyunSslClient } from "../../../plugin-lib/aliyun/lib/index.js";
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToAliyunCDN',
|
||||
title: '阿里云-部署证书至CDN',
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
AliyunAccess,
|
||||
AliyunClient,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from "@certd/plugin-lib";
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
|
||||
import { CertInfo } from '@certd/plugin-cert';
|
||||
import { CertApplyPluginNames} from '@certd/plugin-cert';
|
||||
import { optionsUtils } from "@certd/basic";
|
||||
import { AliyunClient } from "../../../plugin-lib/aliyun/lib/index.js";
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToAliyunDCDN',
|
||||
title: '阿里云-部署证书至DCDN',
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
import {
|
||||
AliyunAccess, AliyunClientV2,
|
||||
AliyunSslClient,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from "@certd/plugin-lib";
|
||||
import { AliyunAccess, AliyunClientV2 } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
import { AliyunSslClient } from "../../../plugin-lib/aliyun/lib/ssl-client.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "AliyunDeployCertToESA",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
import { AliyunAccess, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { sp } from "@certd/basic";
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'AliyunDeployCertToFC',
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
import {
|
||||
AliyunAccess,
|
||||
AliyunClient,
|
||||
AliyunClientV2,
|
||||
AliyunSslClient,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from "@certd/plugin-lib";
|
||||
import { CertApplyPluginNames} from '@certd/plugin-cert';
|
||||
import { AliyunAccess, AliyunClientV2 } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
import { AliyunClient, AliyunSslClient } from "../../../plugin-lib/aliyun/lib/index.js";
|
||||
@IsTaskPlugin({
|
||||
name: 'AliyunDeployCertToNLB',
|
||||
title: '阿里云-部署至NLB(网络负载均衡)',
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {AbstractTaskPlugin, IsTaskPlugin, Pager, pluginGroups, RunStrategy, TaskInput} from '@certd/pipeline';
|
||||
import {
|
||||
AliyunAccess,
|
||||
AliyunSslClient,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from '@certd/plugin-lib';
|
||||
@@ -9,6 +7,8 @@ import {CertInfo, CertReader} from '@certd/plugin-cert';
|
||||
import { CertApplyPluginNames} from '@certd/plugin-cert';
|
||||
import {optionsUtils} from "@certd/basic";
|
||||
import {isArray} from "lodash-es";
|
||||
import { AliyunAccess } from '../../../plugin-lib/aliyun/access/index.js';
|
||||
import { AliyunSslClient } from '../../../plugin-lib/aliyun/lib/index.js';
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToAliyunOSS',
|
||||
title: '阿里云-部署证书至OSS',
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import {AbstractTaskPlugin, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput} from '@certd/pipeline';
|
||||
import {CertInfo} from '@certd/plugin-cert';
|
||||
import {
|
||||
AliyunAccess,
|
||||
AliyunClient,
|
||||
AliyunSslClient,
|
||||
CasCertInfo,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from '@certd/plugin-lib';
|
||||
import {CertApplyPluginNames} from '@certd/plugin-cert';
|
||||
import { AliyunAccess } from '../../../plugin-lib/aliyun/access/index.js';
|
||||
import { AliyunClient, AliyunSslClient, CasCertInfo } from '../../../plugin-lib/aliyun/lib/index.js';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'AliyunDeployCertToSLB',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
|
||||
import { AliyunAccess, createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
import { createCertDomainGetterInputDefine, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: "AliyunDeployCertToVod",
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, Pager,PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||
import { CertApplyPluginNames, CertInfo, CertReader } from "@certd/plugin-cert";
|
||||
import {
|
||||
AliyunAccess,
|
||||
AliyunClient,
|
||||
AliyunSslClient,
|
||||
createCertDomainGetterInputDefine,
|
||||
createRemoteSelectInputDefine
|
||||
} from "@certd/plugin-lib";
|
||||
import { AliyunAccess } from "../../../plugin-lib/aliyun/access/index.js";
|
||||
import { AliyunClient, AliyunSslClient } from "../../../plugin-lib/aliyun/lib/index.js";
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'AliyunDeployCertToWaf',
|
||||
|
||||
@@ -11,3 +11,4 @@ export * from './deploy-to-esa/index.js';
|
||||
export * from './deploy-to-vod/index.js';
|
||||
export * from './deploy-to-apigateway/index.js';
|
||||
export * from './deploy-to-apig/index.js';
|
||||
export * from './deploy-to-ack/index.js';
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
|
||||
import { AliyunAccess } from '@certd/plugin-lib';
|
||||
import { AliyunSslClient } from '@certd/plugin-lib';
|
||||
import { CertApplyPluginNames, CertReader } from "@certd/plugin-cert";
|
||||
import { AliyunAccess } from '../../../plugin-lib/aliyun/access/index.js';
|
||||
import { AliyunSslClient } from '../../../plugin-lib/aliyun/lib/index.js';
|
||||
/**
|
||||
* 华东1(杭州) cn-hangzhou cas.aliyuncs.com cas-vpc.cn-hangzhou.aliyuncs.com
|
||||
* 马来西亚(吉隆坡) ap-southeast-3 cas.ap-southeast-3.aliyuncs.com cas-vpc.ap-southeast-3.aliyuncs.com
|
||||
|
||||
Reference in New Issue
Block a user