feat: allow set a different region on deployment to huaweicloud cdn

This commit is contained in:
Fu Diwei 2024-10-24 20:16:23 +08:00
parent bff18a7be7
commit cea6be37dc
12 changed files with 153 additions and 121 deletions

View File

@ -7,24 +7,53 @@ import (
"time" "time"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2" hcCdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2"
cdnModel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model" hcCdnModel "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model"
cdnRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/region" hcCdnRegion "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/region"
"github.com/usual2970/certimate/internal/domain" "github.com/usual2970/certimate/internal/domain"
uploader "github.com/usual2970/certimate/internal/pkg/core/uploader" "github.com/usual2970/certimate/internal/pkg/core/uploader"
"github.com/usual2970/certimate/internal/pkg/utils/cast" "github.com/usual2970/certimate/internal/pkg/utils/cast"
) )
type HuaweiCloudCDNDeployer struct { type HuaweiCloudCDNDeployer struct {
option *DeployerOption option *DeployerOption
infos []string infos []string
sdkClient *hcCdn.CdnClient
sslUploader uploader.Uploader
} }
func NewHuaweiCloudCDNDeployer(option *DeployerOption) (Deployer, error) { func NewHuaweiCloudCDNDeployer(option *DeployerOption) (Deployer, error) {
access := &domain.HuaweiCloudAccess{}
if err := json.Unmarshal([]byte(option.Access), access); err != nil {
return nil, err
}
client, err := (&HuaweiCloudCDNDeployer{}).createSdkClient(
option.DeployConfig.GetConfigAsString("region"),
access.AccessKeyId,
access.SecretAccessKey,
)
if err != nil {
return nil, err
}
// TODO: SCM 服务与 DNS 服务所支持的区域可能不一致,这里暂时不传而是使用默认值,仅支持华为云国内版
uploader, err := uploader.NewHuaweiCloudSCMUploader(&uploader.HuaweiCloudSCMUploaderConfig{
Region: "",
AccessKeyId: access.AccessKeyId,
SecretAccessKey: access.SecretAccessKey,
})
if err != nil {
return nil, err
}
return &HuaweiCloudCDNDeployer{ return &HuaweiCloudCDNDeployer{
option: option, option: option,
infos: make([]string, 0), infos: make([]string, 0),
sdkClient: client,
sslUploader: uploader,
}, nil }, nil
} }
@ -37,25 +66,12 @@ func (d *HuaweiCloudCDNDeployer) GetInfo() []string {
} }
func (d *HuaweiCloudCDNDeployer) Deploy(ctx context.Context) error { func (d *HuaweiCloudCDNDeployer) Deploy(ctx context.Context) error {
access := &domain.HuaweiCloudAccess{}
if err := json.Unmarshal([]byte(d.option.Access), access); err != nil {
return err
}
// TODO: CDN 服务与 DNS 服务所支持的区域可能不一致,这里暂时不传而是使用默认值,仅支持华为云国内版
client, err := d.createClient("", access.AccessKeyId, access.SecretAccessKey)
if err != nil {
return err
}
d.infos = append(d.infos, toStr("SDK 客户端创建成功", nil))
// 查询加速域名配置 // 查询加速域名配置
// REF: https://support.huaweicloud.com/api-cdn/ShowDomainFullConfig.html // REF: https://support.huaweicloud.com/api-cdn/ShowDomainFullConfig.html
showDomainFullConfigReq := &cdnModel.ShowDomainFullConfigRequest{ showDomainFullConfigReq := &hcCdnModel.ShowDomainFullConfigRequest{
DomainName: d.option.DeployConfig.GetConfigAsString("domain"), DomainName: d.option.DeployConfig.GetConfigAsString("domain"),
} }
showDomainFullConfigResp, err := client.ShowDomainFullConfig(showDomainFullConfigReq) showDomainFullConfigResp, err := d.sdkClient.ShowDomainFullConfig(showDomainFullConfigReq)
if err != nil { if err != nil {
return err return err
} }
@ -68,19 +84,10 @@ func (d *HuaweiCloudCDNDeployer) Deploy(ctx context.Context) error {
updateDomainMultiCertificatesReqBodyContent := &huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent{} updateDomainMultiCertificatesReqBodyContent := &huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent{}
updateDomainMultiCertificatesReqBodyContent.DomainName = d.option.DeployConfig.GetConfigAsString("domain") updateDomainMultiCertificatesReqBodyContent.DomainName = d.option.DeployConfig.GetConfigAsString("domain")
updateDomainMultiCertificatesReqBodyContent.HttpsSwitch = 1 updateDomainMultiCertificatesReqBodyContent.HttpsSwitch = 1
var updateDomainMultiCertificatesResp *cdnModel.UpdateDomainMultiCertificatesResponse var updateDomainMultiCertificatesResp *hcCdnModel.UpdateDomainMultiCertificatesResponse
if d.option.DeployConfig.GetConfigAsBool("useSCM") { if d.option.DeployConfig.GetConfigAsBool("useSCM") {
uploader, err := uploader.NewHuaweiCloudSCMUploader(&uploader.HuaweiCloudSCMUploaderConfig{
Region: "", // TODO: SCM 服务与 DNS 服务所支持的区域可能不一致,这里暂时不传而是使用默认值,仅支持华为云国内版
AccessKeyId: access.AccessKeyId,
SecretAccessKey: access.SecretAccessKey,
})
if err != nil {
return err
}
// 上传证书到 SCM // 上传证书到 SCM
uploadResult, err := uploader.Upload(ctx, d.option.Certificate.Certificate, d.option.Certificate.PrivateKey) uploadResult, err := d.sslUploader.Upload(ctx, d.option.Certificate.Certificate, d.option.Certificate.PrivateKey)
if err != nil { if err != nil {
return err return err
} }
@ -102,7 +109,7 @@ func (d *HuaweiCloudCDNDeployer) Deploy(ctx context.Context) error {
Https: updateDomainMultiCertificatesReqBodyContent, Https: updateDomainMultiCertificatesReqBodyContent,
}, },
} }
updateDomainMultiCertificatesResp, err = executeHuaweiCloudCDNUploadDomainMultiCertificates(client, updateDomainMultiCertificatesReq) updateDomainMultiCertificatesResp, err = executeHuaweiCloudCDNUploadDomainMultiCertificates(d.sdkClient, updateDomainMultiCertificatesReq)
if err != nil { if err != nil {
return err return err
} }
@ -112,7 +119,11 @@ func (d *HuaweiCloudCDNDeployer) Deploy(ctx context.Context) error {
return nil return nil
} }
func (d *HuaweiCloudCDNDeployer) createClient(region, accessKeyId, secretAccessKey string) (*cdn.CdnClient, error) { func (d *HuaweiCloudCDNDeployer) createSdkClient(region, accessKeyId, secretAccessKey string) (*hcCdn.CdnClient, error) {
if region == "" {
region = "cn-north-1" // CDN 服务默认区域:华北一北京
}
auth, err := global.NewCredentialsBuilder(). auth, err := global.NewCredentialsBuilder().
WithAk(accessKeyId). WithAk(accessKeyId).
WithSk(secretAccessKey). WithSk(secretAccessKey).
@ -121,16 +132,12 @@ func (d *HuaweiCloudCDNDeployer) createClient(region, accessKeyId, secretAccessK
return nil, err return nil, err
} }
if region == "" { hcRegion, err := hcCdnRegion.SafeValueOf(region)
region = "cn-north-1" // CDN 服务默认区域:华北一北京
}
hcRegion, err := cdnRegion.SafeValueOf(region)
if err != nil { if err != nil {
return nil, err return nil, err
} }
hcClient, err := cdn.CdnClientBuilder(). hcClient, err := hcCdn.CdnClientBuilder().
WithRegion(hcRegion). WithRegion(hcRegion).
WithCredential(auth). WithCredential(auth).
SafeBuild() SafeBuild()
@ -138,12 +145,12 @@ func (d *HuaweiCloudCDNDeployer) createClient(region, accessKeyId, secretAccessK
return nil, err return nil, err
} }
client := cdn.NewCdnClient(hcClient) client := hcCdn.NewCdnClient(hcClient)
return client, nil return client, nil
} }
type huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent struct { type huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent struct {
cdnModel.UpdateDomainMultiCertificatesRequestBodyContent `json:",inline"` hcCdnModel.UpdateDomainMultiCertificatesRequestBodyContent `json:",inline"`
SCMCertificateId *string `json:"scm_certificate_id,omitempty"` SCMCertificateId *string `json:"scm_certificate_id,omitempty"`
} }
@ -156,20 +163,20 @@ type huaweicloudCDNUpdateDomainMultiCertificatesRequest struct {
Body *huaweicloudCDNUpdateDomainMultiCertificatesRequestBody `json:"body,omitempty"` Body *huaweicloudCDNUpdateDomainMultiCertificatesRequestBody `json:"body,omitempty"`
} }
func executeHuaweiCloudCDNUploadDomainMultiCertificates(client *cdn.CdnClient, request *huaweicloudCDNUpdateDomainMultiCertificatesRequest) (*cdnModel.UpdateDomainMultiCertificatesResponse, error) { func executeHuaweiCloudCDNUploadDomainMultiCertificates(client *hcCdn.CdnClient, request *huaweicloudCDNUpdateDomainMultiCertificatesRequest) (*hcCdnModel.UpdateDomainMultiCertificatesResponse, error) {
// 华为云官方 SDK 中目前提供的字段缺失,这里暂时先需自定义请求 // 华为云官方 SDK 中目前提供的字段缺失,这里暂时先需自定义请求
// 可能需要等之后 SDK 更新 // 可能需要等之后 SDK 更新
requestDef := cdn.GenReqDefForUpdateDomainMultiCertificates() requestDef := hcCdn.GenReqDefForUpdateDomainMultiCertificates()
if resp, err := client.HcClient.Sync(request, requestDef); err != nil { if resp, err := client.HcClient.Sync(request, requestDef); err != nil {
return nil, err return nil, err
} else { } else {
return resp.(*cdnModel.UpdateDomainMultiCertificatesResponse), nil return resp.(*hcCdnModel.UpdateDomainMultiCertificatesResponse), nil
} }
} }
func mergeHuaweiCloudCDNConfig(src *cdnModel.ConfigsGetBody, dest *huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent) *huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent { func mergeHuaweiCloudCDNConfig(src *hcCdnModel.ConfigsGetBody, dest *huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent) *huaweicloudCDNUpdateDomainMultiCertificatesRequestBodyContent {
if src == nil { if src == nil {
return dest return dest
} }
@ -186,7 +193,7 @@ func mergeHuaweiCloudCDNConfig(src *cdnModel.ConfigsGetBody, dest *huaweicloudCD
} }
if src.ForceRedirect != nil { if src.ForceRedirect != nil {
dest.ForceRedirectConfig = &cdnModel.ForceRedirect{} dest.ForceRedirectConfig = &hcCdnModel.ForceRedirect{}
if src.ForceRedirect.Status == "on" { if src.ForceRedirect.Status == "on" {
dest.ForceRedirectConfig.Switch = 1 dest.ForceRedirectConfig.Switch = 1

View File

@ -9,13 +9,13 @@ type Uploader interface {
// 上传证书。 // 上传证书。
// //
// 入参: // 入参:
// - ctx // - ctx上下文。
// - certPem证书 PEM 内容 // - certPem证书 PEM 内容
// - privkeyPem私钥 PEM 内容 // - privkeyPem私钥 PEM 内容
// //
// 出参: // 出参:
// - res // - res上传结果。
// - err // - err: 错误。
Upload(ctx context.Context, certPem string, privkeyPem string) (res *UploadResult, err error) Upload(ctx context.Context, certPem string, privkeyPem string) (res *UploadResult, err error)
} }

View File

@ -26,8 +26,12 @@ type AliyunCASUploader struct {
sdkRuntime *util.RuntimeOptions sdkRuntime *util.RuntimeOptions
} }
func NewAliyunCASUploader(config *AliyunCASUploaderConfig) (*AliyunCASUploader, error) { func NewAliyunCASUploader(config *AliyunCASUploaderConfig) (Uploader, error) {
client, err := (&AliyunCASUploader{config: config}).createSdkClient() client, err := (&AliyunCASUploader{}).createSdkClient(
config.Region,
config.AccessKeyId,
config.AccessKeySecret,
)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create sdk client: %w", err) return nil, fmt.Errorf("failed to create sdk client: %w", err)
} }
@ -98,13 +102,13 @@ func (u *AliyunCASUploader) Upload(ctx context.Context, certPem string, privkeyP
if listUserCertificateOrderResp.Body.CertificateOrderList == nil || len(listUserCertificateOrderResp.Body.CertificateOrderList) < int(listUserCertificateOrderLimit) { if listUserCertificateOrderResp.Body.CertificateOrderList == nil || len(listUserCertificateOrderResp.Body.CertificateOrderList) < int(listUserCertificateOrderLimit) {
break break
} } else {
listUserCertificateOrderPage += 1 listUserCertificateOrderPage += 1
if listUserCertificateOrderPage > 99 { // 避免死循环 if listUserCertificateOrderPage > 99 { // 避免死循环
break break
} }
} }
}
// 生成新证书名(需符合阿里云命名规则) // 生成新证书名(需符合阿里云命名规则)
var certId, certName string var certId, certName string
@ -129,10 +133,7 @@ func (u *AliyunCASUploader) Upload(ctx context.Context, certPem string, privkeyP
}, nil }, nil
} }
func (u *AliyunCASUploader) createSdkClient() (*cas20200407.Client, error) { func (u *AliyunCASUploader) createSdkClient(region, accessKeyId, accessKeySecret string) (*cas20200407.Client, error) {
region := u.config.Region
accessKeyId := u.config.AccessKeyId
accessKeySecret := u.config.AccessKeySecret
if region == "" { if region == "" {
region = "cn-hangzhou" // CAS 服务默认区域:华东一杭州 region = "cn-hangzhou" // CAS 服务默认区域:华东一杭州
} }

View File

@ -26,8 +26,12 @@ type HuaweiCloudELBUploader struct {
sdkClient *hcElb.ElbClient sdkClient *hcElb.ElbClient
} }
func NewHuaweiCloudELBUploader(config *HuaweiCloudELBUploaderConfig) (*HuaweiCloudELBUploader, error) { func NewHuaweiCloudELBUploader(config *HuaweiCloudELBUploaderConfig) (Uploader, error) {
client, err := (&HuaweiCloudELBUploader{config: config}).createSdkClient() client, err := (&HuaweiCloudELBUploader{}).createSdkClient(
config.Region,
config.AccessKeyId,
config.SecretAccessKey,
)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create sdk client: %w", err) return nil, fmt.Errorf("failed to create sdk client: %w", err)
} }
@ -87,14 +91,14 @@ func (u *HuaweiCloudELBUploader) Upload(ctx context.Context, certPem string, pri
if listCertificatesResp.Certificates == nil || len(*listCertificatesResp.Certificates) < int(listCertificatesLimit) { if listCertificatesResp.Certificates == nil || len(*listCertificatesResp.Certificates) < int(listCertificatesLimit) {
break break
} } else {
listCertificatesMarker = listCertificatesResp.PageInfo.NextMarker listCertificatesMarker = listCertificatesResp.PageInfo.NextMarker
listCertificatesPage++ listCertificatesPage++
if listCertificatesPage >= 9 { // 避免死循环 if listCertificatesPage >= 9 { // 避免死循环
break break
} }
} }
}
// 生成新证书名(需符合华为云命名规则) // 生成新证书名(需符合华为云命名规则)
var certId, certName string var certId, certName string
@ -125,10 +129,7 @@ func (u *HuaweiCloudELBUploader) Upload(ctx context.Context, certPem string, pri
}, nil }, nil
} }
func (u *HuaweiCloudELBUploader) createSdkClient() (*hcElb.ElbClient, error) { func (u *HuaweiCloudELBUploader) createSdkClient(region, accessKeyId, secretAccessKey string) (*hcElb.ElbClient, error) {
region := u.config.Region
accessKeyId := u.config.AccessKeyId
secretAccessKey := u.config.SecretAccessKey
if region == "" { if region == "" {
region = "cn-north-4" // ELB 服务默认区域:华北四北京 region = "cn-north-4" // ELB 服务默认区域:华北四北京
} }

View File

@ -25,8 +25,12 @@ type HuaweiCloudSCMUploader struct {
sdkClient *hcScm.ScmClient sdkClient *hcScm.ScmClient
} }
func NewHuaweiCloudSCMUploader(config *HuaweiCloudSCMUploaderConfig) (*HuaweiCloudSCMUploader, error) { func NewHuaweiCloudSCMUploader(config *HuaweiCloudSCMUploaderConfig) (Uploader, error) {
client, err := (&HuaweiCloudSCMUploader{config: config}).createSdkClient() client, err := (&HuaweiCloudSCMUploader{}).createSdkClient(
config.Region,
config.AccessKeyId,
config.SecretAccessKey,
)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create sdk client: %w", err) return nil, fmt.Errorf("failed to create sdk client: %w", err)
} }
@ -99,14 +103,14 @@ func (u *HuaweiCloudSCMUploader) Upload(ctx context.Context, certPem string, pri
if listCertificatesResp.Certificates == nil || len(*listCertificatesResp.Certificates) < int(listCertificatesLimit) { if listCertificatesResp.Certificates == nil || len(*listCertificatesResp.Certificates) < int(listCertificatesLimit) {
break break
} } else {
listCertificatesOffset += listCertificatesLimit listCertificatesOffset += listCertificatesLimit
listCertificatesPage += 1 listCertificatesPage += 1
if listCertificatesPage > 99 { // 避免死循环 if listCertificatesPage > 99 { // 避免死循环
break break
} }
} }
}
// 生成新证书名(需符合华为云命名规则) // 生成新证书名(需符合华为云命名规则)
var certId, certName string var certId, certName string
@ -133,10 +137,7 @@ func (u *HuaweiCloudSCMUploader) Upload(ctx context.Context, certPem string, pri
}, nil }, nil
} }
func (u *HuaweiCloudSCMUploader) createSdkClient() (*hcScm.ScmClient, error) { func (u *HuaweiCloudSCMUploader) createSdkClient(region, accessKeyId, secretAccessKey string) (*hcScm.ScmClient, error) {
region := u.config.Region
accessKeyId := u.config.AccessKeyId
secretAccessKey := u.config.SecretAccessKey
if region == "" { if region == "" {
region = "cn-north-4" // SCM 服务默认区域:华北四北京 region = "cn-north-4" // SCM 服务默认区域:华北四北京
} }

View File

@ -23,8 +23,12 @@ type TencentCloudSSLUploader struct {
sdkClient *tcSsl.Client sdkClient *tcSsl.Client
} }
func NewTencentCloudSSLUploader(config *TencentCloudSSLUploaderConfig) (*TencentCloudSSLUploader, error) { func NewTencentCloudSSLUploader(config *TencentCloudSSLUploaderConfig) (Uploader, error) {
client, err := (&TencentCloudSSLUploader{config: config}).createSdkClient() client, err := (&TencentCloudSSLUploader{}).createSdkClient(
config.Region,
config.SecretId,
config.SecretKey,
)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create sdk client: %w", err) return nil, fmt.Errorf("failed to create sdk client: %w", err)
} }
@ -73,10 +77,7 @@ func (u *TencentCloudSSLUploader) Upload(ctx context.Context, certPem string, pr
}, nil }, nil
} }
func (u *TencentCloudSSLUploader) createSdkClient() (*tcSsl.Client, error) { func (u *TencentCloudSSLUploader) createSdkClient(region, secretId, secretKey string) (*tcSsl.Client, error) {
region := u.config.Region
secretId := u.config.SecretId
secretKey := u.config.SecretKey
if region == "" { if region == "" {
region = "ap-guangzhou" // SSL 服务默认区域:广州 region = "ap-guangzhou" // SSL 服务默认区域:广州
} }

View File

@ -12,8 +12,8 @@ import (
// - certPem: 证书 PEM 内容。 // - certPem: 证书 PEM 内容。
// //
// 出参: // 出参:
// - cert: // - cert: x509.Certificate 对象。
// - err: // - err: 错误。
func ParseCertificateFromPEM(certPem string) (cert *x509.Certificate, err error) { func ParseCertificateFromPEM(certPem string) (cert *x509.Certificate, err error) {
pemData := []byte(certPem) pemData := []byte(certPem)

View File

@ -64,15 +64,15 @@ const DeployToAliyunOSS = () => {
}); });
const bucketSchema = z.string().min(1, { const bucketSchema = z.string().min(1, {
message: t("domain.deployment.form.oss_bucket.placeholder"), message: t("domain.deployment.form.aliyun_oss_bucket.placeholder"),
}); });
return ( return (
<div className="flex flex-col space-y-8"> <div className="flex flex-col space-y-8">
<div> <div>
<Label>{t("domain.deployment.form.oss_endpoint.label")}</Label> <Label>{t("domain.deployment.form.aliyun_oss_endpoint.label")}</Label>
<Input <Input
placeholder={t("domain.deployment.form.oss_endpoint.placeholder")} placeholder={t("domain.deployment.form.aliyun_oss_endpoint.placeholder")}
className="w-full mt-1" className="w-full mt-1"
value={data?.config?.endpoint} value={data?.config?.endpoint}
onChange={(e) => { onChange={(e) => {
@ -91,9 +91,9 @@ const DeployToAliyunOSS = () => {
</div> </div>
<div> <div>
<Label>{t("domain.deployment.form.oss_bucket.label")}</Label> <Label>{t("domain.deployment.form.aliyun_oss_bucket.label")}</Label>
<Input <Input
placeholder={t("domain.deployment.form.oss_bucket.placeholder")} placeholder={t("domain.deployment.form.aliyun_oss_bucket.placeholder")}
className="w-full mt-1" className="w-full mt-1"
value={data?.config?.bucket} value={data?.config?.bucket}
onChange={(e) => { onChange={(e) => {

View File

@ -37,6 +37,23 @@ const DeployToHuaweiCloudCDN = () => {
return ( return (
<div className="flex flex-col space-y-8"> <div className="flex flex-col space-y-8">
<div>
<Label>{t("domain.deployment.form.huaweicloud_elb_region.label")}</Label>
<Input
placeholder={t("domain.deployment.form.huaweicloud_elb_region.placeholder")}
className="w-full mt-1"
value={data?.config?.region}
onChange={(e) => {
const newData = produce(data, (draft) => {
draft.config ??= {};
draft.config.region = e.target.value;
});
setDeploy(newData);
}}
/>
<div className="text-red-600 text-sm mt-1">{error?.domain}</div>
</div>
<div> <div>
<Label>{t("domain.deployment.form.domain.label")}</Label> <Label>{t("domain.deployment.form.domain.label")}</Label>
<Input <Input

View File

@ -64,15 +64,15 @@ const DeployToTencentCOS = () => {
}); });
const bucketSchema = z.string().min(1, { const bucketSchema = z.string().min(1, {
message: t("domain.deployment.form.cos_region.placeholder"), message: t("domain.deployment.form.tencent_cos_region.placeholder"),
}); });
return ( return (
<div className="flex flex-col space-y-8"> <div className="flex flex-col space-y-8">
<div> <div>
<Label>{t("domain.deployment.form.cos_region.label")}</Label> <Label>{t("domain.deployment.form.tencent_cos_region.label")}</Label>
<Input <Input
placeholder={t("domain.deployment.form.cos_region.placeholder")} placeholder={t("domain.deployment.form.tencent_cos_region.placeholder")}
className="w-full mt-1" className="w-full mt-1"
value={data?.config?.region} value={data?.config?.region}
onChange={(e) => { onChange={(e) => {
@ -91,9 +91,9 @@ const DeployToTencentCOS = () => {
</div> </div>
<div> <div>
<Label>{t("domain.deployment.form.cos_bucket.label")}</Label> <Label>{t("domain.deployment.form.tencent_cos_bucket.label")}</Label>
<Input <Input
placeholder={t("domain.deployment.form.cos_bucket.placeholder")} placeholder={t("domain.deployment.form.tencent_cos_bucket.placeholder")}
className="w-full mt-1" className="w-full mt-1"
value={data?.config?.bucket} value={data?.config?.bucket}
onChange={(e) => { onChange={(e) => {

View File

@ -54,12 +54,18 @@
"domain.deployment.form.access.label": "Access Configuration", "domain.deployment.form.access.label": "Access Configuration",
"domain.deployment.form.access.placeholder": "Please select provider authorization configuration", "domain.deployment.form.access.placeholder": "Please select provider authorization configuration",
"domain.deployment.form.access.list": "Provider Authorization Configurations", "domain.deployment.form.access.list": "Provider Authorization Configurations",
"domain.deployment.form.cos_region.label": "Region",
"domain.deployment.form.cos_region.placeholder": "Please enter region, e.g. ap-guangzhou",
"domain.deployment.form.cos_bucket.label": "Bucket",
"domain.deployment.form.cos_bucket.placeholder": "Please enter bucket, e.g. example-1250000000",
"domain.deployment.form.domain.label": "Deploy to domain (Single domain only, not wildcard domain)", "domain.deployment.form.domain.label": "Deploy to domain (Single domain only, not wildcard domain)",
"domain.deployment.form.domain.placeholder": "Please enter domain to be deployed", "domain.deployment.form.domain.placeholder": "Please enter domain to be deployed",
"domain.deployment.form.aliyun_oss_endpoint.label": "Endpoint",
"domain.deployment.form.aliyun_oss_endpoint.placeholder": "Please enter endpoint",
"domain.deployment.form.aliyun_oss_bucket.label": "Bucket",
"domain.deployment.form.aliyun_oss_bucket.placeholder": "Please enter bucket",
"domain.deployment.form.tencent_cos_region.label": "Region",
"domain.deployment.form.tencent_cos_region.placeholder": "Please enter region (e.g. ap-guangzhou)",
"domain.deployment.form.tencent_cos_bucket.label": "Bucket",
"domain.deployment.form.tencent_cos_bucket.placeholder": "Please enter bucket",
"domain.deployment.form.huaweicloud_elb_region.label": "Region",
"domain.deployment.form.huaweicloud_elb_region.placeholder": "Please enter region (e.g. cn-north-1)",
"domain.deployment.form.ssh_key_path.label": "Private Key Save Path", "domain.deployment.form.ssh_key_path.label": "Private Key Save Path",
"domain.deployment.form.ssh_key_path.placeholder": "Please enter private key save path", "domain.deployment.form.ssh_key_path.placeholder": "Please enter private key save path",
"domain.deployment.form.ssh_cert_path.label": "Certificate Save Path", "domain.deployment.form.ssh_cert_path.label": "Certificate Save Path",
@ -68,10 +74,6 @@
"domain.deployment.form.ssh_pre_command.placeholder": "Command to be executed before deploying the certificate", "domain.deployment.form.ssh_pre_command.placeholder": "Command to be executed before deploying the certificate",
"domain.deployment.form.ssh_command.label": "Command", "domain.deployment.form.ssh_command.label": "Command",
"domain.deployment.form.ssh_command.placeholder": "Please enter command", "domain.deployment.form.ssh_command.placeholder": "Please enter command",
"domain.deployment.form.oss_endpoint.label": "Endpoint",
"domain.deployment.form.oss_endpoint.placeholder": "Please enter endpoint",
"domain.deployment.form.oss_bucket.label": "Bucket",
"domain.deployment.form.oss_bucket.placeholder": "Please enter bucket",
"domain.deployment.form.k8s_namespace.label": "Namespace", "domain.deployment.form.k8s_namespace.label": "Namespace",
"domain.deployment.form.k8s_namespace.placeholder": "Please enter namespace", "domain.deployment.form.k8s_namespace.placeholder": "Please enter namespace",
"domain.deployment.form.k8s_secret_name.label": "Secret Name", "domain.deployment.form.k8s_secret_name.label": "Secret Name",

View File

@ -54,12 +54,18 @@
"domain.deployment.form.access.label": "授权配置", "domain.deployment.form.access.label": "授权配置",
"domain.deployment.form.access.placeholder": "请选择授权配置", "domain.deployment.form.access.placeholder": "请选择授权配置",
"domain.deployment.form.access.list": "服务商授权配置列表", "domain.deployment.form.access.list": "服务商授权配置列表",
"domain.deployment.form.cos_region.label": "region",
"domain.deployment.form.cos_region.placeholder": "请输入 region, 如 ap-guangzhou",
"domain.deployment.form.cos_bucket.label": "存储桶",
"domain.deployment.form.cos_bucket.placeholder": "请输入存储桶名, 如 example-1250000000",
"domain.deployment.form.domain.label": "部署到域名(仅支持单个域名;不支持泛域名)", "domain.deployment.form.domain.label": "部署到域名(仅支持单个域名;不支持泛域名)",
"domain.deployment.form.domain.placeholder": "请输入部署到的域名", "domain.deployment.form.domain.placeholder": "请输入部署到的域名",
"domain.deployment.form.aliyun_oss_endpoint.label": "Endpoint",
"domain.deployment.form.aliyun_oss_endpoint.placeholder": "请输入 Endpoint",
"domain.deployment.form.aliyun_oss_bucket.label": "存储桶",
"domain.deployment.form.aliyun_oss_bucket.placeholder": "请输入存储桶名",
"domain.deployment.form.tencent_cos_region.label": "地域",
"domain.deployment.form.tencent_cos_region.placeholder": "请输入地域(如 ap-guangzhou",
"domain.deployment.form.tencent_cos_bucket.label": "存储桶",
"domain.deployment.form.tencent_cos_bucket.placeholder": "请输入存储桶名",
"domain.deployment.form.huaweicloud_elb_region.label": "地域",
"domain.deployment.form.huaweicloud_elb_region.placeholder": "请输入地域(如 cn-north-1",
"domain.deployment.form.ssh_key_path.label": "私钥保存路径", "domain.deployment.form.ssh_key_path.label": "私钥保存路径",
"domain.deployment.form.ssh_key_path.placeholder": "请输入私钥保存路径", "domain.deployment.form.ssh_key_path.placeholder": "请输入私钥保存路径",
"domain.deployment.form.ssh_cert_path.label": "证书保存路径", "domain.deployment.form.ssh_cert_path.label": "证书保存路径",
@ -68,10 +74,6 @@
"domain.deployment.form.ssh_pre_command.placeholder": "在部署证书前执行的命令", "domain.deployment.form.ssh_pre_command.placeholder": "在部署证书前执行的命令",
"domain.deployment.form.ssh_command.label": "命令", "domain.deployment.form.ssh_command.label": "命令",
"domain.deployment.form.ssh_command.placeholder": "请输入要执行的命令", "domain.deployment.form.ssh_command.placeholder": "请输入要执行的命令",
"domain.deployment.form.oss_endpoint.label": "Endpoint",
"domain.deployment.form.oss_endpoint.placeholder": "请输入 Endpoint",
"domain.deployment.form.oss_bucket.label": "存储桶",
"domain.deployment.form.oss_bucket.placeholder": "请输入存储桶名",
"domain.deployment.form.k8s_namespace.label": "命名空间", "domain.deployment.form.k8s_namespace.label": "命名空间",
"domain.deployment.form.k8s_namespace.placeholder": "请输入 K8S 命名空间", "domain.deployment.form.k8s_namespace.placeholder": "请输入 K8S 命名空间",
"domain.deployment.form.k8s_secret_name.label": "Secret 名称", "domain.deployment.form.k8s_secret_name.label": "Secret 名称",