perf: 支持部署到阿里云NLB、SLB

This commit is contained in:
xiaojunnuo
2025-01-19 22:55:46 +08:00
parent 653940a0ca
commit c085bac5d8
4 changed files with 535 additions and 19 deletions

View File

@@ -29,6 +29,8 @@ export type AliyunSslUploadCertReq = {
cert: AliyunCertInfo;
};
export type CasCertInfo = { certId: number; certName: string; certIdentifier: string };
export class AliyunSslClient {
opts: AliyunSslClientOpts;
constructor(opts: AliyunSslClientOpts) {
@@ -53,6 +55,22 @@ export class AliyunSslClient {
return client;
}
async getCertInfo(certId: number): Promise<CasCertInfo> {
const client = await this.getClient();
const params = {
CertId: certId,
};
const res = await client.request("GetUserCertificateDetail", params);
this.checkRet(res);
return {
certId: certId,
certName: res.Name,
certIdentifier: res.CertIdentifier,
};
}
async uploadCert(req: AliyunSslUploadCertReq) {
const client = await this.getClient();
const params = {