feat: add dogecloud cdn deployer

This commit is contained in:
Fu Diwei
2024-11-04 10:34:05 +08:00
parent 8a78e49bf0
commit 1e41020728
12 changed files with 450 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ import (
xhttp "github.com/usual2970/certimate/internal/utils/http"
)
const qiniuHost = "http://api.qiniu.com"
const qiniuHost = "https://api.qiniu.com"
type Client struct {
mac *auth.Credentials
@@ -129,7 +129,7 @@ func (c *Client) UploadSslCert(name, commonName, pri, ca string) (*UploadSslCert
return nil, err
}
if resp.Code != nil && *resp.Code != 0 && *resp.Code != 200 {
return nil, fmt.Errorf("code: %d, error: %s", *resp.Code, *resp.Error)
return nil, fmt.Errorf("qiniu api error, code: %d, error: %s", *resp.Code, *resp.Error)
}
return resp, nil

View File

@@ -1,5 +1,10 @@
package qiniusdk
type BaseResponse struct {
Code *int `json:"code,omitempty"`
Error *string `json:"error,omitempty"`
}
type UploadSslCertRequest struct {
Name string `json:"name"`
CommonName string `json:"common_name"`
@@ -8,9 +13,8 @@ type UploadSslCertRequest struct {
}
type UploadSslCertResponse struct {
Code *int `json:"code,omitempty"`
Error *string `json:"error,omitempty"`
CertID string `json:"certID"`
*BaseResponse
CertID string `json:"certID"`
}
type DomainInfoHttpsData struct {
@@ -20,8 +24,7 @@ type DomainInfoHttpsData struct {
}
type GetDomainInfoResponse struct {
Code *int `json:"code,omitempty"`
Error *string `json:"error,omitempty"`
*BaseResponse
Name string `json:"name"`
Type string `json:"type"`
CName string `json:"cname"`
@@ -39,8 +42,7 @@ type ModifyDomainHttpsConfRequest struct {
}
type ModifyDomainHttpsConfResponse struct {
Code *int `json:"code,omitempty"`
Error *string `json:"error,omitempty"`
*BaseResponse
}
type EnableDomainHttpsRequest struct {
@@ -48,6 +50,5 @@ type EnableDomainHttpsRequest struct {
}
type EnableDomainHttpsResponse struct {
Code *int `json:"code,omitempty"`
Error *string `json:"error,omitempty"`
*BaseResponse
}