mirror of
https://github.com/certd/certd.git
synced 2026-05-17 13:57:31 +08:00
perf: 支持更新金山云cdn证书
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user