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


TypeScript aws-sdk.APIGateway类代码示例

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


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

示例2: generateAPIGatewayStage

 private async generateAPIGatewayStage() {
   console.log("Generating API Gateway Deployment");
   return this._awsGateway
     .createDeployment({
       restApiId: this.restApiId,
       stageName: this.deployment.uuid
     })
     .promise();
 }
开发者ID:loopingz,项目名称:webda-shell,代码行数:9,代码来源:lambda.ts

示例3: generateAPIGatewayMapping

 private async generateAPIGatewayMapping(swagger) {
   console.log("Creating API Gateway Mapping");
   let api = await this.getRestApi();
   if (!api) {
     api = await this._awsGateway
       .createRestApi({
         name: this._restApiName,
         description: "Webda Auto Deployed"
       })
       .promise();
   }
   await this._awsGateway
     .putRestApi({
       body: swagger,
       failOnWarnings: false,
       restApiId: api.id,
       mode: "overwrite"
     })
     .promise();
 }
开发者ID:loopingz,项目名称:webda-shell,代码行数:20,代码来源:lambda.ts

示例4: getRestApi

 private async getRestApi() {
   return this._awsGateway
     .getRestApis()
     .promise()
     .then(result => {
       var resource = null;
       for (var i in result.items) {
         if (result.items[i].name === this._restApiName) {
           resource = result.items[i];
           this.restApiId = resource.id;
           break;
         }
       }
       return Promise.resolve(resource);
     });
 }
开发者ID:loopingz,项目名称:webda-shell,代码行数:16,代码来源:lambda.ts


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