mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-19 01:41:55 +08:00
fix: #313
This commit is contained in:
parent
44332b9d07
commit
5d2844fdb6
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
xerrors "github.com/pkg/errors"
|
xerrors "github.com/pkg/errors"
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ func (d *DogeCloudCDNDeployer) Deploy(ctx context.Context) error {
|
|||||||
|
|
||||||
// 绑定证书
|
// 绑定证书
|
||||||
// REF: https://docs.dogecloud.com/cdn/api-cert-bind
|
// REF: https://docs.dogecloud.com/cdn/api-cert-bind
|
||||||
bindCdnCertResp, err := d.sdkClient.BindCdnCertWithDomain(upres.CertId, d.option.DeployConfig.GetConfigAsString("domain"))
|
bindCdnCertId, _ := strconv.ParseInt(upres.CertId, 10, 64)
|
||||||
|
bindCdnCertResp, err := d.sdkClient.BindCdnCertWithDomain(bindCdnCertId, d.option.DeployConfig.GetConfigAsString("domain"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Wrap(err, "failed to execute sdk request 'cdn.BindCdnCert'")
|
return xerrors.Wrap(err, "failed to execute sdk request 'cdn.BindCdnCert'")
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ func (u *DogeCloudUploader) Upload(ctx context.Context, certPem string, privkeyP
|
|||||||
return nil, xerrors.Wrap(err, "failed to execute sdk request 'cdn.UploadCdnCert'")
|
return nil, xerrors.Wrap(err, "failed to execute sdk request 'cdn.UploadCdnCert'")
|
||||||
}
|
}
|
||||||
|
|
||||||
certId = uploadSslCertResp.Data.Id
|
certId = fmt.Sprintf("%d", uploadSslCertResp.Data.Id)
|
||||||
return &uploader.UploadResult{
|
return &uploader.UploadResult{
|
||||||
CertId: certId,
|
CertId: certId,
|
||||||
CertName: certName,
|
CertName: certName,
|
||||||
|
4
internal/pkg/vendors/dogecloud-sdk/client.go
vendored
4
internal/pkg/vendors/dogecloud-sdk/client.go
vendored
@ -58,7 +58,7 @@ func (c *Client) UploadCdnCert(note, cert, private string) (*UploadCdnCertRespon
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) BindCdnCertWithDomain(certId string, domain string) (*BindCdnCertResponse, error) {
|
func (c *Client) BindCdnCertWithDomain(certId int64, domain string) (*BindCdnCertResponse, error) {
|
||||||
req := &BindCdnCertRequest{
|
req := &BindCdnCertRequest{
|
||||||
CertId: certId,
|
CertId: certId,
|
||||||
Domain: &domain,
|
Domain: &domain,
|
||||||
@ -92,7 +92,7 @@ func (c *Client) BindCdnCertWithDomain(certId string, domain string) (*BindCdnCe
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) BindCdnCertWithDomainId(certId string, domainId int32) (*BindCdnCertResponse, error) {
|
func (c *Client) BindCdnCertWithDomainId(certId int64, domainId int64) (*BindCdnCertResponse, error) {
|
||||||
req := &BindCdnCertRequest{
|
req := &BindCdnCertRequest{
|
||||||
CertId: certId,
|
CertId: certId,
|
||||||
DomainId: &domainId,
|
DomainId: &domainId,
|
||||||
|
6
internal/pkg/vendors/dogecloud-sdk/models.go
vendored
6
internal/pkg/vendors/dogecloud-sdk/models.go
vendored
@ -12,7 +12,7 @@ type UploadCdnCertRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UploadCdnCertResponseData struct {
|
type UploadCdnCertResponseData struct {
|
||||||
Id string `json:"id"`
|
Id int64 `json:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadCdnCertResponse struct {
|
type UploadCdnCertResponse struct {
|
||||||
@ -21,8 +21,8 @@ type UploadCdnCertResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BindCdnCertRequest struct {
|
type BindCdnCertRequest struct {
|
||||||
CertId string `json:"id"`
|
CertId int64 `json:"id"`
|
||||||
DomainId *int32 `json:"did,omitempty"`
|
DomainId *int64 `json:"did,omitempty"`
|
||||||
Domain *string `json:"domain,omitempty"`
|
Domain *string `json:"domain,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user