當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript APIGateway.getDomainNames方法代碼示例

本文整理匯總了TypeScript中aws-sdk.APIGateway.getDomainNames方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript APIGateway.getDomainNames方法的具體用法?TypeScript APIGateway.getDomainNames怎麽用?TypeScript APIGateway.getDomainNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在aws-sdk.APIGateway的用法示例。


在下文中一共展示了APIGateway.getDomainNames方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: generateAPIGatewayCustomDomain

 private async generateAPIGatewayCustomDomain() {
   let domain = this.resources.customDomainName || this.resources.restApi;
   let cert;
   // Check custom certificate
   if (!this.resources.customCertificate) {
     return;
   }
   let endpoint = this.resources.customDomainEndpoint || "EDGE";
   let region;
   if (endpoint === "EDGE") {
     // Enforce region to us-east-1 for certificate
     region = "us-east-1";
   }
   // For EDGE need to be in us-east-1 -> might want to upgrade to both EDGE and REGIONAL
   cert = await this._createCertificate(domain, region);
   let res = await this._awsGateway.getDomainNames().promise();
   let custom;
   // Search for the custom domain
   for (let i in res.items) {
     if (res.items[i].domainName === domain) {
       custom = res.items[i];
     }
   }
   if (!custom) {
     let params: any = {
       domainName: domain,
       endpointConfiguration: {
         types: [endpoint]
       }
     };
     if (endpoint === "EDGE") {
       params.certificateArn = cert.CertificateArn;
     } else {
       params.regionalCertificateArn = cert.CertificateArn;
     }
     // Create one
     console.log("Create API Gateway custom domain", domain);
     custom = await this._awsGateway.createDomainName(params).promise();
     await this._awsGateway
       .createBasePathMapping({
         domainName: domain,
         restApiId: this.restApiId,
         basePath: "",
         stage: this.deployment.uuid
       })
       .promise();
   }
   await this._createDNSEntry(
     domain,
     "CNAME",
     custom.distributionDomainName || custom.regionalDomainName
   );
 }
開發者ID:loopingz,項目名稱:webda-shell,代碼行數:53,代碼來源:lambda.ts


注:本文中的aws-sdk.APIGateway.getDomainNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。