当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ACM.listCertificates方法代码示例

本文整理汇总了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);
                     }
//.........这里部分代码省略.........
开发者ID:loopingz,项目名称:webda-shell,代码行数:101,代码来源:aws.ts


注:本文中的aws-sdk.ACM.listCertificates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。