mirror of
https://github.com/certd/certd.git
synced 2026-04-14 12:30:54 +08:00
chore: 阿里云上传证书返回值优化为带region的
This commit is contained in:
@@ -305,11 +305,11 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
|
||||
});
|
||||
|
||||
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt));
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: certName,
|
||||
cert: this.cert
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
}
|
||||
|
||||
return certId;
|
||||
|
||||
@@ -155,11 +155,11 @@ export class AliyunDeployCertToAll extends AbstractTaskPlugin {
|
||||
//
|
||||
let certId: any = this.cert;
|
||||
if (typeof this.cert === "object") {
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: this.appendTimeSuffix("certd"),
|
||||
cert: this.cert,
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
}
|
||||
|
||||
const jobId = await this.createDeployJob(sslClient, certId);
|
||||
|
||||
@@ -115,11 +115,11 @@ export class DeployCertToAliyunCDN extends AbstractTaskPlugin {
|
||||
if (typeof this.cert === 'object') {
|
||||
// @ts-ignore
|
||||
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name:certName,
|
||||
cert: this.cert,
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
}
|
||||
|
||||
const client = await this.getClient(access);
|
||||
|
||||
@@ -119,11 +119,11 @@ export class AliyunDeployCertToESA extends AbstractTaskPlugin {
|
||||
|
||||
certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt));
|
||||
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: certName,
|
||||
cert: this.cert
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
this.logger.info("上传证书成功", certId, certName);
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -294,11 +294,11 @@ export class AliyunDeployCertToNLB extends AbstractTaskPlugin {
|
||||
|
||||
const certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
|
||||
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: certName,
|
||||
cert: this.cert,
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
}
|
||||
return certId;
|
||||
}
|
||||
|
||||
@@ -212,11 +212,11 @@ export class DeployCertToAliyunOSS extends AbstractTaskPlugin {
|
||||
|
||||
certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt));
|
||||
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: certName,
|
||||
cert: this.cert
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
this.logger.info("上传证书成功", certId, certName);
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -251,11 +251,11 @@ export class AliyunDeployCertToSLB extends AbstractTaskPlugin {
|
||||
|
||||
if (typeof this.cert === 'object') {
|
||||
const name = this.appendTimeSuffix('certd');
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: name,
|
||||
cert: this.cert,
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
}
|
||||
|
||||
return await sslClient.getCertInfo(certId);
|
||||
|
||||
@@ -152,11 +152,11 @@ export class AliyunDeployCertToWaf extends AbstractTaskPlugin {
|
||||
endpoint: this.casEndpoint,
|
||||
});
|
||||
|
||||
const certIdRes = await sslClient.uploadCert({
|
||||
const certIdRes = await sslClient.uploadCertificate({
|
||||
name: this.buildCertName(CertReader.getMainDomain(this.cert.crt)),
|
||||
cert: this.cert,
|
||||
});
|
||||
certId = certIdRes.certId;
|
||||
certId = certIdRes.certId as any;
|
||||
}
|
||||
|
||||
const client = await this.getWafClient(access);
|
||||
|
||||
@@ -104,11 +104,11 @@ export class UploadCertToAliyun extends AbstractTaskPlugin {
|
||||
}else{
|
||||
certName = this.buildCertName(CertReader.getMainDomain(this.cert.crt))
|
||||
}
|
||||
const certIdRes = await client.uploadCert({
|
||||
const certIdRes = await client.uploadCertificate({
|
||||
name: certName,
|
||||
cert: this.cert,
|
||||
});
|
||||
this.aliyunCertId = certIdRes.certId as any;
|
||||
this.aliyunCertId = certIdRes as any;
|
||||
}
|
||||
}
|
||||
//注册插件
|
||||
|
||||
@@ -98,7 +98,11 @@ export class AliyunSslClient {
|
||||
return `${certId}-${this.getCasRegionFromEndpoint(this.opts.endpoint)}`;
|
||||
}
|
||||
|
||||
async uploadCert(req: AliyunSslUploadCertReq) : Promise<CasCertId> {
|
||||
async uploadCert(req: AliyunSslUploadCertReq) {
|
||||
const {certId} = await this.uploadCertificate(req);
|
||||
return certId;
|
||||
}
|
||||
async uploadCertificate(req: AliyunSslUploadCertReq) : Promise<CasCertId> {
|
||||
const client = await this.getClient();
|
||||
const params = {
|
||||
Name: req.name,
|
||||
@@ -127,7 +131,7 @@ export class AliyunSslClient {
|
||||
// 上传证书到阿里云
|
||||
this.logger.info(`开始上传证书`);
|
||||
const certName = CertReader.buildCertName(cert);
|
||||
const res = await this.uploadCert({
|
||||
const res = await this.uploadCertificate({
|
||||
name: certName,
|
||||
cert: cert
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user