mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-05 14:04:54 +00:00
feat: add aliyun apigw deployer
This commit is contained in:
@@ -18,6 +18,7 @@ import { useWorkflowStore } from "@/stores/workflow";
|
||||
import DeployNodeConfigForm1PanelConsoleConfig from "./DeployNodeConfigForm1PanelConsoleConfig";
|
||||
import DeployNodeConfigForm1PanelSiteConfig from "./DeployNodeConfigForm1PanelSiteConfig";
|
||||
import DeployNodeConfigFormAliyunALBConfig from "./DeployNodeConfigFormAliyunALBConfig";
|
||||
import DeployNodeConfigFormAliyunAPIGWConfig from "./DeployNodeConfigFormAliyunAPIGWConfig";
|
||||
import DeployNodeConfigFormAliyunCASConfig from "./DeployNodeConfigFormAliyunCASConfig";
|
||||
import DeployNodeConfigFormAliyunCASDeployConfig from "./DeployNodeConfigFormAliyunCASDeployConfig";
|
||||
import DeployNodeConfigFormAliyunCDNConfig from "./DeployNodeConfigFormAliyunCDNConfig";
|
||||
@@ -177,6 +178,8 @@ const DeployNodeConfigForm = forwardRef<DeployNodeConfigFormInstance, DeployNode
|
||||
return <DeployNodeConfigForm1PanelSiteConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.ALIYUN_ALB:
|
||||
return <DeployNodeConfigFormAliyunALBConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.ALIYUN_APIGW:
|
||||
return <DeployNodeConfigFormAliyunAPIGWConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.ALIYUN_CAS:
|
||||
return <DeployNodeConfigFormAliyunCASConfig {...nestedFormProps} />;
|
||||
case DEPLOY_PROVIDERS.ALIYUN_CAS_DEPLOY:
|
||||
|
@@ -0,0 +1,133 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Form, type FormInstance, Input, Select } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
import Show from "@/components/Show";
|
||||
import { validDomainName } from "@/utils/validators";
|
||||
|
||||
type DeployNodeConfigFormAliyunAPIGWConfigFieldValues = Nullish<{
|
||||
serviceType: string;
|
||||
region: string;
|
||||
gatewayId?: string;
|
||||
groupId?: string;
|
||||
domain?: string;
|
||||
}>;
|
||||
|
||||
export type DeployNodeConfigFormAliyunAPIGWConfigProps = {
|
||||
form: FormInstance;
|
||||
formName: string;
|
||||
disabled?: boolean;
|
||||
initialValues?: DeployNodeConfigFormAliyunAPIGWConfigFieldValues;
|
||||
onValuesChange?: (values: DeployNodeConfigFormAliyunAPIGWConfigFieldValues) => void;
|
||||
};
|
||||
|
||||
const SERVICE_TYPE_CLOUDNATIVE = "cloudnative" as const;
|
||||
const SERVICE_TYPE_TRADITIONAL = "traditional" as const;
|
||||
|
||||
const initFormModel = (): DeployNodeConfigFormAliyunAPIGWConfigFieldValues => {
|
||||
return {};
|
||||
};
|
||||
|
||||
const DeployNodeConfigFormAliyunAPIGWConfig = ({
|
||||
form: formInst,
|
||||
formName,
|
||||
disabled,
|
||||
initialValues,
|
||||
onValuesChange,
|
||||
}: DeployNodeConfigFormAliyunAPIGWConfigProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSchema = z.object({
|
||||
serviceType: z.union([z.literal(SERVICE_TYPE_CLOUDNATIVE), z.literal(SERVICE_TYPE_TRADITIONAL)], {
|
||||
message: t("workflow_node.deploy.form.aliyun_apigw_service_type.placeholder"),
|
||||
}),
|
||||
region: z
|
||||
.string({ message: t("workflow_node.deploy.form.aliyun_apigw_region.placeholder") })
|
||||
.nonempty(t("workflow_node.deploy.form.aliyun_apigw_region.placeholder"))
|
||||
.trim(),
|
||||
gatewayId: z
|
||||
.string()
|
||||
.nullish()
|
||||
.refine((v) => fieldServiceType !== SERVICE_TYPE_CLOUDNATIVE || !!v?.trim(), t("workflow_node.deploy.form.aliyun_apigw_gateway_id.placeholder")),
|
||||
groupId: z
|
||||
.string()
|
||||
.nullish()
|
||||
.refine((v) => fieldServiceType !== SERVICE_TYPE_TRADITIONAL || !!v?.trim(), t("workflow_node.deploy.form.aliyun_apigw_group_id.placeholder")),
|
||||
domain: z
|
||||
.string()
|
||||
.nonempty(t("workflow_node.deploy.form.aliyun_apigw_domain.placeholder"))
|
||||
.refine((v) => validDomainName(v!, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||
});
|
||||
const formRule = createSchemaFieldRule(formSchema);
|
||||
|
||||
const fieldServiceType = Form.useWatch("serviceType", formInst);
|
||||
|
||||
const handleFormChange = (_: unknown, values: z.infer<typeof formSchema>) => {
|
||||
onValuesChange?.(values);
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
form={formInst}
|
||||
disabled={disabled}
|
||||
initialValues={initialValues ?? initFormModel()}
|
||||
layout="vertical"
|
||||
name={formName}
|
||||
onValuesChange={handleFormChange}
|
||||
>
|
||||
<Form.Item name="serviceType" label={t("workflow_node.deploy.form.aliyun_apigw_service_type.label")} rules={[formRule]}>
|
||||
<Select placeholder={t("workflow_node.deploy.form.aliyun_apigw_service_type.placeholder")}>
|
||||
<Select.Option key={SERVICE_TYPE_CLOUDNATIVE} value={SERVICE_TYPE_CLOUDNATIVE}>
|
||||
{t("workflow_node.deploy.form.aliyun_apigw_service_type.option.cloudnative.label")}
|
||||
</Select.Option>
|
||||
<Select.Option key={SERVICE_TYPE_TRADITIONAL} value={SERVICE_TYPE_TRADITIONAL}>
|
||||
{t("workflow_node.deploy.form.aliyun_apigw_service_type.option.traditional.label")}
|
||||
</Select.Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="region"
|
||||
label={t("workflow_node.deploy.form.aliyun_apigw_region.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_apigw_region.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.aliyun_apigw_region.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Show when={fieldServiceType === SERVICE_TYPE_CLOUDNATIVE}>
|
||||
<Form.Item
|
||||
name="gatewayId"
|
||||
label={t("workflow_node.deploy.form.aliyun_apigw_gateway_id.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_apigw_gateway_id.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.aliyun_apigw_gateway_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Show>
|
||||
|
||||
<Show when={fieldServiceType === SERVICE_TYPE_TRADITIONAL}>
|
||||
<Form.Item
|
||||
name="groupId"
|
||||
label={t("workflow_node.deploy.form.aliyun_apigw_group_id.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_apigw_group_id.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.aliyun_apigw_group_id.placeholder")} />
|
||||
</Form.Item>
|
||||
</Show>
|
||||
|
||||
<Form.Item
|
||||
name="domain"
|
||||
label={t("workflow_node.deploy.form.aliyun_apigw_domain.label")}
|
||||
rules={[formRule]}
|
||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.deploy.form.aliyun_apigw_domain.tooltip") }}></span>}
|
||||
>
|
||||
<Input placeholder={t("workflow_node.deploy.form.aliyun_apigw_domain.placeholder")} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
export default DeployNodeConfigFormAliyunAPIGWConfig;
|
@@ -305,6 +305,7 @@ export const DEPLOY_PROVIDERS = Object.freeze({
|
||||
["1PANEL_CONSOLE"]: `${ACCESS_PROVIDERS["1PANEL"]}-console`,
|
||||
["1PANEL_SITE"]: `${ACCESS_PROVIDERS["1PANEL"]}-site`,
|
||||
ALIYUN_ALB: `${ACCESS_PROVIDERS.ALIYUN}-alb`,
|
||||
ALIYUN_APIGW: `${ACCESS_PROVIDERS.ALIYUN}-apigw`,
|
||||
ALIYUN_CAS: `${ACCESS_PROVIDERS.ALIYUN}-cas`,
|
||||
ALIYUN_CAS_DEPLOY: `${ACCESS_PROVIDERS.ALIYUN}-casdeploy`,
|
||||
ALIYUN_CDN: `${ACCESS_PROVIDERS.ALIYUN}-cdn`,
|
||||
@@ -422,6 +423,7 @@ export const deployProvidersMap: Map<DeployProvider["type"] | string, DeployProv
|
||||
[DEPLOY_PROVIDERS.ALIYUN_LIVE, "provider.aliyun.live", DEPLOY_CATEGORIES.AV],
|
||||
[DEPLOY_PROVIDERS.ALIYUN_VOD, "provider.aliyun.vod", DEPLOY_CATEGORIES.AV],
|
||||
[DEPLOY_PROVIDERS.ALIYUN_FC, "provider.aliyun.fc", DEPLOY_CATEGORIES.SERVERLESS],
|
||||
[DEPLOY_PROVIDERS.ALIYUN_APIGW, "provider.aliyun.apigw", DEPLOY_CATEGORIES.OTHER],
|
||||
[DEPLOY_PROVIDERS.ALIYUN_CAS, "provider.aliyun.cas_upload", DEPLOY_CATEGORIES.OTHER],
|
||||
[DEPLOY_PROVIDERS.ALIYUN_CAS_DEPLOY, "provider.aliyun.cas_deploy", DEPLOY_CATEGORIES.OTHER],
|
||||
[DEPLOY_PROVIDERS.TENCENTCLOUD_COS, "provider.tencentcloud.cos", DEPLOY_CATEGORIES.STORAGE],
|
||||
|
@@ -5,6 +5,7 @@
|
||||
"provider.acmehttpreq": "Http Request (ACME Proxy)",
|
||||
"provider.aliyun": "Alibaba Cloud",
|
||||
"provider.aliyun.alb": "Alibaba Cloud - ALB (Application Load Balancer)",
|
||||
"provider.aliyun.apigw": "Alibaba Cloud - API Gateway",
|
||||
"provider.aliyun.cas_upload": "Alibaba Cloud - Upload to CAS (Certificate Management Service)",
|
||||
"provider.aliyun.cas_deploy": "Alibaba Cloud - Deploy via CAS (Certificate Management Service)",
|
||||
"provider.aliyun.cdn": "Alibaba Cloud - CDN (Content Delivery Network)",
|
||||
|
@@ -122,6 +122,22 @@
|
||||
"workflow_node.deploy.form.aliyun_alb_snidomain.label": "Alibaba Cloud ALB SNI domain (Optional)",
|
||||
"workflow_node.deploy.form.aliyun_alb_snidomain.placeholder": "Please enter Alibaba Cloud ALB SNI domain name",
|
||||
"workflow_node.deploy.form.aliyun_alb_snidomain.tooltip": "For more information, see <a href=\"https://slb.console.aliyun.com/alb\" target=\"_blank\">https://slb.console.aliyun.com/alb</a>",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.label": "Alibaba Cloud API gateway type",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.placeholder": "Please select Alibaba Cloud API gateway type",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.option.cloudnative.label": "Cloud-native API gateway",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.option.traditional.label": "Traditional API gateway",
|
||||
"workflow_node.deploy.form.aliyun_apigw_region.label": "Alibaba Cloud API gateway region",
|
||||
"workflow_node.deploy.form.aliyun_apigw_region.placeholder": "Please enter Alibaba Cloud API gateway region (e.g. cn-hangzhou)",
|
||||
"workflow_node.deploy.form.aliyun_apigw_region.tooltip": "For more information, see <a href=\"https://www.alibabacloud.com/help/en/api-gateway/cloud-native-api-gateway/product-overview/regions\" target=\"_blank\">https://www.alibabacloud.com/help/en/api-gateway/cloud-native-api-gateway/product-overview/regions</a>",
|
||||
"workflow_node.deploy.form.aliyun_apigw_gateway_id.label": "Alibaba Cloud API gateway ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_gateway_id.placeholder": "Please enter Alibaba Cloud API gateway ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_gateway_id.tooltip": "For more information, see <a href=\"https://apigw.console.aliyun.com\" target=\"_blank\">https://apigw.console.aliyun.com</a>",
|
||||
"workflow_node.deploy.form.aliyun_apigw_group_id.label": "Alibaba Cloud API group ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_group_id.placeholder": "Please enter Alibaba Cloud API group ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_group_id.tooltip": "For more information, see <a href=\"https://apigateway.console.aliyun.com\" target=\"_blank\">https://apigateway.console.aliyun.com</a>",
|
||||
"workflow_node.deploy.form.aliyun_apigw_domain.label": "Alibaba Cloud API gateway domain",
|
||||
"workflow_node.deploy.form.aliyun_apigw_domain.placeholder": "Please enter Alibaba Cloud API gateway domain",
|
||||
"workflow_node.deploy.form.aliyun_apigw_domain.tooltip": "For more information, see <a href=\"https://apigw.console.aliyun.com\" target=\"_blank\">https://apigw.console.aliyun.com</a> or <a href=\"https://apigateway.console.aliyun.com\" target=\"_blank\">https://apigateway.console.aliyun.com</a>",
|
||||
"workflow_node.deploy.form.aliyun_cas_region.label": "Alibaba Cloud CAS region",
|
||||
"workflow_node.deploy.form.aliyun_cas_region.placeholder": "Please enter Alibaba Cloud CAS region (e.g. cn-hangzhou)",
|
||||
"workflow_node.deploy.form.aliyun_cas_region.tooltip": "For more information, see <a href=\"https://www.alibabacloud.com/help/en/ssl-certificate/developer-reference/endpoints\" target=\"_blank\">https://www.alibabacloud.com/help/en/ssl-certificate/developer-reference/endpoints</a>",
|
||||
|
@@ -5,6 +5,7 @@
|
||||
"provider.acmehttpreq": "Http Request (ACME Proxy)",
|
||||
"provider.aliyun": "阿里云",
|
||||
"provider.aliyun.alb": "阿里云 - 应用型负载均衡 ALB",
|
||||
"provider.aliyun.apigw": "阿里云 - API 网关",
|
||||
"provider.aliyun.cas_upload": "阿里云 - 上传到数字证书管理服务 CAS",
|
||||
"provider.aliyun.cas_deploy": "阿里云 - 通过数字证书管理服务 CAS 创建部署任务",
|
||||
"provider.aliyun.cdn": "阿里云 - 内容分发网络 CDN",
|
||||
|
@@ -121,6 +121,22 @@
|
||||
"workflow_node.deploy.form.aliyun_alb_snidomain.label": "阿里云 ALB 扩展域名(可选)",
|
||||
"workflow_node.deploy.form.aliyun_alb_snidomain.placeholder": "请输入阿里云 ALB 扩展域名(支持泛域名)",
|
||||
"workflow_node.deploy.form.aliyun_alb_snidomain.tooltip": "这是什么?请参阅 <a href=\"https://slb.console.aliyun.com/alb\" target=\"_blank\">https://slb.console.aliyun.com/alb</a><br><br>不填写时,将替换监听器的默认证书;否则,将替换扩展域名证书。",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.label": "阿里云 API 网关服务类型",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.placeholder": "请选择阿里云 API 网关服务类型",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.option.cloudnative.label": "云原生 API 网关",
|
||||
"workflow_node.deploy.form.aliyun_apigw_service_type.option.traditional.label": "原 API 网关",
|
||||
"workflow_node.deploy.form.aliyun_apigw_region.label": "阿里云 API 网关服务地域",
|
||||
"workflow_node.deploy.form.aliyun_apigw_region.placeholder": "请输入阿里云 API 网关地域(例如:cn-hangzhou)",
|
||||
"workflow_node.deploy.form.aliyun_apigw_region.tooltip": "这是什么?请参阅 <a href=\"https://help.aliyun.com/zh/api-gateway/cloud-native-api-gateway/product-overview/regions\" target=\"_blank\">https://help.aliyun.com/zh/api-gateway/cloud-native-api-gateway/product-overview/regions</a>",
|
||||
"workflow_node.deploy.form.aliyun_apigw_gateway_id.label": "阿里云 API 网关 ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_gateway_id.placeholder": "请输入阿里云 API 网关 ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_gateway_id.tooltip": "这是什么?请参阅 <a href=\"https://apigw.console.aliyun.com\" target=\"_blank\">https://apigw.console.aliyun.com</a>",
|
||||
"workflow_node.deploy.form.aliyun_apigw_group_id.label": "阿里云 API 分组 ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_group_id.placeholder": "请输入阿里云 API 分组 ID",
|
||||
"workflow_node.deploy.form.aliyun_apigw_group_id.tooltip": "这是什么?请参阅 <a href=\"https://apigateway.console.aliyun.com\" target=\"_blank\">https://apigateway.console.aliyun.com</a>",
|
||||
"workflow_node.deploy.form.aliyun_apigw_domain.label": "阿里云 API 网关自定义域名",
|
||||
"workflow_node.deploy.form.aliyun_apigw_domain.placeholder": "请输入阿里云 API 网关自定义域名(支持泛域名)",
|
||||
"workflow_node.deploy.form.aliyun_apigw_domain.tooltip": "这是什么?请参阅 <a href=\"https://apigw.console.aliyun.com\" target=\"_blank\">https://apigw.console.aliyun.com</a> 或 <a href=\"https://apigateway.console.aliyun.com\" target=\"_blank\">https://apigateway.console.aliyun.com</a>",
|
||||
"workflow_node.deploy.form.aliyun_cas_region.label": "阿里云 CAS 服务地域",
|
||||
"workflow_node.deploy.form.aliyun_cas_region.placeholder": "请输入阿里云 CAS 服务地域(例如:cn-hangzhou)",
|
||||
"workflow_node.deploy.form.aliyun_cas_region.tooltip": "这是什么?请参阅 <a href=\"https://help.aliyun.com/zh/ssl-certificate/developer-reference/endpoints\" target=\"_blank\">https://help.aliyun.com/zh/ssl-certificate/developer-reference/endpoints</a>",
|
||||
|
Reference in New Issue
Block a user