This commit is contained in:
Fu Diwei
2025-11-05 16:19:53 +08:00
parent fc9c52f722
commit 0cbbd9fba2
11 changed files with 44 additions and 44 deletions
@@ -5,18 +5,18 @@ import (
"github.com/certimate-go/certimate/internal/domain"
"github.com/certimate-go/certimate/pkg/core"
aliyunddos "github.com/certimate-go/certimate/pkg/core/ssl-deployer/providers/aliyun-ddos"
aliyunddospro "github.com/certimate-go/certimate/pkg/core/ssl-deployer/providers/aliyun-ddospro"
xmaps "github.com/certimate-go/certimate/pkg/utils/maps"
)
func init() {
if err := Registries.Register(domain.DeploymentProviderTypeAliyunDDoS, func(options *ProviderFactoryOptions) (core.SSLDeployer, error) {
if err := Registries.Register(domain.DeploymentProviderTypeAliyunDDoSPro, func(options *ProviderFactoryOptions) (core.SSLDeployer, error) {
credentials := domain.AccessConfigForAliyun{}
if err := xmaps.Populate(options.ProviderAccessConfig, &credentials); err != nil {
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
}
provider, err := aliyunddos.NewSSLDeployerProvider(&aliyunddos.SSLDeployerProviderConfig{
provider, err := aliyunddospro.NewSSLDeployerProvider(&aliyunddospro.SSLDeployerProviderConfig{
AccessKeyId: credentials.AccessKeyId,
AccessKeySecret: credentials.AccessKeySecret,
ResourceGroupId: credentials.ResourceGroupId,
+1 -1
View File
@@ -230,7 +230,7 @@ const (
DeploymentProviderTypeAliyunCDN = DeploymentProviderType(AccessProviderTypeAliyun + "-cdn")
DeploymentProviderTypeAliyunCLB = DeploymentProviderType(AccessProviderTypeAliyun + "-clb")
DeploymentProviderTypeAliyunDCDN = DeploymentProviderType(AccessProviderTypeAliyun + "-dcdn")
DeploymentProviderTypeAliyunDDoS = DeploymentProviderType(AccessProviderTypeAliyun + "-ddos")
DeploymentProviderTypeAliyunDDoSPro = DeploymentProviderType(AccessProviderTypeAliyun + "-ddospro")
DeploymentProviderTypeAliyunESA = DeploymentProviderType(AccessProviderTypeAliyun + "-esa")
DeploymentProviderTypeAliyunFC = DeploymentProviderType(AccessProviderTypeAliyun + "-fc")
DeploymentProviderTypeAliyunGA = DeploymentProviderType(AccessProviderTypeAliyun + "-ga")
@@ -1,4 +1,4 @@
package aliyunddos
package aliyunddospro
import (
"context"
@@ -9,7 +9,7 @@ import (
"strings"
aliopen "github.com/alibabacloud-go/darabonba-openapi/v2/client"
aliddos "github.com/alibabacloud-go/ddoscoo-20200101/v4/client"
aliddoscoo "github.com/alibabacloud-go/ddoscoo-20200101/v4/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/samber/lo"
@@ -33,7 +33,7 @@ type SSLDeployerProviderConfig struct {
type SSLDeployerProvider struct {
config *SSLDeployerProviderConfig
logger *slog.Logger
sdkClient *aliddos.Client
sdkClient *aliddoscoo.Client
sslManager core.SSLManager
}
@@ -95,7 +95,7 @@ func (d *SSLDeployerProvider) Deploy(ctx context.Context, certPEM string, privke
// 为网站业务转发规则关联 SSL 证书
// REF: https://help.aliyun.com/zh/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-associatewebcert
certId, _ := strconv.ParseInt(upres.CertId, 10, 32)
associateWebCertReq := &aliddos.AssociateWebCertRequest{
associateWebCertReq := &aliddoscoo.AssociateWebCertRequest{
Domain: tea.String(d.config.Domain),
CertId: tea.Int32(int32(certId)),
}
@@ -108,7 +108,7 @@ func (d *SSLDeployerProvider) Deploy(ctx context.Context, certPEM string, privke
return &core.SSLDeployResult{}, nil
}
func createSDKClient(accessKeyId, accessKeySecret, region string) (*aliddos.Client, error) {
func createSDKClient(accessKeyId, accessKeySecret, region string) (*aliddoscoo.Client, error) {
// 接入点一览 https://api.aliyun.com/product/ddoscoo
var endpoint string
switch region {
@@ -124,7 +124,7 @@ func createSDKClient(accessKeyId, accessKeySecret, region string) (*aliddos.Clie
Endpoint: tea.String(endpoint),
}
client, err := aliddos.NewClient(config)
client, err := aliddoscoo.NewClient(config)
if err != nil {
return nil, err
}
@@ -1,4 +1,4 @@
package aliyunddos_test
package aliyunddospro_test
import (
"context"
@@ -8,7 +8,7 @@ import (
"strings"
"testing"
provider "github.com/certimate-go/certimate/pkg/core/ssl-deployer/providers/aliyun-ddos"
provider "github.com/certimate-go/certimate/pkg/core/ssl-deployer/providers/aliyun-ddospro"
)
var (
@@ -21,7 +21,7 @@ var (
)
func init() {
argsPrefix := "CERTIMATE_SSLDEPLOYER_ALIYUNDDOS_"
argsPrefix := "CERTIMATE_SSLDEPLOYER_ALIYUNDDOSPRO_"
flag.StringVar(&fInputCertPath, argsPrefix+"INPUTCERTPATH", "", "")
flag.StringVar(&fInputKeyPath, argsPrefix+"INPUTKEYPATH", "", "")
@@ -34,13 +34,13 @@ func init() {
/*
Shell command to run this test:
go test -v ./aliyun_ddos_test.go -args \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOS_INPUTCERTPATH="/path/to/your-input-cert.pem" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOS_INPUTKEYPATH="/path/to/your-input-key.pem" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOS_ACCESSKEYID="your-access-key-id" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOS_ACCESSKEYSECRET="your-access-key-secret" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOS_REGION="cn-hangzhou" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOS_DOMAIN="example.com"
go test -v ./aliyun_ddospro_test.go -args \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOSPRO_INPUTCERTPATH="/path/to/your-input-cert.pem" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOSPRO_INPUTKEYPATH="/path/to/your-input-key.pem" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOSPRO_ACCESSKEYID="your-access-key-id" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOSPRO_ACCESSKEYSECRET="your-access-key-secret" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOSPRO_REGION="cn-hangzhou" \
--CERTIMATE_SSLDEPLOYER_ALIYUNDDOSPRO_DOMAIN="example.com"
*/
func TestDeploy(t *testing.T) {
flag.Parse()
@@ -112,7 +112,7 @@ const providerComponentMap: Partial<Record<DeploymentProviderType, React.Compone
[DEPLOYMENT_PROVIDERS.ALIYUN_CLB]: BizDeployNodeConfigFieldsProviderAliyunCLB,
[DEPLOYMENT_PROVIDERS.ALIYUN_CDN]: BizDeployNodeConfigFieldsProviderAliyunCDN,
[DEPLOYMENT_PROVIDERS.ALIYUN_DCDN]: BizDeployNodeConfigFieldsProviderAliyunDCDN,
[DEPLOYMENT_PROVIDERS.ALIYUN_DDOS]: BizDeployNodeConfigFieldsProviderAliyunDDoS,
[DEPLOYMENT_PROVIDERS.ALIYUN_DDOSPRO]: BizDeployNodeConfigFieldsProviderAliyunDDoS,
[DEPLOYMENT_PROVIDERS.ALIYUN_ESA]: BizDeployNodeConfigFieldsProviderAliyunESA,
[DEPLOYMENT_PROVIDERS.ALIYUN_FC]: BizDeployNodeConfigFieldsProviderAliyunFC,
[DEPLOYMENT_PROVIDERS.ALIYUN_GA]: BizDeployNodeConfigFieldsProviderAliyunGA,
@@ -22,21 +22,21 @@ const BizDeployNodeConfigFieldsProviderAliyunDDoS = () => {
<Form.Item
name={[parentNamePath, "region"]}
initialValue={initialValues.region}
label={t("workflow_node.deploy.form.aliyun_ddos_region.label")}
label={t("workflow_node.deploy.form.aliyun_ddospro_region.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_ddos_region.tooltip") }}></span>}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_ddospro_region.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.aliyun_ddos_region.placeholder")} />
<Input placeholder={t("workflow_node.deploy.form.aliyun_ddospro_region.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "domain"]}
initialValue={initialValues.domain}
label={t("workflow_node.deploy.form.aliyun_ddos_domain.label")}
label={t("workflow_node.deploy.form.aliyun_ddospro_domain.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_ddos_domain.tooltip") }}></span>}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_ddospro_domain.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.aliyun_ddos_domain.placeholder")} />
<Input placeholder={t("workflow_node.deploy.form.aliyun_ddospro_domain.placeholder")} />
</Form.Item>
</>
);
@@ -53,7 +53,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
const { t } = i18n;
return z.object({
region: z.string().nonempty(t("workflow_node.deploy.form.aliyun_ddos_region.placeholder")),
region: z.string().nonempty(t("workflow_node.deploy.form.aliyun_ddospro_region.placeholder")),
domain: z.string().refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
});
};
+2 -2
View File
@@ -480,7 +480,7 @@ export const DEPLOYMENT_PROVIDERS = Object.freeze({
ALIYUN_CDN: `${ACCESS_PROVIDERS.ALIYUN}-cdn`,
ALIYUN_CLB: `${ACCESS_PROVIDERS.ALIYUN}-clb`,
ALIYUN_DCDN: `${ACCESS_PROVIDERS.ALIYUN}-dcdn`,
ALIYUN_DDOS: `${ACCESS_PROVIDERS.ALIYUN}-ddospro`,
ALIYUN_DDOSPRO: `${ACCESS_PROVIDERS.ALIYUN}-ddospro`,
ALIYUN_ESA: `${ACCESS_PROVIDERS.ALIYUN}-esa`,
ALIYUN_FC: `${ACCESS_PROVIDERS.ALIYUN}-fc`,
ALIYUN_GA: `${ACCESS_PROVIDERS.ALIYUN}-ga`,
@@ -617,7 +617,7 @@ export const deploymentProvidersMap: Map<DeploymentProvider["type"] | string, De
[DEPLOYMENT_PROVIDERS.ALIYUN_ALB, "provider.aliyun.alb", DEPLOYMENT_CATEGORIES.LOADBALANCE],
[DEPLOYMENT_PROVIDERS.ALIYUN_NLB, "provider.aliyun.nlb", DEPLOYMENT_CATEGORIES.LOADBALANCE],
[DEPLOYMENT_PROVIDERS.ALIYUN_WAF, "provider.aliyun.waf", DEPLOYMENT_CATEGORIES.FIREWALL],
[DEPLOYMENT_PROVIDERS.ALIYUN_DDOS, "provider.aliyun.ddos", DEPLOYMENT_CATEGORIES.FIREWALL],
[DEPLOYMENT_PROVIDERS.ALIYUN_DDOSPRO, "provider.aliyun.ddospro", DEPLOYMENT_CATEGORIES.FIREWALL],
[DEPLOYMENT_PROVIDERS.ALIYUN_LIVE, "provider.aliyun.live", DEPLOYMENT_CATEGORIES.AV],
[DEPLOYMENT_PROVIDERS.ALIYUN_VOD, "provider.aliyun.vod", DEPLOYMENT_CATEGORIES.AV],
[DEPLOYMENT_PROVIDERS.ALIYUN_FC, "provider.aliyun.fc", DEPLOYMENT_CATEGORIES.SERVERLESS],
+1 -1
View File
@@ -14,7 +14,7 @@
"provider.aliyun.cdn": "Alibaba Cloud - CDN (Content Delivery Network)",
"provider.aliyun.clb": "Alibaba Cloud - CLB (Classic Load Balancer)",
"provider.aliyun.dcdn": "Alibaba Cloud - DCDN (Dynamic Route for Content Delivery Network)",
"provider.aliyun.ddos": "Alibaba Cloud - Anti-DDoS Proxy",
"provider.aliyun.ddospro": "Alibaba Cloud - Anti-DDoS Proxy",
"provider.aliyun.dns": "Alibaba Cloud - DNS",
"provider.aliyun.esa": "Alibaba Cloud - ESA (Edge Security Acceleration)",
"provider.aliyun.fc": "Alibaba Cloud - FC (Function Compute)",
@@ -293,12 +293,12 @@
"workflow_node.deploy.form.aliyun_dcdn_domain.label": "Alibaba Cloud DCDN domain",
"workflow_node.deploy.form.aliyun_dcdn_domain.placeholder": "Please enter Alibaba Cloud DCDN domain name",
"workflow_node.deploy.form.aliyun_dcdn_domain.tooltip": "For more information, see <a href=\"https://dcdn.console.aliyun.com\" target=\"_blank\">https://dcdn.console.aliyun.com</a>",
"workflow_node.deploy.form.aliyun_ddos_region.label": "Alibaba Cloud Anti-DDoS region",
"workflow_node.deploy.form.aliyun_ddos_region.placeholder": "Please enter Alibaba Cloud Anti-DDoS region (e.g. cn-hangzhou)",
"workflow_node.deploy.form.aliyun_ddos_region.tooltip": "For more information, see <a href=\"https://www.alibabacloud.com/help/en/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint\" target=\"_blank\">https://www.alibabacloud.com/help/en/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint</a>",
"workflow_node.deploy.form.aliyun_ddos_domain.label": "Alibaba Cloud Anti-DDoS domain",
"workflow_node.deploy.form.aliyun_ddos_domain.placeholder": "Please enter Alibaba Cloud Anti-DDoS domain name",
"workflow_node.deploy.form.aliyun_ddos_domain.tooltip": "For more information, see <a href=\"https://yundun.console.aliyun.com/?p=ddoscoo#/overview/layer4/ap-southeast-1\" target=\"_blank\">https://yundun.console.aliyun.com/?p=ddoscoo</a>",
"workflow_node.deploy.form.aliyun_ddospro_region.label": "Alibaba Cloud Anti-DDoS region",
"workflow_node.deploy.form.aliyun_ddospro_region.placeholder": "Please enter Alibaba Cloud Anti-DDoS region (e.g. cn-hangzhou)",
"workflow_node.deploy.form.aliyun_ddospro_region.tooltip": "For more information, see <a href=\"https://www.alibabacloud.com/help/en/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint\" target=\"_blank\">https://www.alibabacloud.com/help/en/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint</a>",
"workflow_node.deploy.form.aliyun_ddospro_domain.label": "Alibaba Cloud Anti-DDoS domain",
"workflow_node.deploy.form.aliyun_ddospro_domain.placeholder": "Please enter Alibaba Cloud Anti-DDoS domain name",
"workflow_node.deploy.form.aliyun_ddospro_domain.tooltip": "For more information, see <a href=\"https://yundun.console.aliyun.com/?p=ddoscoo#/overview/layer4/ap-southeast-1\" target=\"_blank\">https://yundun.console.aliyun.com/?p=ddoscoo</a>",
"workflow_node.deploy.form.aliyun_esa_region.label": "Alibaba Cloud ESA region",
"workflow_node.deploy.form.aliyun_esa_region.placeholder": "Please enter Alibaba Cloud ESA region (e.g. cn-hangzhou)",
"workflow_node.deploy.form.aliyun_esa_region.tooltip": "For more information, see <a href=\"https://www.alibabacloud.com/help/en/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint\" target=\"_blank\">https://www.alibabacloud.com/help/en/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint</a>",
+1 -1
View File
@@ -14,7 +14,7 @@
"provider.aliyun.cdn": "阿里云 - 内容分发网络 CDN",
"provider.aliyun.clb": "阿里云 - 传统型负载均衡 CLB",
"provider.aliyun.dcdn": "阿里云 - 全站加速 DCDN",
"provider.aliyun.ddos": "阿里云 - DDoS 高防",
"provider.aliyun.ddospro": "阿里云 - DDoS 高防",
"provider.aliyun.dns": "阿里云 - 云解析 DNS",
"provider.aliyun.esa": "阿里云 - 边缘安全加速 ESA",
"provider.aliyun.fc": "阿里云 - 函数计算 FC",
@@ -292,12 +292,12 @@
"workflow_node.deploy.form.aliyun_dcdn_domain.label": "阿里云 DCDN 加速域名",
"workflow_node.deploy.form.aliyun_dcdn_domain.placeholder": "请输入阿里云 DCDN 加速域名(支持泛域名)",
"workflow_node.deploy.form.aliyun_dcdn_domain.tooltip": "这是什么?请参阅 <a href=\"https://dcdn.console.aliyun.com\" target=\"_blank\">https://dcdn.console.aliyun.com</a>",
"workflow_node.deploy.form.aliyun_ddos_region.label": "阿里云 DDoS 高防服务地域",
"workflow_node.deploy.form.aliyun_ddos_region.placeholder": "请输入阿里云 DDoS 高防服务地域(例如:cn-hangzhou)",
"workflow_node.deploy.form.aliyun_ddos_region.tooltip": "这是什么?请参阅 <a href=\"https://help.aliyun.com/zh/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint\" target=\"_blank\">https://help.aliyun.com/zh/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint</a>",
"workflow_node.deploy.form.aliyun_ddos_domain.label": "阿里云 DDoS 高防网站域名",
"workflow_node.deploy.form.aliyun_ddos_domain.placeholder": "请输入阿里云 DDoS 高防网站域名(支持泛域名)",
"workflow_node.deploy.form.aliyun_ddos_domain.tooltip": "这是什么?请参阅 <a href=\"https://yundun.console.aliyun.com/?p=ddoscoo#/overview/layer4/cn-hangzhou\" target=\"_blank\">https://yundun.console.aliyun.com/?p=ddoscoo</a>",
"workflow_node.deploy.form.aliyun_ddospro_region.label": "阿里云 DDoS 高防服务地域",
"workflow_node.deploy.form.aliyun_ddospro_region.placeholder": "请输入阿里云 DDoS 高防服务地域(例如:cn-hangzhou)",
"workflow_node.deploy.form.aliyun_ddospro_region.tooltip": "这是什么?请参阅 <a href=\"https://help.aliyun.com/zh/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint\" target=\"_blank\">https://help.aliyun.com/zh/anti-ddos/anti-ddos-pro-and-premium/developer-reference/api-ddoscoo-2020-01-01-endpoint</a>",
"workflow_node.deploy.form.aliyun_ddospro_domain.label": "阿里云 DDoS 高防网站域名",
"workflow_node.deploy.form.aliyun_ddospro_domain.placeholder": "请输入阿里云 DDoS 高防网站域名(支持泛域名)",
"workflow_node.deploy.form.aliyun_ddospro_domain.tooltip": "这是什么?请参阅 <a href=\"https://yundun.console.aliyun.com/?p=ddoscoo#/overview/layer4/cn-hangzhou\" target=\"_blank\">https://yundun.console.aliyun.com/?p=ddoscoo</a>",
"workflow_node.deploy.form.aliyun_esa_region.label": "阿里云 ESA 服务地域",
"workflow_node.deploy.form.aliyun_esa_region.placeholder": "请输入阿里云 ESA 服务地域(例如:cn-hangzhou)",
"workflow_node.deploy.form.aliyun_esa_region.tooltip": "这是什么?请参阅 <a href=\"https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint\" target=\"_blank\">https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint</a>",