This commit is contained in:
belier
2026-07-23 17:30:09 +08:00
committed by GitHub
parent e8139f085e
commit 600d1a26d5
7 changed files with 50 additions and 21 deletions
@@ -20,6 +20,7 @@ func init() {
AccessKeyId: credentials.AccessKeyId,
SecretAccessKey: credentials.SecretAccessKey,
ProjectName: credentials.ProjectName,
Region: xmaps.GetString(options.ProviderExtendedConfig, "region"),
SpaceName: xmaps.GetString(options.ProviderExtendedConfig, "spaceName"),
DomainMatchPattern: xmaps.GetString(options.ProviderExtendedConfig, "domainMatchPattern"),
DomainType: xmaps.GetString(options.ProviderExtendedConfig, "domainType"),
@@ -52,7 +52,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.AccessKeyId, config.SecretAccessKey, config.Region)
client, err := createSDKClient(config.AccessKeyId, config.SecretAccessKey)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -61,7 +61,6 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
AccessKeyId: config.AccessKeyId,
SecretAccessKey: config.SecretAccessKey,
ProjectName: config.ProjectName,
Region: config.Region,
})
if err != nil {
return nil, fmt.Errorf("could not create certmgr: %w", err)
@@ -209,14 +208,10 @@ func (d *Deployer) getAllDomains(ctx context.Context) ([]string, error) {
return domains, nil
}
func createSDKClient(accessKeyId, secretAccessKey, region string) (*vedcdn.DCDN, error) {
if region == "" {
region = "cn-beijing" // DCDN 服务默认区域:北京
}
func createSDKClient(accessKeyId, secretAccessKey string) (*vedcdn.DCDN, error) {
config := ve.NewConfig().
WithAkSk(accessKeyId, secretAccessKey).
WithRegion(region)
WithRegion("cn-beijing")
session, err := vesession.NewSession(config)
if err != nil {
@@ -30,6 +30,8 @@ type DeployerConfig struct {
SecretAccessKey string `json:"secretAccessKey"`
// 火山引擎项目名称。
ProjectName string `json:"projectName,omitempty"`
// 火山引擎地域。
Region string `json:"region"`
// 点播空间名称。
SpaceName string `json:"spaceName"`
// 域名匹配模式。
@@ -55,7 +57,7 @@ func NewDeployer(config *DeployerConfig) (*Deployer, error) {
return nil, fmt.Errorf("the configuration of the deployer provider is nil")
}
client, err := createSDKClient(config.AccessKeyId, config.SecretAccessKey)
client, err := createSDKClient(config.AccessKeyId, config.SecretAccessKey, config.Region)
if err != nil {
return nil, fmt.Errorf("could not create client: %w", err)
}
@@ -194,11 +196,15 @@ func (d *Deployer) getAllDomains(ctx context.Context) ([]string, error) {
return nil, fmt.Errorf("failed to execute sdk request 'vod.ListVodDomain': %w", err)
}
for _, domainItem := range listVodDomainResp.Domains {
if listVodDomainResp.VodInfo == nil {
break
}
for _, domainItem := range listVodDomainResp.VodInfo.Domains {
domains = append(domains, ve.StringValue(domainItem.Domain))
}
if len(listVodDomainResp.Domains) < listVodDomainPageSize {
if len(listVodDomainResp.VodInfo.Domains) < listVodDomainPageSize {
break
}
@@ -233,9 +239,14 @@ func (d *Deployer) updateDomainCertificate(ctx context.Context, domain string, c
return nil
}
func createSDKClient(accessKeyId, secretAccessKey string) (*vevod.VOD20260101, error) {
func createSDKClient(accessKeyId, secretAccessKey, region string) (*vevod.VOD20260101, error) {
if region == "" {
region = "cn-north-1" // VOD 服务默认区域:华北
}
config := ve.NewConfig().
WithAkSk(accessKeyId, secretAccessKey)
WithAkSk(accessKeyId, secretAccessKey).
WithRegion(region)
session, err := vesession.NewSession(config)
if err != nil {
@@ -36,6 +36,6 @@ func (c *VOD20260101) ListVodDomainsWithContext(ctx volcengine.Context, input *L
type ListVodDomainsInput = vod20260101.ListVodDomainsInput
type ListVodDomainsOutput = vod20260101.VodInfoForListVodDomainsOutput
type ListVodDomainsOutput = vod20260101.ListVodDomainsOutput
type ListCdnDomainsParamForListVodDomainsInput = vod20260101.ListCdnDomainsParamForListVodDomainsInput
@@ -34,6 +34,16 @@ const BizDeployNodeConfigFieldsProviderVolcEngineVOD = () => {
return (
<>
<Form.Item
name={[parentNamePath, "region"]}
initialValue={initialValues.region}
label={t("workflow_node.deploy.form.volcengine_vod_region.label")}
rules={[formRule]}
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.volcengine_vod_region.tooltip") }}></span>}
>
<Input placeholder={t("workflow_node.deploy.form.volcengine_vod_region.placeholder")} />
</Form.Item>
<Form.Item
name={[parentNamePath, "spaceName"]}
initialValue={initialValues.spaceName}
@@ -89,6 +99,7 @@ const BizDeployNodeConfigFieldsProviderVolcEngineVOD = () => {
const getInitialValues = (): Nullish<z.infer<ReturnType<typeof getSchema>>> => {
return {
region: "cn-north-1",
spaceName: "",
domainMatchPattern: DOMAIN_MATCH_PATTERN_EXACT,
domainType: DOMAIN_TYPE_PLAY,
@@ -101,7 +112,8 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
return z
.object({
spaceName: z.string().nonempty().nullish(),
region: z.string().nonempty(),
spaceName: z.string().nonempty(),
domainMatchPattern: z.string().nonempty().default(DOMAIN_MATCH_PATTERN_EXACT),
domainType: z.enum([DOMAIN_TYPE_PLAY, DOMAIN_TYPE_IMAGE, DOMAIN_TYPE_THIRD]),
domain: z.string().nullish(),
@@ -2700,7 +2700,7 @@
"volcengine_alb_region": {
"label": "VolcEngine region",
"placeholder": "Please enter VolcEngine ALB region (e.g. cn-beijing)",
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6767/127501\" target=\"_blank\">https://www.volcengine.com/docs/6767/127501</a>"
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6767/127501?lang=en\" target=\"_blank\">https://www.volcengine.com/docs/6767/127501</a>"
},
"volcengine_alb_deploy_target": {
"option": {
@@ -2730,7 +2730,7 @@
"volcengine_apig_region": {
"label": "VolcEngine region",
"placeholder": "Please enter VolcEngine API gateway region (e.g. cn-beijing)",
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6767/127501\" target=\"_blank\">https://www.volcengine.com/docs/6767/127501</a>"
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6767/127501?lang=en\" target=\"_blank\">https://www.volcengine.com/docs/6767/127501</a>"
},
"volcengine_apig_domain": {
"label": "VolcEngine API gateway custom domain",
@@ -2747,7 +2747,7 @@
"volcengine_clb_region": {
"label": "VolcEngine region",
"placeholder": "Please enter VolcEngine CLB region (e.g. cn-beijing)",
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6406/74892\" target=\"_blank\">https://www.volcengine.com/docs/6406/74892</a>"
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6406/74892?lang=en\" target=\"_blank\">https://www.volcengine.com/docs/6406/74892</a>"
},
"volcengine_clb_deploy_target": {
"option": {
@@ -2776,7 +2776,7 @@
"volcengine_imagex_region": {
"label": "VolcEngine region",
"placeholder": "Please enter VolcEngine ImageX region (e.g. cn-north-1)",
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/508/23757\" target=\"_blank\">https://www.volcengine.com/docs/508/23757</a>"
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/508/23757?lang=en\" target=\"_blank\">https://www.volcengine.com/docs/508/23757</a>"
},
"volcengine_imagex_service_id": {
"label": "VolcEngine ImageX service ID",
@@ -2794,7 +2794,7 @@
"volcengine_tos_region": {
"label": "VolcEngine region",
"placeholder": "Please enter VolcEngine TOS region (e.g. cn-beijing)",
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6349/107356\" target=\"_blank\">https://www.volcengine.com/docs/6349/107356</a>"
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6349/107356?lang=en\" target=\"_blank\">https://www.volcengine.com/docs/6349/107356</a>"
},
"volcengine_tos_bucket": {
"label": "VolcEngine TOS bucket",
@@ -2804,6 +2804,11 @@
"label": "VolcEngine TOS custom domain",
"placeholder": "Please enter VolcEngine TOS bucket custom domain name"
},
"volcengine_vod_region": {
"label": "VolcEngine region",
"placeholder": "Please enter VolcEngine VOD region (e.g. cn-north-1)",
"tooltip": "For more information, see <a href=\"https://docs.volcengine.com/docs/4/1215505?lang=en\" target=\"_blank\">https://docs.volcengine.com/docs/4/1215505</a>"
},
"volcengine_vod_space_name": {
"label": "VolcEngine VOD space name",
"placeholder": "Please enter VolcEngine VOD space name",
@@ -2831,7 +2836,7 @@
"volcengine_waf_region": {
"label": "VolcEngine region",
"placeholder": "Please enter VolcEngine WAF region (e.g. cn-beijing)",
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6511/1594024\" target=\"_blank\">https://www.volcengine.com/docs/6511/1594024</a>"
"tooltip": "For more information, see <a href=\"https://www.volcengine.com/docs/6511/1594024?lang=en\" target=\"_blank\">https://www.volcengine.com/docs/6511/1594024</a>"
},
"volcengine_waf_access_mode": {
"label": "VolcEngine WAF access mode",
@@ -2803,6 +2803,11 @@
"label": "火山引擎 TOS 自定义域名",
"placeholder": "请输入火山引擎 TOS 自定义域名"
},
"volcengine_vod_region": {
"label": "火山引擎服务地域",
"placeholder": "请输入火山引擎 VOD 服务地域(例如:cn-north-1",
"tooltip": "这是什么?请参阅 <a href=\"https://docs.volcengine.com/docs/4/1215505\" target=\"_blank\">https://docs.volcengine.com/docs/4/1215505</a>"
},
"volcengine_vod_space_name": {
"label": "火山引擎 VOD 空间名称",
"placeholder": "请输入火山引擎 VOD 空间名称",