mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-18 02:19:51 +00:00
fix tencent clb deploy failed
- 新增region参数 - 新增配置说明
This commit is contained in:
parent
7544286b0f
commit
6875151717
@ -85,13 +85,13 @@ func (d *TencentCLBDeployer) deploy(certId string) error {
|
|||||||
cpf := profile.NewClientProfile()
|
cpf := profile.NewClientProfile()
|
||||||
cpf.HttpProfile.Endpoint = "ssl.tencentcloudapi.com"
|
cpf.HttpProfile.Endpoint = "ssl.tencentcloudapi.com"
|
||||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||||
client, _ := ssl.NewClient(d.credential, "", cpf)
|
client, _ := ssl.NewClient(d.credential, getDeployString(d.option.DeployConfig, "region"), cpf)
|
||||||
|
|
||||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||||
request := ssl.NewDeployCertificateInstanceRequest()
|
request := ssl.NewDeployCertificateInstanceRequest()
|
||||||
|
|
||||||
request.CertificateId = common.StringPtr(certId)
|
request.CertificateId = common.StringPtr(certId)
|
||||||
request.ResourceType = common.StringPtr("cdn")
|
request.ResourceType = common.StringPtr("clb")
|
||||||
request.Status = common.Int64Ptr(1)
|
request.Status = common.Int64Ptr(1)
|
||||||
|
|
||||||
clbId := getDeployString(d.option.DeployConfig, "clbId")
|
clbId := getDeployString(d.option.DeployConfig, "clbId")
|
||||||
|
@ -61,6 +61,21 @@ const DeployToTencentCLB = () => {
|
|||||||
}
|
}
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const regionResp = regionSchema.safeParse(data.config?.region);
|
||||||
|
if (!regionResp.success) {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: JSON.parse(regionResp.error.message)[0].message,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data.id) {
|
if (!data.id) {
|
||||||
@ -70,11 +85,16 @@ const DeployToTencentCLB = () => {
|
|||||||
lsnId: "",
|
lsnId: "",
|
||||||
clbId: "",
|
clbId: "",
|
||||||
domain: "",
|
domain: "",
|
||||||
|
region: "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const regionSchema = z.string().regex(/^ap-[a-z]+$/, {
|
||||||
|
message: t("domain.deployment.form.clb_region.placeholder"),
|
||||||
|
});
|
||||||
|
|
||||||
const domainSchema = z.string().regex(/^$|^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, {
|
const domainSchema = z.string().regex(/^$|^(?:\*\.)?([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/, {
|
||||||
message: t("common.errmsg.domain_invalid"),
|
message: t("common.errmsg.domain_invalid"),
|
||||||
});
|
});
|
||||||
@ -89,6 +109,40 @@ const DeployToTencentCLB = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col space-y-8">
|
<div className="flex flex-col space-y-8">
|
||||||
|
<div>
|
||||||
|
<Label>{t("domain.deployment.form.clb_region.label")}</Label>
|
||||||
|
<Input
|
||||||
|
placeholder={t("domain.deployment.form.clb_region.placeholder")}
|
||||||
|
className="w-full mt-1"
|
||||||
|
value={data?.config?.region}
|
||||||
|
onChange={(e) => {
|
||||||
|
const temp = e.target.value;
|
||||||
|
|
||||||
|
const resp = regionSchema.safeParse(temp);
|
||||||
|
if (!resp.success) {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: JSON.parse(resp.error.message)[0].message,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setError({
|
||||||
|
...error,
|
||||||
|
region: "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const newData = produce(data, (draft) => {
|
||||||
|
if (!draft.config) {
|
||||||
|
draft.config = {};
|
||||||
|
}
|
||||||
|
draft.config.region = temp;
|
||||||
|
});
|
||||||
|
setDeploy(newData);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<div className="text-red-600 text-sm mt-1">{error?.region}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Label>{t("domain.deployment.form.clb_id.label")}</Label>
|
<Label>{t("domain.deployment.form.clb_id.label")}</Label>
|
||||||
<Input
|
<Input
|
||||||
|
@ -58,10 +58,12 @@
|
|||||||
"domain.deployment.form.cos_region.placeholder": "Please enter region, e.g. ap-guangzhou",
|
"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.label": "Bucket",
|
||||||
"domain.deployment.form.cos_bucket.placeholder": "Please enter bucket, e.g. example-1250000000",
|
"domain.deployment.form.cos_bucket.placeholder": "Please enter bucket, e.g. example-1250000000",
|
||||||
|
"domain.deployment.form.clb_region.label": "region(please distinguish between region and availability zone)",
|
||||||
|
"domain.deployment.form.clb_region.placeholder": "Please enter region, e.g. ap-guangzhou",
|
||||||
"domain.deployment.form.clb_id.label": "CLB id",
|
"domain.deployment.form.clb_id.label": "CLB id",
|
||||||
"domain.deployment.form.clb_id.placeholder": "Please enter CLB id, e.g. lb-xxxxxxxx",
|
"domain.deployment.form.clb_id.placeholder": "Please enter CLB id, e.g. lb-xxxxxxxx",
|
||||||
"domain.deployment.form.clb_listener.label": "Listener id",
|
"domain.deployment.form.clb_listener.label": "Listener id",
|
||||||
"domain.deployment.form.clb_listener.placeholder": "Please enter listener id, e.g. lbl-xxxxxxxx",
|
"domain.deployment.form.clb_listener.placeholder": "Please enter listener id, e.g. lbl-xxxxxxxx. The specific listener should have set the corresponding domain HTTPS forwarding, and the original certificate domain should be consistent with the certificate to be deployed.",
|
||||||
"domain.deployment.form.clb_domain.label": "Deploy to domain (Wildcard domain is also supported)",
|
"domain.deployment.form.clb_domain.label": "Deploy to domain (Wildcard domain is also supported)",
|
||||||
"domain.deployment.form.clb_domain.placeholder": "Please enter domain to be deployed. If SNI is not enabled, you can leave it blank.",
|
"domain.deployment.form.clb_domain.placeholder": "Please enter domain to be deployed. If SNI is not enabled, you can leave it blank.",
|
||||||
"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)",
|
||||||
|
@ -58,9 +58,11 @@
|
|||||||
"domain.deployment.form.cos_region.placeholder": "请输入 region, 如 ap-guangzhou",
|
"domain.deployment.form.cos_region.placeholder": "请输入 region, 如 ap-guangzhou",
|
||||||
"domain.deployment.form.cos_bucket.label": "存储桶",
|
"domain.deployment.form.cos_bucket.label": "存储桶",
|
||||||
"domain.deployment.form.cos_bucket.placeholder": "请输入存储桶名, 如 example-1250000000",
|
"domain.deployment.form.cos_bucket.placeholder": "请输入存储桶名, 如 example-1250000000",
|
||||||
|
"domain.deployment.form.clb_region.label": "region(地域, 请准确区分地域和可用区)",
|
||||||
|
"domain.deployment.form.clb_region.placeholder": "请输入 region, 如 ap-guangzhou",
|
||||||
"domain.deployment.form.clb_id.label": "CLB id",
|
"domain.deployment.form.clb_id.label": "CLB id",
|
||||||
"domain.deployment.form.clb_id.placeholder": "请输入CLB实例id, 如 lb-xxxxxxxx",
|
"domain.deployment.form.clb_id.placeholder": "请输入CLB实例id, 如 lb-xxxxxxxx",
|
||||||
"domain.deployment.form.clb_listener.label": "监听器 id",
|
"domain.deployment.form.clb_listener.label": "监听器 id(对应监听器应已设置对应域名HTTPS转发, 且原证书对应域名应与待部署证书的一致)",
|
||||||
"domain.deployment.form.clb_listener.placeholder": "请输入监听器id, 如 lbl-xxxxxxxx",
|
"domain.deployment.form.clb_listener.placeholder": "请输入监听器id, 如 lbl-xxxxxxxx",
|
||||||
"domain.deployment.form.clb_domain.label": "部署到域名(支持泛域名)",
|
"domain.deployment.form.clb_domain.label": "部署到域名(支持泛域名)",
|
||||||
"domain.deployment.form.clb_domain.placeholder": "请输入部署到的域名, 如未开启SNI, 可置空忽略此项",
|
"domain.deployment.form.clb_domain.placeholder": "请输入部署到的域名, 如未开启SNI, 可置空忽略此项",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user