• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript aws-sdk.ACM类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中aws-sdk.ACM的典型用法代码示例。如果您正苦于以下问题:TypeScript ACM类的具体用法?TypeScript ACM怎么用?TypeScript ACM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ACM类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例2:

 .then(cert => {
   return this._acm
     .describeCertificate({
       CertificateArn: cert.CertificateArn
     })
     .promise();
 })
开发者ID:loopingz,项目名称:webda-shell,代码行数:7,代码来源:aws.ts


示例3: Error

 .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");
 })
开发者ID:loopingz,项目名称:webda-shell,代码行数:54,代码来源:aws.ts


示例4: resolve

 (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);
     });
 },
开发者ID:loopingz,项目名称:webda-shell,代码行数:17,代码来源:aws.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript aws-sdk.APIGateway类代码示例发布时间:2022-05-25
下一篇:
TypeScript aws-iot-device-sdk.thingShadow类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap