mirror of https://github.com/certd/certd
fix: 修复部署到华为cdn,子账号ak查询不到域名的bug
parent
818998259d
commit
ebb292a2f7
|
@ -31,6 +31,14 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||||
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
|
@TaskInput(createCertDomainGetterInputDefine({ props: { required: false } }))
|
||||||
certDomains!: string[];
|
certDomains!: string[];
|
||||||
|
|
||||||
|
@TaskInput({
|
||||||
|
title: '企业项目ID',
|
||||||
|
helper: '华为云子账号必填,"all"表示查询所有项目',
|
||||||
|
required: false,
|
||||||
|
value:"all"
|
||||||
|
})
|
||||||
|
enterpriseProjectId!: string;
|
||||||
|
|
||||||
@TaskInput({
|
@TaskInput({
|
||||||
title: 'Access授权',
|
title: 'Access授权',
|
||||||
helper: '华为云授权AccessKeyId、AccessKeySecret',
|
helper: '华为云授权AccessKeyId、AccessKeySecret',
|
||||||
|
@ -52,6 +60,8 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||||
)
|
)
|
||||||
domains!: string[];
|
domains!: string[];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async execute(): Promise<void> {
|
async execute(): Promise<void> {
|
||||||
if (!this.cert) {
|
if (!this.cert) {
|
||||||
throw new Error('域名证书不能为空');
|
throw new Error('域名证书不能为空');
|
||||||
|
@ -84,6 +94,9 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||||
this.logger.info('部署到域名:', domain);
|
this.logger.info('部署到域名:', domain);
|
||||||
|
|
||||||
const queryReq = new cdn.ShowDomainDetailByNameRequest(domain);
|
const queryReq = new cdn.ShowDomainDetailByNameRequest(domain);
|
||||||
|
if(this.enterpriseProjectId){
|
||||||
|
queryReq.withEnterpriseProjectId(this.enterpriseProjectId)
|
||||||
|
}
|
||||||
const domainDetail = await client.showDomainDetailByName(queryReq);
|
const domainDetail = await client.showDomainDetailByName(queryReq);
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const status = domainDetail.domain.domainStatus || domainDetail.domain.domain_status
|
const status = domainDetail.domain.domainStatus || domainDetail.domain.domain_status
|
||||||
|
@ -94,6 +107,9 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
const req = new cdn.UpdateDomainFullConfigRequest().withDomainName(domain).withBody(body);
|
const req = new cdn.UpdateDomainFullConfigRequest().withDomainName(domain).withBody(body);
|
||||||
|
if(this.enterpriseProjectId){
|
||||||
|
req.withEnterpriseProjectId(this.enterpriseProjectId)
|
||||||
|
}
|
||||||
await client.updateDomainFullConfig(req);
|
await client.updateDomainFullConfig(req);
|
||||||
this.logger.info(`部署到域名${domain}完成:`);
|
this.logger.info(`部署到域名${domain}完成:`);
|
||||||
}catch (e) {
|
}catch (e) {
|
||||||
|
@ -129,6 +145,7 @@ export class HauweiDeployCertToCDN extends AbstractTaskPlugin {
|
||||||
const request = new cdn.ListDomainsRequest();
|
const request = new cdn.ListDomainsRequest();
|
||||||
request.pageNumber = 1;
|
request.pageNumber = 1;
|
||||||
request.pageSize = 1000;
|
request.pageSize = 1000;
|
||||||
|
request.enterpriseProjectId = this.enterpriseProjectId || undefined;
|
||||||
const result: any = await client.listDomains(request);
|
const result: any = await client.listDomains(request);
|
||||||
if (!result || !result.domains || result.domains.length === 0) {
|
if (!result || !result.domains || result.domains.length === 0) {
|
||||||
throw new Error('未找到CDN域名,您可以手动输入');
|
throw new Error('未找到CDN域名,您可以手动输入');
|
||||||
|
|
Loading…
Reference in New Issue