feat(provider): add configurable endpoint to all ucloud services

This commit is contained in:
Fu Diwei
2026-07-31 09:26:46 +08:00
committed by RHQYZ
parent 6e1ec855ca
commit baceeb0996
41 changed files with 701 additions and 37 deletions

2
go.mod
View File

@@ -64,7 +64,6 @@ require (
github.com/qiniu/go-sdk/v7 v7.26.18
github.com/samber/lo v1.53.0
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.3.116
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.3.142
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.3.145
@@ -259,6 +258,7 @@ require (
github.com/sony/gobreaker/v2 v2.4.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/tinylib/msgp v1.6.4 // indirect
github.com/tjfoc/gmsm v1.4.1 // indirect
github.com/yandex-cloud/go-sdk/services/dns v0.0.65 // indirect

View File

@@ -20,6 +20,7 @@ func init() {
PrivateKey: credentials.PrivateKey,
PublicKey: credentials.PublicKey,
ProjectId: credentials.ProjectId,
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
DnsPropagationTimeout: options.DnsPropagationTimeout,
DnsTTL: options.DnsTTL,
})

View File

@@ -20,6 +20,7 @@ func init() {
PrivateKey: credentials.PrivateKey,
PublicKey: credentials.PublicKey,
ProjectId: credentials.ProjectId,
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
Region: xmaps.GetString(options.ProviderExtendedConfig, "region"),
DeployTarget: xmaps.GetString(options.ProviderExtendedConfig, "deployTarget"),
LoadbalancerId: xmaps.GetString(options.ProviderExtendedConfig, "loadbalancerId"),

View File

@@ -20,6 +20,7 @@ func init() {
PrivateKey: credentials.PrivateKey,
PublicKey: credentials.PublicKey,
ProjectId: credentials.ProjectId,
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
DomainId: xmaps.GetString(options.ProviderExtendedConfig, "domainId"),
})
return provider, err

View File

@@ -20,6 +20,7 @@ func init() {
PrivateKey: credentials.PrivateKey,
PublicKey: credentials.PublicKey,
ProjectId: credentials.ProjectId,
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
Region: xmaps.GetString(options.ProviderExtendedConfig, "region"),
DeployTarget: xmaps.GetString(options.ProviderExtendedConfig, "deployTarget"),
LoadbalancerId: xmaps.GetString(options.ProviderExtendedConfig, "loadbalancerId"),

View File

@@ -20,6 +20,7 @@ func init() {
PrivateKey: credentials.PrivateKey,
PublicKey: credentials.PublicKey,
ProjectId: credentials.ProjectId,
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
Domain: xmaps.GetString(options.ProviderExtendedConfig, "domain"),
})
return provider, err

View File

@@ -20,6 +20,7 @@ func init() {
PrivateKey: credentials.PrivateKey,
PublicKey: credentials.PublicKey,
ProjectId: credentials.ProjectId,
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
AcceleratorId: xmaps.GetString(options.ProviderExtendedConfig, "acceleratorId"),
ListenerPort: xmaps.GetInt32(options.ProviderExtendedConfig, "listenerPort"),
})

View File

