constructor()

in src/git-action-demo-api-stack/cdk-stack.ts [23:95]


  constructor(scope: core.App, id: string, props?: core.StackProps) {
    super(scope, id, props);

    /*********************************** Stack Resources ************************************/
    // Lambda definition
    const gitActionDemoLambda = new lambda.Function(
      this,
      'GitActionDemoLambda',
      {
        code: new lambda.AssetCode('dist/src/git-action-demo-api-stack/lambda/git-action-demo-lambda/package.zip'),
        handler: 'index.handler',
        runtime: lambda.Runtime.NODEJS_12_X,
        description: 'Lambda to demo git action deployment',
        functionName: 'git-action-demo-lambda',
        memorySize: 128,
        reservedConcurrentExecutions: 1,
        timeout: core.Duration.seconds(5)
      }
    );

    // API Gateway definition
    const gitActionDemoApi = new apigw.RestApi(
      this,
      'GitActionDemoApi',
      {
        description: 'API to demo git action deployment',
        endpointTypes: [
          apigw.EndpointType.REGIONAL
        ],
        restApiName: 'git-action-demo-api',
        defaultCorsPreflightOptions: {
          allowOrigins: apigw.Cors.ALL_ORIGINS,
          allowMethods: apigw.Cors.ALL_METHODS
        }
      });
    const demoResource = gitActionDemoApi.root.addResource('demo');
    const demoLambdaIntegration = new apigw.LambdaIntegration(gitActionDemoLambda)
    demoResource.addMethod('GET', demoLambdaIntegration);
    
    /****************************************************************************************/

    /*********************************** List of Outputs ************************************/
    new core.CfnOutput(
      this,
      'DocUploadRestApiId',
      {
        description: 'API id for git action demo API',
        exportName: 'GIT-ACTION-DEMO-API-ID',
        value: gitActionDemoApi.restApiId
      }
    )

    new core.CfnOutput(
      this,
      'DocUploadRestApiRootUrl',
      {
        description: 'Root url of git action demo API',
        exportName: 'GIT-ACTION-DEMO-API-ROOT-URL',
        value: gitActionDemoApi.url
      }
    )

    new core.CfnOutput(
      this,
      'DocUploadRestApiResourceUrl',
      {
        description: 'Resource url of git action demo API',
        exportName: 'GIT-ACTION-DEMO-API-RESOURCE-URL',
        value: demoResource.url
      }
    )
    /****************************************************************************************/
  }