Merge pull request #314 from fudiwei/bugfix/dogecloud-api-error

bugfix #313
This commit is contained in:
usual2970 2024-11-08 08:10:18 +08:00 committed by GitHub
commit 0a00d0c52f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 31 additions and 25 deletions

View File

@ -75,8 +75,10 @@ make local.run
| :--------: | :----------: | :----------: | ----------------------------------------------------------------- | | :--------: | :----------: | :----------: | ----------------------------------------------------------------- |
| 阿里云 | √ | √ | 可签发在阿里云注册的域名;可部署到阿里云 OSS、CDN、SLB | | 阿里云 | √ | √ | 可签发在阿里云注册的域名;可部署到阿里云 OSS、CDN、SLB |
| 腾讯云 | √ | √ | 可签发在腾讯云注册的域名;可部署到腾讯云 COS、CDN、ECDN、CLB、TEO | | 腾讯云 | √ | √ | 可签发在腾讯云注册的域名;可部署到腾讯云 COS、CDN、ECDN、CLB、TEO |
| 百度智能云 | | √ | 可部署到百度智能云 CDN |
| 华为云 | √ | √ | 可签发在华为云注册的域名;可部署到华为云 CDN、ELB | | 华为云 | √ | √ | 可签发在华为云注册的域名;可部署到华为云 CDN、ELB |
| 七牛云 | | √ | 可部署到七牛云 CDN | | 七牛云 | | √ | 可部署到七牛云 CDN |
| 多吉云 | | √ | 可部署到多吉云 CDN |
| AWS | √ | | 可签发在 AWS Route53 托管的域名 | | AWS | √ | | 可签发在 AWS Route53 托管的域名 |
| CloudFlare | √ | | 可签发在 CloudFlare 注册的域名CloudFlare 服务自带 SSL 证书 | | CloudFlare | √ | | 可签发在 CloudFlare 注册的域名CloudFlare 服务自带 SSL 证书 |
| GoDaddy | √ | | 可签发在 GoDaddy 注册的域名 | | GoDaddy | √ | | 可签发在 GoDaddy 注册的域名 |

View File

@ -71,11 +71,13 @@ password1234567890
## List of Supported Providers ## List of Supported Providers
| Provider | Registration | Deployment | Remarks | | Provider | Registration | Deployment | Remarks |
| :-----------: | :----------: | :--------: | --------------------------------------------------------------------------------------------------------------------- | | :-----------: | :----------: | :--------: | ----------------------------------------------------------------------------------------------------------- |
| Alibaba Cloud | √ | √ | Supports domains registered on Alibaba Cloud; supports deployment to Alibaba Cloud OSS, CDN,SLB | | Alibaba Cloud | √ | √ | Supports domains registered on Alibaba Cloud; supports deployment to Alibaba Cloud OSS, CDN,SLB |
| Tencent Cloud | √ | √ | Supports domains registered on Tencent Cloud; supports deployment to Tencent Cloud COS, CDN, ECDN, CLB, TEO | | Tencent Cloud | √ | √ | Supports domains registered on Tencent Cloud; supports deployment to Tencent Cloud COS, CDN, ECDN, CLB, TEO |
| Baidu Cloud | | √ | Supports deployment to Baidu Cloud CDN |
| Huawei Cloud | √ | √ | Supports domains registered on Huawei Cloud; supports deployment to Huawei Cloud CDN, ELB | | Huawei Cloud | √ | √ | Supports domains registered on Huawei Cloud; supports deployment to Huawei Cloud CDN, ELB |
| Qiniu Cloud | | √ | Supports deployment to Qiniu Cloud CDN | | Qiniu Cloud | | √ | Supports deployment to Qiniu Cloud CDN |
| Doge Cloud | | √ | Supports deployment to Doge Cloud CDN |
| AWS | √ | | Supports domains managed on AWS Route53 | | AWS | √ | | Supports domains managed on AWS Route53 |
| CloudFlare | √ | | Supports domains registered on CloudFlare; CloudFlare services come with SSL certificates | | CloudFlare | √ | | Supports domains registered on CloudFlare; CloudFlare services come with SSL certificates |
| GoDaddy | √ | | Supports domains registered on GoDaddy | | GoDaddy | √ | | Supports domains registered on GoDaddy |

View File

@ -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'")
} }

View File

@ -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,

View File

@ -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,

View File

@ -12,20 +12,20 @@ type UploadCdnCertRequest struct {
} }
type UploadCdnCertResponseData struct { type UploadCdnCertResponseData struct {
Id string `json:"id"` Id int64 `json:"id"`
} }
type UploadCdnCertResponse struct { type UploadCdnCertResponse struct {
*BaseResponse BaseResponse
Data *UploadCdnCertResponseData `json:"data,omitempty"` Data *UploadCdnCertResponseData `json:"data,omitempty"`
} }
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"`
} }
type BindCdnCertResponse struct { type BindCdnCertResponse struct {
*BaseResponse BaseResponse
} }