perf: 支持更新金山云cdn证书

This commit is contained in:
xiaojunnuo
2025-08-15 10:27:06 +08:00
parent 4e432ed03f
commit 462e22a3b0
3 changed files with 31 additions and 8 deletions
@@ -83,7 +83,7 @@ export class KsyunAccess extends BaseAccess {
method:"POST",
url:"/2016-09-01/cert/SetCertificate",
data:{
CertificateId: parseInt(opts.certId),
CertificateId: opts.certId,
CertificateName: opts.certName,
ServerCertificate: opts.cert.crt,
PrivateKey: opts.cert.key
@@ -93,6 +93,24 @@ export class KsyunAccess extends BaseAccess {
return res
}
async getCert(opts:{client:KsyunClient,certId:string}){
const res = await opts.client.doRequest({
action: "GetCertificates",
version: "2016-09-01",
method:"POST",
url:"/2016-09-01/cert/GetCertificates",
data:{
CertificateId: opts.certId,
}
})
this.ctx.logger.info(res)
const list = res.Certificates
if (list.length > 0) {
return list[0]
}
throw new Error(`未找到证书:${opts.certId}`)
}
async getCdnClient() {
return new KsyunClient({
accessKeyId: this.accessKeyId,