fix(provider): wrong sdk definations

This commit is contained in:
Fu Diwei 2025-12-30 14:01:31 +08:00 committed by RHQYZ
parent 56451b4d24
commit f76cb563d0
3 changed files with 12 additions and 9 deletions

View File

@ -80,10 +80,15 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*dep
d.logger.Debug("sdk request 'faas.GetCustomDomain'", slog.Any("request", getCustomDomainReq), slog.Any("response", getCustomDomainResp))
if err != nil {
return nil, fmt.Errorf("failed to execute sdk request 'faas.GetCustomDomain': %w", err)
} else if getCustomDomainResp.ReturnObj == nil || len(getCustomDomainResp.ReturnObj.Data) == 0 {
return nil, fmt.Errorf("could not find custom domain '%s'", d.config.Domain)
} else {
faasCustomDomain = getCustomDomainResp.ReturnObj.Data[0]
faasCustomDomain = getCustomDomainResp.ReturnObj
// 已部署过此域名,跳过
if faasCustomDomain.CertConfig != nil &&
faasCustomDomain.CertConfig.Certificate == certPEM &&
faasCustomDomain.CertConfig.PrivateKey == privkeyPEM {
return &deployer.DeployResult{}, nil
}
}
// 更新自定义域名

View File

@ -10,17 +10,15 @@ import (
)
type GetCustomDomainRequest struct {
RegionId *string `json:"-"`
DomainName *string `json:"domainName,omitempty"`
RegionId *string `json:"-" url:"-"`
DomainName *string `json:"domainName,omitempty" url:"-"`
CnameCheck *bool `json:"cnameCheck,omitempty" url:"cnameCheck,omitempty"`
}
type GetCustomDomainResponse struct {
apiResponseBase
ReturnObj *struct {
Data []*CustomDomainRecord `json:"data,omitempty"`
} `json:"returnObj,omitempty"`
ReturnObj *CustomDomainRecord `json:"returnObj,omitempty"`
}
func (c *Client) GetCustomDomain(req *GetCustomDomainRequest) (*GetCustomDomainResponse, error) {

View File

@ -39,7 +39,7 @@ func (c *Client) doRequest(req *resty.Request) (*resty.Response, error) {
func (c *Client) doRequestWithResult(req *resty.Request, res apiResponse) (*resty.Response, error) {
resp, err := c.client.DoRequestWithResult(req, res)
if err == nil {
if tcode := res.GetStatusCode(); tcode != "" && tcode != "100000" {
if tcode := res.GetStatusCode(); tcode != "" && tcode != "0" {
return resp, fmt.Errorf("sdkerr: api error: code='%s', message='%s', errorCode='%s', errorMessage='%s'", tcode, res.GetMessage(), res.GetMessage(), res.GetErrorMessage())
}
}