mirror of https://github.com/certd/certd
chore:
parent
be2f0aa435
commit
fdda8985de
|
@ -0,0 +1,89 @@
|
|||
import { IsTaskPlugin, pluginGroups, RunStrategy, TaskInput } from '@certd/pipeline';
|
||||
import { AbstractPlusTaskPlugin } from '@certd/plugin-plus';
|
||||
|
||||
@IsTaskPlugin({
|
||||
name: 'DeployCertToTencentAll',
|
||||
title: '部署证书到腾讯云任意云资源',
|
||||
needPlus: true,
|
||||
icon: 'svg:icon-tencentcloud',
|
||||
group: pluginGroups.tencent.key,
|
||||
desc: '需要【上传到腾讯云】作为前置任务',
|
||||
default: {
|
||||
strategy: {
|
||||
runStrategy: RunStrategy.SkipWhenSucceed,
|
||||
},
|
||||
},
|
||||
})
|
||||
export class DeployCertToTencentAll extends AbstractPlusTaskPlugin {
|
||||
/**
|
||||
* AccessProvider的key,或者一个包含access的具体的对象
|
||||
*/
|
||||
@TaskInput({
|
||||
title: 'Access授权',
|
||||
helper: 'access授权',
|
||||
component: {
|
||||
name: 'access-selector',
|
||||
type: 'tencent',
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
accessId!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: '腾讯云证书id',
|
||||
helper: '请选择“上传证书到腾讯云”前置任务的输出',
|
||||
component: {
|
||||
name: 'output-selector',
|
||||
from: 'UploadCertToTencent',
|
||||
},
|
||||
required: true,
|
||||
})
|
||||
tencentCertId!: string;
|
||||
|
||||
@TaskInput({
|
||||
title: '云资源实例Id列表',
|
||||
component: {
|
||||
name: 'a-select',
|
||||
vModel: 'value',
|
||||
open: false,
|
||||
mode: 'tags',
|
||||
},
|
||||
helper: '',
|
||||
})
|
||||
instanceIdList!: string[];
|
||||
|
||||
async onInstance() {}
|
||||
async execute(): Promise<void> {
|
||||
const accessProvider = await this.accessService.getById(this.accessId);
|
||||
|
||||
const sdk = await import('tencentcloud-sdk-nodejs/tencentcloud/services/ssl/v20191205/index.js');
|
||||
const Client = sdk.v20191205.Client;
|
||||
const client = new Client({
|
||||
credential: {
|
||||
secretId: accessProvider.secretId,
|
||||
secretKey: accessProvider.secretKey,
|
||||
},
|
||||
region: '',
|
||||
profile: {
|
||||
httpProfile: {
|
||||
endpoint: 'ssl.tencentcloudapi.com',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const params = {
|
||||
CertificateId: this.tencentCertId,
|
||||
InstanceIdList: this.instanceIdList,
|
||||
};
|
||||
|
||||
const res = await client.DeployCertificateInstance(params);
|
||||
this.checkRet(res);
|
||||
this.logger.info('部署成功');
|
||||
}
|
||||
|
||||
checkRet(ret: any) {
|
||||
if (!ret || ret.Error) {
|
||||
throw new Error('执行失败:' + ret.Error.Code + ',' + ret.Error.Message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import dayjs from 'dayjs';
|
|||
},
|
||||
},
|
||||
})
|
||||
export class DeployToClbPlugin extends AbstractTaskPlugin {
|
||||
export class DeployCertToTencentCLB extends AbstractTaskPlugin {
|
||||
@TaskInput({
|
||||
title: '大区',
|
||||
component: {
|
||||
|
|
|
@ -162,4 +162,4 @@ export class DeployCertToTencentCosPlugin extends AbstractPlusTaskPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
// new DeployCertToTencentCosPlugin()
|
||||
new DeployCertToTencentCosPlugin();
|
||||
|
|
|
@ -13,7 +13,7 @@ import { TencentAccess } from '@certd/plugin-plus';
|
|||
},
|
||||
},
|
||||
})
|
||||
export class DeployToEOPlugin extends AbstractTaskPlugin {
|
||||
export class DeployCertToTencentEO extends AbstractTaskPlugin {
|
||||
@TaskInput({
|
||||
title: '已上传证书ID',
|
||||
helper: '请选择前置任务上传到腾讯云的证书',
|
||||
|
@ -131,3 +131,5 @@ export class DeployToEOPlugin extends AbstractTaskPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
new DeployCertToTencentEO();
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
export * from './deploy-to-all/index.js';
|
||||
export * from './deploy-to-clb/index.js';
|
||||
export * from './deploy-to-cdn/index.js';
|
||||
export * from './upload-to-tencent/index.js';
|
||||
export * from './deploy-to-cdn-v2/index.js';
|
||||
export * from './upload-to-tencent/index.js';
|
||||
export * from './deploy-to-cos/index.js';
|
||||
export * from './deploy-to-eo/index.js';
|
||||
|
|
|
@ -13,7 +13,7 @@ import dayjs from 'dayjs';
|
|||
},
|
||||
},
|
||||
})
|
||||
export class UploadToTencentPlugin extends AbstractTaskPlugin {
|
||||
export class UploadCertToTencent extends AbstractTaskPlugin {
|
||||
@TaskInput({ title: '证书名称' })
|
||||
name!: string;
|
||||
|
||||
|
|
Loading…
Reference in New Issue