mirror of
https://github.com/certd/certd.git
synced 2026-04-30 01:07:28 +08:00
perf: 优化腾讯云CLB插件支持选择证书id
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { TencentAccess } from '../../../plugin-lib/tencent/index.js';
|
import { TencentAccess } from '../../../plugin-lib/tencent/index.js';
|
||||||
import { CertApplyPluginNames} from '@certd/plugin-cert';
|
import { CertApplyPluginNames, CertInfo } from '@certd/plugin-cert';
|
||||||
@IsTaskPlugin({
|
@IsTaskPlugin({
|
||||||
name: 'DeployCertToTencentCLB',
|
name: 'DeployCertToTencentCLB',
|
||||||
title: '腾讯云-部署到CLB',
|
title: '腾讯云-部署到CLB',
|
||||||
@@ -15,6 +15,31 @@ import { CertApplyPluginNames} from '@certd/plugin-cert';
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
||||||
|
|
||||||
|
@TaskInput({
|
||||||
|
title: '域名证书',
|
||||||
|
helper: '请选择前置任务输出的域名证书',
|
||||||
|
component: {
|
||||||
|
name: 'output-selector',
|
||||||
|
from: [...CertApplyPluginNames, 'UploadCertToTencent'],
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
})
|
||||||
|
cert!: string | CertInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@TaskInput({
|
||||||
|
title: 'Access提供者',
|
||||||
|
helper: 'access授权',
|
||||||
|
component: {
|
||||||
|
name: 'access-selector',
|
||||||
|
type: 'tencent',
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
})
|
||||||
|
accessId!: string;
|
||||||
|
|
||||||
@TaskInput({
|
@TaskInput({
|
||||||
title: '大区',
|
title: '大区',
|
||||||
component: {
|
component: {
|
||||||
@@ -46,14 +71,10 @@ export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
|||||||
})
|
})
|
||||||
region!: string;
|
region!: string;
|
||||||
|
|
||||||
@TaskInput({
|
|
||||||
title: '证书名称前缀',
|
|
||||||
})
|
|
||||||
certName!: string;
|
|
||||||
|
|
||||||
@TaskInput({
|
@TaskInput({
|
||||||
title: '负载均衡ID',
|
title: '负载均衡ID',
|
||||||
helper: '如果没有配置,则根据域名匹配负载均衡下的监听器(根据域名匹配时暂时只支持前100个)',
|
|
||||||
required: true,
|
required: true,
|
||||||
})
|
})
|
||||||
loadBalancerId!: string;
|
loadBalancerId!: string;
|
||||||
@@ -78,26 +99,10 @@ export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
|||||||
domain!: string | string[];
|
domain!: string | string[];
|
||||||
|
|
||||||
@TaskInput({
|
@TaskInput({
|
||||||
title: '域名证书',
|
title: '证书名称前缀',
|
||||||
helper: '请选择前置任务输出的域名证书',
|
|
||||||
component: {
|
|
||||||
name: 'output-selector',
|
|
||||||
from: [...CertApplyPluginNames],
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
})
|
})
|
||||||
cert!: any;
|
certName!: string;
|
||||||
|
|
||||||
@TaskInput({
|
|
||||||
title: 'Access提供者',
|
|
||||||
helper: 'access授权',
|
|
||||||
component: {
|
|
||||||
name: 'access-selector',
|
|
||||||
type: 'tencent',
|
|
||||||
},
|
|
||||||
required: true,
|
|
||||||
})
|
|
||||||
accessId!: string;
|
|
||||||
|
|
||||||
client: any;
|
client: any;
|
||||||
async onInstance() {
|
async onInstance() {
|
||||||
@@ -234,12 +239,23 @@ export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
|||||||
return name + '-' + dayjs().format('YYYYMMDD-HHmmss');
|
return name + '-' + dayjs().format('YYYYMMDD-HHmmss');
|
||||||
}
|
}
|
||||||
buildProps() {
|
buildProps() {
|
||||||
|
const certId = this.cert as string;
|
||||||
|
const certInfo = this.cert as CertInfo;
|
||||||
|
if (typeof this.cert === 'string') {
|
||||||
|
return {
|
||||||
|
Certificate: {
|
||||||
|
CertId: certId,
|
||||||
|
},
|
||||||
|
LoadBalancerId: this.loadBalancerId,
|
||||||
|
ListenerId: this.listenerId,
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
Certificate: {
|
Certificate: {
|
||||||
SSLMode: 'UNIDIRECTIONAL', // 单向认证
|
SSLMode: 'UNIDIRECTIONAL', // 单向认证
|
||||||
CertName: this.appendTimeSuffix(this.certName || this.cert.domain),
|
CertName: this.appendTimeSuffix(this.certName || "certd"),
|
||||||
CertKey: this.cert.key,
|
CertKey: certInfo.key,
|
||||||
CertContent: this.cert.crt,
|
CertContent: certInfo.crt,
|
||||||
},
|
},
|
||||||
LoadBalancerId: this.loadBalancerId,
|
LoadBalancerId: this.loadBalancerId,
|
||||||
ListenerId: this.listenerId,
|
ListenerId: this.listenerId,
|
||||||
|
|||||||
Reference in New Issue
Block a user