@@ -20,6 +20,7 @@ func init() {
PrivateKey: credentials.PrivateKey,
PublicKey: credentials.PublicKey,
ProjectId: credentials.ProjectId,
Endpoint: xmaps.GetString(options.ProviderExtendedConfig, "endpoint"),
Region: xmaps.GetString(options.ProviderExtendedConfig, "region"),
Bucket: xmaps.GetString(options.ProviderExtendedConfig, "bucket"),
Domain: xmaps.GetString(options.ProviderExtendedConfig, "domain"),

View File

@@ -0,0 +1,186 @@
package internal
import (
"context"
"errors"
"fmt"
"strconv"
"strings"
"time"
"github.com/go-acme/lego/v5/challenge"
"github.com/go-acme/lego/v5/challenge/dns01"
"github.com/go-acme/lego/v5/platform/env"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
ucloudsdk "github.com/certimate-go/certimate/pkg/sdk3rd/ucloud/udnr"
)
const (
envNamespace = "UCLOUD_"
EnvPublicKey = envNamespace + "PUBLIC_KEY"
EnvPrivateKey = envNamespace + "PRIVATE_KEY"
EnvProjectID = envNamespace + "PROJECT_ID"
EnvBaseURL = envNamespace + "BASE_URL"
EnvRegion = envNamespace + "REGION"
EnvTTL = envNamespace + "TTL"
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
)
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
type Config struct {
PublicKey string
PrivateKey string
ProjectID string
BaseURL string
Region string
TTL int
PropagationTimeout time.Duration
PollingInterval time.Duration
HTTPTimeout time.Duration
}
func NewDefaultConfig() *Config {
return &Config{
TTL: env.GetOrDefaultInt(EnvTTL, 600),
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
HTTPTimeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
}
}
// 这里有意不使用 lego 提供的 ucloud 实现,
// 因为它无法配置客户端的访问地址。
type DNSProvider struct {
config *Config
client *ucloudsdk.UDNRClient
}
func NewDNSProvider() (*DNSProvider, error) {
values, err := env.Get(EnvPublicKey, EnvPrivateKey)
if err != nil {
return nil, fmt.Errorf("ucloud: %w", err)
}
config := NewDefaultConfig()
config.PublicKey = values[EnvPublicKey]
config.PrivateKey = values[EnvPrivateKey]
config.ProjectID = env.GetOrFile(EnvProjectID)
config.BaseURL = env.GetOrFile(EnvBaseURL)
config.Region = env.GetOrFile(EnvRegion)
return NewDNSProviderConfig(config)
}
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
if config == nil {
return nil, errors.New("ucloud: the configuration of the DNS provider is nil")
}
if config.PublicKey == "" || config.PrivateKey == "" {
return nil, errors.New("ucloud: credentials missing")
}
credential := auth.NewCredential()
credential.PublicKey = config.PublicKey
credential.PrivateKey = config.PrivateKey
cfg := ucloud.NewConfig()
if config.ProjectID != "" {
cfg.ProjectId = config.ProjectID
}
if config.BaseURL != "" {
if strings.Contains(config.BaseURL, "://") {
cfg.BaseUrl = config.BaseURL
} else {
cfg.BaseUrl = "https://" + config.BaseURL
}
}
if config.Region != "" {
cfg.Region = config.Region
}
return &DNSProvider{
config: config,
client: ucloudsdk.NewClient(&cfg, &credential),
}, nil
}
func (d *DNSProvider) Present(ctx context.Context, domain, token, keyAuth string) error {
info := dns01.GetChallengeInfo(ctx, domain, keyAuth)
authZone, err := dns01.DefaultClient().FindZoneByFqdn(ctx, info.EffectiveFQDN)
if err != nil {
return fmt.Errorf("ucloud: could not find zone for domain %q: %w", domain, err)
}
// REF: https://docs.ucloud.cn/api/udnr-api/udnr_domain_dns_add
addRequest := d.client.NewDomainDNSAddRequest()
addRequest.Dn = ucloud.String(dns01.UnFqdn(authZone))
addRequest.RecordName = ucloud.String(dns01.UnFqdn(info.EffectiveFQDN))
addRequest.DnsType = ucloud.String("TXT")
addRequest.Content = ucloud.String(info.Value)
addRequest.TTL = ucloud.String(strconv.Itoa(d.config.TTL))
addRequest.WithTimeout(d.config.HTTPTimeout)
_, err = d.client.DomainDNSAdd(addRequest)
if err != nil {
return fmt.Errorf("ucloud: domain DNS add: %w", err)
}
return nil
}
func (d *DNSProvider) CleanUp(ctx context.Context, domain, token, keyAuth string) error {
info := dns01.GetChallengeInfo(ctx, domain, keyAuth)
authZone, err := dns01.DefaultClient().FindZoneByFqdn(ctx, info.EffectiveFQDN)
if err != nil {
return fmt.Errorf("ucloud: could not find zone for domain %q: %w", domain, err)
}
// REF: https://docs.ucloud.cn/api/udnr-api/udnr_domain_dns_query
queryRequest := d.client.NewDomainDNSQueryRequest()
queryRequest.Dn = ucloud.String(dns01.UnFqdn(authZone))
queryRequest.WithTimeout(d.config.HTTPTimeout)
dom, err := d.client.DomainDNSQuery(queryRequest)
if err != nil {
return fmt.Errorf("ucloud: domain DNS query: %w", err)
}
for _, record := range dom.Data {
if record.Type != "TXT" || record.Name != dns01.UnFqdn(info.EffectiveFQDN) || record.Content != info.Value {
continue
}
// REF: https://docs.ucloud.cn/api/udnr-api/udnr_delete_dns_record
deleteRequest := d.client.NewDNSRecordDeleteRequest()
deleteRequest.Dn = ucloud.String(dns01.UnFqdn(authZone))
deleteRequest.RecordName = ucloud.String(dns01.UnFqdn(info.EffectiveFQDN))
deleteRequest.DnsType = ucloud.String(record.Type)
deleteRequest.Content = ucloud.String(record.Content)
deleteRequest.WithTimeout(d.config.HTTPTimeout)
_, err = d.client.DNSRecordDelete(deleteRequest)
if err != nil {
return fmt.Errorf("ucloud: delete DNS record: %w", err)
}
}
return nil
}
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
return d.config.PropagationTimeout, d.config.PollingInterval
}

View File

@@ -4,15 +4,15 @@ import (
"fmt"
"time"
"github.com/go-acme/lego/v5/providers/dns/ucloud"
"github.com/certimate-go/certimate/pkg/core"
"github.com/certimate-go/certimate/pkg/core/certifier/challengers/dns01/ucloud/internal"
)
type ChallengerConfig struct {
PrivateKey string `json:"privateKey"`
PublicKey string `json:"publicKey"`
ProjectId string `json:"projectId,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
DnsPropagationTimeout int `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int `json:"dnsTTL,omitempty"`
}
@@ -22,10 +22,11 @@ func NewChallenger(config *ChallengerConfig) (core.ACMEChallenger, error) {
return nil, fmt.Errorf("config is nil")
}
providerConfig := ucloud.NewDefaultConfig()
providerConfig := internal.NewDefaultConfig()
providerConfig.PrivateKey = config.PrivateKey
providerConfig.PublicKey = config.PublicKey
providerConfig.ProjectID = config.ProjectId
providerConfig.BaseURL = config.Endpoint
if config.DnsTTL != 0 {
providerConfig.TTL = config.DnsTTL
}
@@ -33,7 +34,7 @@ func NewChallenger(config *ChallengerConfig) (core.ACMEChallenger, error) {
providerConfig.PropagationTimeout = time.Duration(config.DnsPropagationTimeout) * time.Second
}
provider, err := ucloud.NewDNSProviderConfig(providerConfig)
provider, err := internal.NewDNSProviderConfig(providerConfig)
if err != nil {
return nil, err
}

View File

