mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 13:39:53 +00:00
style: modify variable name
This commit is contained in:
parent
f847b7ff62
commit
e2fd9c4cee
@ -104,11 +104,11 @@ func (d *VolcengineCDNDeployer) Deploy(ctx context.Context) error {
|
|||||||
CertId: upres.CertId,
|
CertId: upres.CertId,
|
||||||
Domain: domains[i],
|
Domain: domains[i],
|
||||||
}
|
}
|
||||||
BindCertResp, err := d.sdkClient.BatchDeployCert(batchDeployCertReq)
|
batchDeployCertResp, err := d.sdkClient.BatchDeployCert(batchDeployCertReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Wrap(err, "failed to execute sdk request 'cdn.BatchDeployCert'")
|
return xerrors.Wrap(err, "failed to execute sdk request 'cdn.BatchDeployCert'")
|
||||||
} else {
|
} else {
|
||||||
d.infos = append(d.infos, toStr(fmt.Sprintf("%s域名的证书已修改", domains[i]), BindCertResp))
|
d.infos = append(d.infos, toStr(fmt.Sprintf("%s域名的证书已修改", domains[i]), batchDeployCertResp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@ func (d *VolcengineLiveDeployer) Deploy(ctx context.Context) error {
|
|||||||
Domain: domains[i],
|
Domain: domains[i],
|
||||||
HTTPS: cast.BoolPtr(true),
|
HTTPS: cast.BoolPtr(true),
|
||||||
}
|
}
|
||||||
BindCertResp, err := d.sdkClient.BindCert(apiCtx, bindCertReq)
|
bindCertResp, err := d.sdkClient.BindCert(apiCtx, bindCertReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Wrap(err, "failed to execute sdk request 'live.BindCert'")
|
return xerrors.Wrap(err, "failed to execute sdk request 'live.BindCert'")
|
||||||
} else {
|
} else {
|
||||||
d.infos = append(d.infos, toStr(fmt.Sprintf("%s域名的证书已修改", domains[i]), BindCertResp))
|
d.infos = append(d.infos, toStr(fmt.Sprintf("%s域名的证书已修改", domains[i]), bindCertResp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,20 +54,20 @@ func (u *VolcengineCDNUploader) Upload(ctx context.Context, certPem string, priv
|
|||||||
pageNum := int64(1)
|
pageNum := int64(1)
|
||||||
pageSize := int64(100)
|
pageSize := int64(100)
|
||||||
certSource := "volc_cert_center"
|
certSource := "volc_cert_center"
|
||||||
listCertReq := &cdn.ListCertInfoRequest{
|
listCertInfoReq := &cdn.ListCertInfoRequest{
|
||||||
PageNum: &pageNum,
|
PageNum: &pageNum,
|
||||||
PageSize: &pageSize,
|
PageSize: &pageSize,
|
||||||
Source: certSource,
|
Source: certSource,
|
||||||
}
|
}
|
||||||
searchTotal := 0
|
searchTotal := 0
|
||||||
for {
|
for {
|
||||||
listCertResp, err := u.sdkClient.ListCertInfo(listCertReq)
|
listCertInfoResp, err := u.sdkClient.ListCertInfo(listCertInfoReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Wrap(err, "failed to execute sdk request 'cdn.ListCertInfo'")
|
return nil, xerrors.Wrap(err, "failed to execute sdk request 'cdn.ListCertInfo'")
|
||||||
}
|
}
|
||||||
|
|
||||||
if listCertResp.Result.CertInfo != nil {
|
if listCertInfoResp.Result.CertInfo != nil {
|
||||||
for _, certDetail := range listCertResp.Result.CertInfo {
|
for _, certDetail := range listCertInfoResp.Result.CertInfo {
|
||||||
hash := sha256.Sum256(certX509.Raw)
|
hash := sha256.Sum256(certX509.Raw)
|
||||||
isSameCert := strings.EqualFold(hex.EncodeToString(hash[:]), certDetail.CertFingerprint.Sha256)
|
isSameCert := strings.EqualFold(hex.EncodeToString(hash[:]), certDetail.CertFingerprint.Sha256)
|
||||||
// 如果已存在相同证书,直接返回已有的证书信息
|
// 如果已存在相同证书,直接返回已有的证书信息
|
||||||
@ -80,8 +80,8 @@ func (u *VolcengineCDNUploader) Upload(ctx context.Context, certPem string, priv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTotal += len(listCertResp.Result.CertInfo)
|
searchTotal += len(listCertInfoResp.Result.CertInfo)
|
||||||
if int(listCertResp.Result.Total) > searchTotal {
|
if int(listCertInfoResp.Result.Total) > searchTotal {
|
||||||
pageNum++
|
pageNum++
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
@ -99,12 +99,12 @@ func (u *VolcengineCDNUploader) Upload(ctx context.Context, certPem string, priv
|
|||||||
Source: &certSource,
|
Source: &certSource,
|
||||||
Desc: &certName,
|
Desc: &certName,
|
||||||
}
|
}
|
||||||
createCertResp, err := u.sdkClient.AddCertificate(addCertificateReq)
|
addCertificateResp, err := u.sdkClient.AddCertificate(addCertificateReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Wrap(err, "failed to execute sdk request 'cdn.AddCertificate'")
|
return nil, xerrors.Wrap(err, "failed to execute sdk request 'cdn.AddCertificate'")
|
||||||
}
|
}
|
||||||
|
|
||||||
certId = createCertResp.Result.CertId
|
certId = addCertificateResp.Result.CertId
|
||||||
return &uploader.UploadResult{
|
return &uploader.UploadResult{
|
||||||
CertId: certId,
|
CertId: certId,
|
||||||
CertName: certName,
|
CertName: certName,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user