本文整理汇总了TypeScript中aws-sdk.ACM.listCertificates方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ACM.listCertificates方法的具体用法?TypeScript ACM.listCertificates怎么用?TypeScript ACM.listCertificates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aws-sdk.ACM
的用法示例。
在下文中一共展示了ACM.listCertificates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _createCertificate
_createCertificate(domain, forceRegion) {
let config = JSON.parse(JSON.stringify(this.resources));
// CloudFront only use certificate in us-east-1 region...
if (forceRegion) {
config.region = forceRegion;
}
this._acm = new (this._getAWS(config)).ACM();
return this._acm
.listCertificates({})
.promise()
.then(res => {
for (let i in res.CertificateSummaryList) {
if (
res.CertificateSummaryList[i].DomainName === domain &&
res.CertificateSummaryList[i] !== "FAILED"
) {
this._certificate = res.CertificateSummaryList[i];
return Promise.resolve(this._certificate);
}
}
if (!this._certificate) {
// Create certificate
let params = {
DomainName: domain,
DomainValidationOptions: [
{
DomainName: domain,
ValidationDomain: domain
}
],
ValidationMethod: "DNS",
IdempotencyToken: "Webda_" + this.md5(domain).substr(0, 26)
};
return this._acm
.requestCertificate(params)
.promise()
.then(res => {
this._certificate = res;
return this._waitFor(
"Waiting for certificate challenge",
(resolve, reject) => {
return this._acm
.describeCertificate({
CertificateArn: this._certificate.CertificateArn
})
.promise()
.then((res: any) => {
if (
res.Certificate.DomainValidationOptions[0]
.ResourceRecord
) {
resolve(res.Certificate);
return Promise.resolve(true);
}
return Promise.resolve(false);
});
},
10000,
5
);
});
}
throw Error("Delay expired for certificate");
})
.then(cert => {
return this._acm
.describeCertificate({
CertificateArn: cert.CertificateArn
})
.promise();
})
.then((res: any) => {
let cert = res.Certificate;
if (cert.Status === "FAILED") {
return Promise.reject("Certificate validation has failed");
}
if (cert.Status === "PENDING_VALIDATION") {
// On create need to wait
let record = cert.DomainValidationOptions[0].ResourceRecord;
console.log("Need to validate certificate", cert.CertificateArn);
return this._createDNSEntry(record.Name, "CNAME", record.Value).then(
() => {
// Waiting for certificate validation
return this._waitFor(
"Waiting for certificate validation",
(resolve, reject) => {
return this._acm
.describeCertificate({
CertificateArn: cert.CertificateArn
})
.promise()
.then(res => {
if (res.Certificate.Status === "ISSUED") {
resolve(res.Certificate);
return Promise.resolve(true);
}
if (res.Certificate.Status !== "PENDING_VALIDATION") {
reject(res.Certificate);
return Promise.resolve(true);
}
//.........这里部分代码省略.........