@@ -28,6 +28,8 @@ type CertmgrConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
// 优刻得地域。
Region string `json:"region"`
}
@@ -45,7 +47,7 @@ func NewCertmgr(config *CertmgrConfig) (*Certmgr, error) {
return nil, fmt.Errorf("the configuration of the certmgr provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Region)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint, config.Region)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -179,7 +181,7 @@ func (c *Certmgr) tryGetResultIfCertExists(ctx context.Context, certPEM, privkey
return nil, false, nil
}
func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsdk.ULBClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint, region string) (*ucloudsdk.ULBClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -190,6 +192,13 @@ func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsd
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
cfg.Region = region
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -29,6 +29,8 @@ type CertmgrConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
}
type Certmgr struct {
@@ -44,7 +46,7 @@ func NewCertmgr(config *CertmgrConfig) (*Certmgr, error) {
return nil, fmt.Errorf("the configuration of the certmgr provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -176,7 +178,7 @@ func (c *Certmgr) tryGetResultIfCertExists(ctx context.Context, certPEM, privkey
return nil, false, nil
}
func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UPathXClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloudsdk.UPathXClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -186,10 +188,17 @@ func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UPathX
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
// PathX 相关接口要求必传 ProjectId 参数
if cfg.ProjectId == "" {
defaultProjectId, err := getSDKDefaultProjectId(privateKey, publicKey)
defaultProjectId, err := getSDKDefaultProjectId(privateKey, publicKey, endpoint)
if err != nil {
return nil, err
}
@@ -205,8 +214,15 @@ func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UPathX
return client, nil
}
func getSDKDefaultProjectId(privateKey, publicKey string) (string, error) {
func getSDKDefaultProjectId(privateKey, publicKey, endpoint string) (string, error) {
cfg := ucloud.NewConfig()
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -32,6 +32,8 @@ type CertmgrConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
}
type Certmgr struct {
@@ -47,7 +49,7 @@ func NewCertmgr(config *CertmgrConfig) (*Certmgr, error) {
return nil, fmt.Errorf("the configuration of the certmgr provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -230,7 +232,7 @@ func (c *Certmgr) tryGetResultIfCertExists(ctx context.Context, certPEM string)
return nil, false, nil
}
func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.USSLClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloudsdk.USSLClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -240,6 +242,13 @@ func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.USSLCl
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log/slog"
"strings"
"time"
"github.com/samber/lo"
@@ -29,6 +30,8 @@ type DeployerConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
// 优刻得地域。
Region string `json:"region"`
// 部署目标。
@@ -58,7 +61,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Region)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint, config.Region)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -67,6 +70,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
PrivateKey: config.PrivateKey,
PublicKey: config.PublicKey,
ProjectId: config.ProjectId,
Endpoint: config.Endpoint,
Region: config.Region,
})
if err != nil {
@@ -304,7 +308,7 @@ func (d *Deployer) updateListenerSniCertificate(ctx context.Context, cloudLoadba
return nil
}
func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsdk.ULBClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint, region string) (*ucloudsdk.ULBClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -315,6 +319,13 @@ func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsd
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
cfg.Region = region
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"log/slog"
"strconv"
"strings"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
@@ -26,6 +27,8 @@ type DeployerConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
// 加速域名 ID。
DomainId string `json:"domainId"`
}
@@ -44,7 +47,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -53,6 +56,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
PrivateKey: config.PrivateKey,
PublicKey: config.PublicKey,
ProjectId: config.ProjectId,
Endpoint: config.Endpoint,
})
if err != nil {
return nil, fmt.Errorf("could not create certmgr: %w", err)
@@ -121,7 +125,7 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
return &DeployResult{}, nil
}
func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UCDNClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloudsdk.UCDNClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -131,6 +135,13 @@ func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UCDNCl
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log/slog"
"strings"
"sync"
"github.com/samber/lo"
@@ -29,6 +30,8 @@ type DeployerConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
// 优刻得地域。
Region string `json:"region"`
// 部署目标。
@@ -58,7 +61,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Region)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint, config.Region)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -67,6 +70,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
PrivateKey: config.PrivateKey,
PublicKey: config.PublicKey,
ProjectId: config.ProjectId,
Endpoint: config.Endpoint,
Region: config.Region,
})
if err != nil {
@@ -250,7 +254,7 @@ func (d *Deployer) updateVServerCertificate(ctx context.Context, cloudLoadbalanc
return nil
}
func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsdk.ULBClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint, region string) (*ucloudsdk.ULBClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -261,6 +265,13 @@ func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsd
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
cfg.Region = region
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -7,6 +7,7 @@ import (
"encoding/hex"
"fmt"
"log/slog"
"strings"
"time"
"github.com/ucloud/ucloud-sdk-go/ucloud"
@@ -28,6 +29,8 @@ type DeployerConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
// 自定义域名(不支持泛域名)。
Domain string `json:"domain"`
}
@@ -45,7 +48,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -95,7 +98,7 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
return &DeployResult{}, nil
}
func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UEWAFClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloudsdk.UEWAFClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -105,6 +108,13 @@ func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UEWAFC
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log/slog"
"strings"
"github.com/ucloud/ucloud-sdk-go/services/uaccount"
"github.com/ucloud/ucloud-sdk-go/ucloud"
@@ -26,6 +27,8 @@ type DeployerConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
// 加速器实例 ID。
AcceleratorId string `json:"acceleratorId"`
// 加速器监听端口。
@@ -46,7 +49,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -55,6 +58,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
PrivateKey: config.PrivateKey,
PublicKey: config.PublicKey,
ProjectId: config.ProjectId,
Endpoint: config.Endpoint,
})
if err != nil {
return nil, fmt.Errorf("could not create certmgr: %w", err)
@@ -109,7 +113,7 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
return &DeployResult{}, nil
}
func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UPathXClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint string) (*ucloudsdk.UPathXClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -119,10 +123,17 @@ func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UPathX
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
// PathX 相关接口要求必传 ProjectId 参数
if cfg.ProjectId == "" {
defaultProjectId, err := getSDKDefaultProjectId(privateKey, publicKey)
defaultProjectId, err := getSDKDefaultProjectId(privateKey, publicKey, endpoint)
if err != nil {
return nil, err
}
@@ -138,8 +149,15 @@ func createSDKClient(privateKey, publicKey, projectId string) (*ucloudsdk.UPathX
return client, nil
}
func getSDKDefaultProjectId(privateKey, publicKey string) (string, error) {
func getSDKDefaultProjectId(privateKey, publicKey, endpoint string) (string, error) {
cfg := ucloud.NewConfig()
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log/slog"
"strings"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
@@ -25,6 +26,8 @@ type DeployerConfig struct {
PublicKey string `json:"publicKey"`
// 优刻得项目 ID。
ProjectId string `json:"projectId,omitempty"`
// 优刻得接口端点。
Endpoint string `json:"endpoint,omitempty"`
// 优刻得地域。
Region string `json:"region"`
// 存储桶名。
@@ -47,7 +50,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Region)
client, err := createSDKClient(config.PrivateKey, config.PublicKey, config.ProjectId, config.Endpoint, config.Region)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -56,6 +59,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
PrivateKey: config.PrivateKey,
PublicKey: config.PublicKey,
ProjectId: config.ProjectId,
Endpoint: config.Endpoint,
})
if err != nil {
return nil, fmt.Errorf("could not create certmgr: %w", err)
@@ -111,7 +115,7 @@ func (d *Deployer) Deploy(ctx context.Context, certPEM, privkeyPEM string) (*Dep
return &DeployResult{}, nil
}
func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsdk.UFileClient, error) {
func createSDKClient(privateKey, publicKey, projectId, endpoint, region string) (*ucloudsdk.UFileClient, error) {
if privateKey == "" {
return nil, fmt.Errorf("ucloud: invalid private key")
}
@@ -122,6 +126,13 @@ func createSDKClient(privateKey, publicKey, projectId, region string) (*ucloudsd
cfg := ucloud.NewConfig()
cfg.ProjectId = projectId
cfg.Region = region
if endpoint != "" {
if strings.Contains(endpoint, "://") {
cfg.BaseUrl = endpoint
} else {
cfg.BaseUrl = "https://" + endpoint
}
}
credential := auth.NewCredential()
credential.PrivateKey = privateKey

View File

@@ -3,6 +3,8 @@
package ucdn
import (
"io"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
@@ -14,6 +16,7 @@ type UCDNClient struct {
func NewClient(config *ucloud.Config, credential *auth.Credential) *UCDNClient {
meta := ucloud.ClientMeta{Product: "UCDN"}
client := ucloud.NewClientWithMeta(config, credential, meta)
client.GetLogger().SetOutput(io.Discard)
return &UCDNClient{
client,
}

View File

@@ -0,0 +1,44 @@
package udnr
import (
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)
type DomainDNSAddRequest struct {
request.CommonBase
Dn *string `required:"true"`
RecordName *string `required:"true"`
DnsType *string `required:"true"`
Content *string `required:"true"`
TTL *string `required:"false"`
Prio *string `required:"false"`
}
type DomainDNSAddResponse struct {
response.CommonBase
}
func (c *UDNRClient) NewDomainDNSAddRequest() *DomainDNSAddRequest {
req := &DomainDNSAddRequest{}
c.Client.SetupRequest(req)
req.SetRetryable(true)
return req
}
func (c *UDNRClient) DomainDNSAdd(req *DomainDNSAddRequest) (*DomainDNSAddResponse, error) {
var err error
var res DomainDNSAddResponse
reqCopier := *req
err = c.Client.InvokeAction("UdnrDomainDNSAdd", &reqCopier, &res)
if err != nil {
return &res, err
}
return &res, nil
}

View File

@@ -0,0 +1,42 @@
package udnr
import (
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)
type DNSRecordDeleteRequest struct {
request.CommonBase
Dn *string `required:"true"`
RecordName *string `required:"true"`
DnsType *string `required:"true"`
Content *string `required:"true"`
}
type DNSRecordDeleteResponse struct {
response.CommonBase
}
func (c *UDNRClient) NewDNSRecordDeleteRequest() *DNSRecordDeleteRequest {
req := &DNSRecordDeleteRequest{}
c.Client.SetupRequest(req)
req.SetRetryable(true)
return req
}
func (c *UDNRClient) DNSRecordDelete(req *DNSRecordDeleteRequest) (*DNSRecordDeleteResponse, error) {
var err error
var res DNSRecordDeleteResponse
reqCopier := *req
err = c.Client.InvokeAction("UdnrDeleteDnsRecord", &reqCopier, &res)
if err != nil {
return &res, err
}
return &res, nil
}

View File

@@ -0,0 +1,41 @@
package udnr
import (
"github.com/ucloud/ucloud-sdk-go/ucloud/request"
"github.com/ucloud/ucloud-sdk-go/ucloud/response"
)
type DomainDNSQueryRequest struct {
request.CommonBase
Dn *string `required:"true"`
}
type DomainDNSQueryResponse struct {
response.CommonBase
Data []DomainDNSRecord
}
func (c *UDNRClient) NewDomainDNSQueryRequest() *DomainDNSQueryRequest {
req := &DomainDNSQueryRequest{}
c.Client.SetupRequest(req)
req.SetRetryable(true)
return req
}
func (c *UDNRClient) DomainDNSQuery(req *DomainDNSQueryRequest) (*DomainDNSQueryResponse, error) {
var err error
var res DomainDNSQueryResponse
reqCopier := *req
err = c.Client.InvokeAction("UdnrDomainDNSQuery", &reqCopier, &res)
if err != nil {
return &res, err
}
return &res, nil
}

View File

@@ -0,0 +1,23 @@
// An extension SDK client for UCloud DNR service.
// Based on github.com/ucloud/ucloud-sdk-go.
package udnr
import (
"io"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
type UDNRClient struct {
*ucloud.Client
}
func NewClient(config *ucloud.Config, credential *auth.Credential) *UDNRClient {
meta := ucloud.ClientMeta{Product: "UDNR"}
client := ucloud.NewClientWithMeta(config, credential, meta)
client.GetLogger().SetOutput(io.Discard)
return &UDNRClient{
client,
}
}

View File

@@ -0,0 +1,9 @@
package udnr
type DomainDNSRecord struct {
Type string `json:"DnsType,omitempty"`
Name string `json:"RecordName,omitempty"`
Content string `json:"Content,omitempty"`
Priority string `json:"Prio,omitempty"`
TTL string `json:"TTL,omitempty"`
}

View File

@@ -3,6 +3,8 @@
package uewaf
import (
"io"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
@@ -14,6 +16,7 @@ type UEWAFClient struct {
func NewClient(config *ucloud.Config, credential *auth.Credential) *UEWAFClient {
meta := ucloud.ClientMeta{Product: "UEWAF"}
client := ucloud.NewClientWithMeta(config, credential, meta)
client.GetLogger().SetOutput(io.Discard)
return &UEWAFClient{
client,
}

View File

@@ -3,6 +3,8 @@
package ufile
import (
"io"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
@@ -14,6 +16,7 @@ type UFileClient struct {
func NewClient(config *ucloud.Config, credential *auth.Credential) *UFileClient {
meta := ucloud.ClientMeta{Product: "UFile"}
client := ucloud.NewClientWithMeta(config, credential, meta)
client.GetLogger().SetOutput(io.Discard)
return &UFileClient{
client,
}

View File

@@ -3,6 +3,8 @@
package ulb
import (
"io"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
@@ -14,6 +16,7 @@ type ULBClient struct {
func NewClient(config *ucloud.Config, credential *auth.Credential) *ULBClient {
meta := ucloud.ClientMeta{Product: "ULB"}
client := ucloud.NewClientWithMeta(config, credential, meta)
client.GetLogger().SetOutput(io.Discard)
return &ULBClient{
client,
}

View File

@@ -3,6 +3,8 @@
package upathx
import (
"io"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
@@ -14,6 +16,7 @@ type UPathXClient struct {
func NewClient(config *ucloud.Config, credential *auth.Credential) *UPathXClient {
meta := ucloud.ClientMeta{Product: "PathX"}
client := ucloud.NewClientWithMeta(config, credential, meta)
client.GetLogger().SetOutput(io.Discard)
return &UPathXClient{
client,
}

View File

@@ -3,6 +3,8 @@
package ussl
import (
"io"
"github.com/ucloud/ucloud-sdk-go/ucloud"
"github.com/ucloud/ucloud-sdk-go/ucloud/auth"
)
@@ -14,6 +16,7 @@ type USSLClient struct {
func NewClient(config *ucloud.Config, credential *auth.Credential) *USSLClient {
meta := ucloud.ClientMeta{Product: "USSL"}
client := ucloud.NewClientWithMeta(config, credential, meta)
client.GetLogger().SetOutput(io.Discard)
return &USSLClient{
client,
}

View File

@@ -12,6 +12,7 @@ import BizApplyNodeConfigFieldsProviderLocal from "./BizApplyNodeConfigFieldsPro
import BizApplyNodeConfigFieldsProviderOracleCloudDNS from "./BizApplyNodeConfigFieldsProviderOracleCloudDNS";
import BizApplyNodeConfigFieldsProviderS3 from "./BizApplyNodeConfigFieldsProviderS3";
import BizApplyNodeConfigFieldsProviderSSH from "./BizApplyNodeConfigFieldsProviderSSH";
import BizApplyNodeConfigFieldsProviderUCloudUDNR from "./BizApplyNodeConfigFieldsProviderUCloudUDNR";
const acmeDns01ProviderComponentMap: Partial<Record<ACMEDns01ProviderType, React.ComponentType<any>>> = {
/*
@@ -28,6 +29,8 @@ const acmeDns01ProviderComponentMap: Partial<Record<ACMEDns01ProviderType, React
[ACME_DNS01_PROVIDERS.JDCLOUD_DNS]: BizApplyNodeConfigFieldsProviderJDCloudDNS,
[ACME_DNS01_PROVIDERS.ORACLECLOUD]: BizApplyNodeConfigFieldsProviderOracleCloudDNS,
[ACME_DNS01_PROVIDERS.ORACLECLOUD_DNS]: BizApplyNodeConfigFieldsProviderOracleCloudDNS,
[ACME_DNS01_PROVIDERS.UCLOUD]: BizApplyNodeConfigFieldsProviderUCloudUDNR,
[ACME_DNS01_PROVIDERS.UCLOUD_UDNR]: BizApplyNodeConfigFieldsProviderUCloudUDNR,
};
const acmeHttp01ProviderComponentMap: Partial<Record<ACMEHttp01ProviderType, React.ComponentType<any>>> = {

View File

@@ -0,0 +1,50 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
const BizApplyNodeConfigFieldsProviderUCloudUDNR = () => {
const { i18n, t } = useTranslation();
const { parentNamePath } = useFormNestedFieldsContext();
const formSchema = z.object({
[parentNamePath]: getSchema({ i18n }),
});
const formRule = createSchemaFieldRule(formSchema);
const initialValues = getInitialValues();
return (
<>
<Form.Item
name={[parentNamePath, "endpoint"]}
initialValue={initialValues.endpoint}
label={t("workflow_node.apply.form.ucloud_udnr_endpoint.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.apply.form.ucloud_udnr_endpoint.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.apply.form.ucloud_udnr_endpoint.placeholder")} />
</Form.Item>
</>
);
};
const getInitialValues = (): Nullish<z.infer<ReturnType<typeof getSchema>>> => {
return {};
};
const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> }) => {
const { t: _ } = i18n;
return z.object({
endpoint: z.string().nullish(),
});
};
const _default = Object.assign(BizApplyNodeConfigFieldsProviderUCloudUDNR, {
getInitialValues,
getSchema,
});
export default _default;

View File

@@ -112,8 +112,8 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
return z
.object({
endpoint: z.string().nullish(),
deployTarget: z.enum([DEPLOY_TARGET_LOADBALANCER, DEPLOY_TARGET_LISTENER, DEPLOY_TARGET_RULEDOMAIN]),
region: z.string().nonempty(),
deployTarget: z.enum([DEPLOY_TARGET_LOADBALANCER, DEPLOY_TARGET_LISTENER, DEPLOY_TARGET_RULEDOMAIN]),
loadbalancerId: z.string().nonempty(),
listenerId: z.string().nullish(),
domain: z.string().nullish(),

View File

@@ -26,6 +26,16 @@ const BizDeployNodeConfigFieldsProviderUCloudUALB = () => {
return (
<>
<Form.Item
name={[parentNamePath, "endpoint"]}
initialValue={initialValues.endpoint}
label={t("workflow_node.deploy.form.ucloud_ualb_endpoint.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.ucloud_ualb_endpoint.tooltip") }}></span>}
>
<Input allowClear placeholder={t("workflow_node.deploy.form.ucloud_ualb_endpoint.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "region"]}
initialValue={initialValues.region}
@@ -103,8 +113,8 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
return z
.object({
endpoint: z.string().nullish(),
deployTarget: z.enum([DEPLOY_TARGET_LOADBALANCER, DEPLOY_TARGET_LISTENER]),
region: z.string().nonempty(),
deployTarget: z.enum([DEPLOY_TARGET_LOADBALANCER, DEPLOY_TARGET_LISTENER]),
loadbalancerId: z.string().nonempty(),
listenerId: z.string().nullish(),
domain: z

View File

@@ -17,6 +17,16 @@ const BizDeployNodeConfigFieldsProviderUCloudUCDN = () => {
return (
<>
<Form.Item
name={[parentNamePath, "endpoint"]}
initialValue={initialValues.endpoint}
label={t("workflow_node.deploy.form.ucloud_ucdn_endpoint.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.ucloud_ucdn_endpoint.tooltip") }}></span>}
>
<Input allowClear placeholder={t("workflow_node.deploy.form.ucloud_ucdn_endpoint.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "domainId"]}
initialValue={initialValues.domainId}
@@ -40,6 +50,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
const { t: _ } = i18n;
return z.object({
endpoint: z.string().nullish(),
domainId: z.string().nonempty(),
});
};

View File

@@ -25,6 +25,16 @@ const BizDeployNodeConfigFieldsProviderUCloudUCLB = () => {
return (
<>
<Form.Item
name={[parentNamePath, "endpoint"]}
initialValue={initialValues.endpoint}
label={t("workflow_node.deploy.form.ucloud_uclb_endpoint.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.ucloud_uclb_endpoint.tooltip") }}></span>}
>
<Input allowClear placeholder={t("workflow_node.deploy.form.ucloud_uclb_endpoint.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "region"]}
initialValue={initialValues.region}
@@ -90,8 +100,8 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
return z
.object({
endpoint: z.string().nullish(),
deployTarget: z.enum([DEPLOY_TARGET_LOADBALANCER, DEPLOY_TARGET_VSERVER]),
region: z.string().nonempty(),
deployTarget: z.enum([DEPLOY_TARGET_LOADBALANCER, DEPLOY_TARGET_VSERVER]),
loadbalancerId: z.string().nonempty(),
vserverId: z.string().nullish(),
})

View File

@@ -19,6 +19,16 @@ const BizDeployNodeConfigFieldsProviderUCloudUEWAF = () => {
return (
<>
<Form.Item
name={[parentNamePath, "endpoint"]}
initialValue={initialValues.endpoint}
label={t("workflow_node.deploy.form.ucloud_uewaf_endpoint.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.ucloud_uewaf_endpoint.tooltip") }}></span>}
>
<Input allowClear placeholder={t("workflow_node.deploy.form.ucloud_uewaf_endpoint.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "domain"]}
initialValue={initialValues.domain}
@@ -41,6 +51,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
const { t } = i18n;
return z.object({
endpoint: z.string().nullish(),
domain: z.string().refine((v) => isDomain(v), t("common.errmsg.domain_invalid")),
});
};

View File

@@ -19,6 +19,16 @@ const BizDeployNodeConfigFieldsProviderUCloudUPathX = () => {
return (
<>
<Form.Item
name={[parentNamePath, "endpoint"]}
initialValue={initialValues.endpoint}
label={t("workflow_node.deploy.form.ucloud_upathx_endpoint.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.ucloud_upathx_endpoint.tooltip") }}></span>}
>
<Input allowClear placeholder={t("workflow_node.deploy.form.ucloud_upathx_endpoint.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "acceleratorId"]}
initialValue={initialValues.acceleratorId}
@@ -53,6 +63,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
const { t } = i18n;
return z.object({
endpoint: z.string().nullish(),
acceleratorId: z.string().nonempty(),
listenerPort: z.coerce.number().refine((v) => isPortNumber(v), t("common.errmsg.port_invalid")),
});

View File

@@ -19,6 +19,16 @@ const BizDeployNodeConfigFieldsProviderUCloudUS3 = () => {
return (
<>
<Form.Item
name={[parentNamePath, "endpoint"]}
initialValue={initialValues.endpoint}
label={t("workflow_node.deploy.form.ucloud_us3_endpoint.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.ucloud_us3_endpoint.tooltip") }}></span>}
>
<Input allowClear placeholder={t("workflow_node.deploy.form.ucloud_us3_endpoint.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "region"]}
initialValue={initialValues.region}
@@ -62,6 +72,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
const { t } = i18n;
return z.object({
endpoint: z.string().nullish(),
region: z.string().nonempty(),
bucket: z.string().nonempty(),
domain: z.string().refine((v) => isDomain(v), t("common.errmsg.domain_invalid")),

View File

@@ -344,6 +344,11 @@
"ssh_use_scp": {
"label": "Fallback to use SCP",
"tooltip": "If the remote server does not support SFTP, please check this option to fallback to SCP."
},
"ucloud_udnr_endpoint": {
"label": "UCloud API endpoint (Optional)",
"placeholder": "Please enter UCloud UDNR API endpoint (e.g. api.ucloud-global.com)",
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>api.ucloud-global.com</strong> for UCloud Global</li><li><strong>api.ucloud.cn</strong> for UCloud in China</li></ul>"
}
}
},
@@ -2565,6 +2570,11 @@
"placeholder": "Please enter Tencent Cloud WAF domain ID",
"tooltip": "For more information, see <a href=\"https://console.tencentcloud.com/waf\" target=\"_blank\">https://console.tencentcloud.com/waf</a>"
},
"ucloud_ualb_endpoint": {
"label": "UCloud API endpoint (Optional)",
"placeholder": "Please enter UCloud UALB API endpoint (e.g. api.ucloud-global.com)",
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>api.ucloud-global.com</strong> for UCloud Global</li><li><strong>api.ucloud.cn</strong> for UCloud in China</li></ul>"
},
"ucloud_ualb_region": {
"label": "UCloud region",
"placeholder": "Please enter UCloud ALB region (e.g. cn-bj2)",
@@ -2595,11 +2605,21 @@
"placeholder": "Please enter UCloud UALB SNI domain name",
"help": "Notes: Leave it blank to set the default certificate; otherwise, to set the extension one for SNI."
},
"ucloud_ucdn_endpoint": {
"label": "UCloud API endpoint (Optional)",
"placeholder": "Please enter UCloud UCDN API endpoint (e.g. api.ucloud-global.com)",
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>api.ucloud-global.com</strong> for UCloud Global</li><li><strong>api.ucloud.cn</strong> for UCloud in China</li></ul>"
},
"ucloud_ucdn_domain_id": {
"label": "UCloud UCDN domain ID",
"placeholder": "Please enter UCloud UCDN domain ID",
"tooltip": "For more information, see <a href=\"https://console.ucloud-global.com/ucdn\" target=\"_blank\">https://console.ucloud-global.com/ucdn</a>"
},
"ucloud_uclb_endpoint": {
"label": "UCloud API endpoint (Optional)",
"placeholder": "Please enter UCloud UCLB API endpoint (e.g. api.ucloud-global.com)",
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>api.ucloud-global.com</strong> for UCloud Global</li><li><strong>api.ucloud.cn</strong> for UCloud in China</li></ul>"
},
"ucloud_uclb_region": {
"label": "UCloud region",
"placeholder": "Please enter UCloud UCLB region (e.g. cn-bj2)",
@@ -2625,6 +2645,11 @@
"placeholder": "Please enter UCloud UCLB VServer ID",
"tooltip": "For more information, see <a href=\"https://console.ucloud-global.com/ulb/ulb\" target=\"_blank\">https://console.ucloud-global.com/ulb/ulb</a>"
},
"ucloud_upathx_endpoint": {
"label": "UCloud API endpoint (Optional)",
"placeholder": "Please enter UCloud UPathX API endpoint (e.g. api.ucloud-global.com)",
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>api.ucloud-global.com</strong> for UCloud Global</li><li><strong>api.ucloud.cn</strong> for UCloud in China</li></ul>"
},
"ucloud_upathx_accelerator_id": {
"label": "UCloud UPathX accelerator ID",
"placeholder": "Please enter UCloud UPathX accelerator ID",
@@ -2635,6 +2660,11 @@
"placeholder": "Please enter UCloud UPathX listener port",
"tooltip": "For more information, see <a href=\"https://console.ucloud-global.com/upathx/accelerate\" target=\"_blank\">https://console.ucloud-global.com/upathx/accelerate</a>"
},
"ucloud_us3_endpoint": {
"label": "UCloud API endpoint (Optional)",
"placeholder": "Please enter UCloud US3 API endpoint (e.g. api.ucloud-global.com)",
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>api.ucloud-global.com</strong> for UCloud Global</li><li><strong>api.ucloud.cn</strong> for UCloud in China</li></ul>"
},
"ucloud_us3_region": {
"label": "UCloud region",
"placeholder": "Please enter UCloud US3 region (e.g. cn-bj2)",
@@ -2648,6 +2678,11 @@
"label": "UCloud US3 custom domain",
"placeholder": "Please enter UCloud US3 bucket custom domain name"
},
"ucloud_uewaf_endpoint": {
"label": "UCloud API endpoint (Optional)",
"placeholder": "Please enter UCloud UEWAF API endpoint (e.g. api.ucloud-global.com)",
"tooltip": "<ul style=\"list-style: disc;\"><li><strong>api.ucloud-global.com</strong> for UCloud Global</li><li><strong>api.ucloud.cn</strong> for UCloud in China</li></ul>"
},
"ucloud_uewaf_domain": {
"label": "UCloud UEWAF domain",
"placeholder": "Please enter UCloud UEWAF domain name"

View File

@@ -343,6 +343,11 @@
"ssh_use_scp": {
"label": "回退使用 SCP",
"tooltip": "如果你的远程服务器不支持 SFTP请勾选此选项回退为 SCP。"
},
"ucloud_udnr_endpoint": {
"label": "优刻得接口端点(可选)",
"placeholder": "请输入优刻得 UDNR 接口端点例如api.ucloud.cn",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/gateway\" target=\"_blank\">https://docs.ucloud.cn/api/summary/gateway</a><br>国际站用户请填写 <em>api.ucloud-global.com</em>。"
}
}
},
@@ -2401,12 +2406,12 @@
},
"tencentcloud_scf_region": {
"label": "腾讯云服务地域",
"placeholder": "输入腾讯云 SCF 服务地域例如ap-guangzhou",
"placeholder": "输入腾讯云 SCF 服务地域例如ap-guangzhou",
"tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/583/17299\" target=\"_blank\">https://cloud.tencent.com/document/product/583/17299</a>"
},
"tencentcloud_scf_domain": {
"label": "腾讯云 SCF 自定义域名",
"placeholder": "输入腾讯云 SCF 自定义域名"
"placeholder": "输入腾讯云 SCF 自定义域名"
},
"tencentcloud_ssl_endpoint": {
"label": "腾讯云接口端点(可选)",
@@ -2494,7 +2499,7 @@
},
"tencentcloud_tse_region": {
"label": "腾讯云服务地域",
"placeholder": "输入腾讯云 TSE 服务地域例如ap-guangzhou",
"placeholder": "输入腾讯云 TSE 服务地域例如ap-guangzhou",
"tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com.cn/document/product/1364/54618\" target=\"_blank\">https://cloud.tencent.com.cn/document/product/1364/54618</a>"
},
"tencentcloud_tse_service_type": {
@@ -2513,7 +2518,7 @@
},
"tencentcloud_tse_domains": {
"label": "腾讯云 TSE 云原生网关绑定域名",
"placeholder": "输入腾讯云 TSE 云原生网关绑定域名(多个值请用半角分号隔开)",
"placeholder": "输入腾讯云 TSE 云原生网关绑定域名(多个值请用半角分号隔开)",
"help": "提示:支持多个域名,以半角分号隔开。",
"multiple_input_modal": {
"title": "修改腾讯云 TSE 云原生网关绑定域名",
@@ -2564,9 +2569,14 @@
"placeholder": "请输入腾讯云 WAF 域名 ID",
"tooltip": "这是什么?请参阅 <a href=\"https://console.cloud.tencent.com/waf\" target=\"_blank\">https://console.cloud.tencent.com/waf</a>"
},
"ucloud_ualb_endpoint": {
"label": "优刻得接口端点(可选)",
"placeholder": "请输入优刻得 UALB 接口端点例如api.ucloud.cn",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/gateway\" target=\"_blank\">https://docs.ucloud.cn/api/summary/gateway</a><br>国际站用户请填写 <em>api.ucloud-global.com</em>。"
},
"ucloud_ualb_region": {
"label": "优刻得服务地域",
"placeholder": "优刻得 UALB 服务地域例如cn-bj2",
"placeholder": "请输入优刻得 UALB 服务地域例如cn-bj2",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/regionlist\" target=\"_blank\">https://docs.ucloud.cn/api/summary/regionlist</a>"
},
"ucloud_ualb_deploy_target": {
@@ -2594,14 +2604,24 @@
"placeholder": "请输入优刻得 UALB 扩展域名",
"help": "提示:不填写时,将替换监听器的默认证书;否则,将替换扩展域名证书。"
},
"ucloud_ucdn_endpoint": {
"label": "优刻得接口端点(可选)",
"placeholder": "请输入优刻得 UCDN 接口端点例如api.ucloud.cn",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/gateway\" target=\"_blank\">https://docs.ucloud.cn/api/summary/gateway</a><br>国际站用户请填写 <em>api.ucloud-global.com</em>。"
},
"ucloud_ucdn_domain_id": {
"label": "优刻得 UCDN 域名 ID",
"placeholder": "请输入优刻得 UCDN 域名 ID",
"tooltip": "这是什么?请参阅 <a href=\"https://console.ucloud.cn/ucdn\" target=\"_blank\">https://console.ucloud.cn/ucdn</a>"
},
"ucloud_uclb_endpoint": {
"label": "优刻得接口端点(可选)",
"placeholder": "请输入优刻得 UCLB 接口端点例如api.ucloud.cn",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/gateway\" target=\"_blank\">https://docs.ucloud.cn/api/summary/gateway</a><br>国际站用户请填写 <em>api.ucloud-global.com</em>。"
},
"ucloud_uclb_region": {
"label": "优刻得服务地域",
"placeholder": "优刻得 UCLB 服务地域例如cn-bj2",
"placeholder": "请输入优刻得 UCLB 服务地域例如cn-bj2",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/regionlist\" target=\"_blank\">https://docs.ucloud.cn/api/summary/regionlist</a>"
},
"ucloud_uclb_deploy_target": {
@@ -2624,6 +2644,11 @@
"placeholder": "请输入优刻得 UCLB VServer ID",
"tooltip": "这是什么?请参阅 <a href=\"https://console.ucloud.cn/ulb/ulb\" target=\"_blank\">https://console.ucloud.cn/ulb/ulb</a>"
},
"ucloud_upathx_endpoint": {
"label": "优刻得接口端点(可选)",
"placeholder": "请输入优刻得 UPathX 接口端点例如api.ucloud.cn",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/gateway\" target=\"_blank\">https://docs.ucloud.cn/api/summary/gateway</a><br>国际站用户请填写 <em>api.ucloud-global.com</em>。"
},
"ucloud_upathx_accelerator_id": {
"label": "优刻得 UPathX 加速器实例 ID",
"placeholder": "请输入优刻得 UPathX 加速器实例 ID",
@@ -2634,9 +2659,14 @@
"placeholder": "请输入优刻得 UPathX 加速器监听端口",
"tooltip": "这是什么?请参阅 <a href=\"https://console.ucloud.cn/upathx/accelerate\" target=\"_blank\">https://console.ucloud.cn/upathx/accelerate</a>"
},
"ucloud_us3_endpoint": {
"label": "优刻得接口端点(可选)",
"placeholder": "请输入优刻得 US3 接口端点例如api.ucloud.cn",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/gateway\" target=\"_blank\">https://docs.ucloud.cn/api/summary/gateway</a><br>国际站用户请填写 <em>api.ucloud-global.com</em>。"
},
"ucloud_us3_region": {
"label": "优刻得服务地域",
"placeholder": "优刻得 US3 服务地域例如cn-bj2",
"placeholder": "请输入优刻得 US3 服务地域例如cn-bj2",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/regionlist\" target=\"_blank\">https://docs.ucloud.cn/api/summary/regionlist</a>"
},
"ucloud_us3_bucket": {
@@ -2647,6 +2677,11 @@
"label": "优刻得 US3 自定义域名",
"placeholder": "请输入优刻得 US3 自定义域名"
},
"ucloud_uewaf_endpoint": {
"label": "优刻得接口端点(可选)",
"placeholder": "请输入优刻得 UEWAF 接口端点例如api.ucloud.cn",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.ucloud.cn/api/summary/gateway\" target=\"_blank\">https://docs.ucloud.cn/api/summary/gateway</a><br>国际站用户请填写 <em>api.ucloud-global.com</em>。"
},
"ucloud_uewaf_domain": {
"label": "优刻得 UEWAF 防护域名",
"placeholder": "请输入优刻得 UEWAF 防护域名"