@scloud/cdk-patterns
Version:
Serverless CDK patterns for common infrastructure needs
41 lines (40 loc) • 1.81 kB
TypeScript
import * as route53 from 'aws-cdk-lib/aws-route53';
import { Construct } from 'constructs';
import { Function } from 'aws-cdk-lib/aws-lambda';
import { IRepository } from 'aws-cdk-lib/aws-ecr';
import { LambdaRestApi } from 'aws-cdk-lib/aws-apigateway';
/**
* An API gateway backed by a Lambda function.
* @param construct Parent CDK construct (typically 'this')
* @param initialPass If the infrastructure is being built from scratch: true;
* for incremental deployments: false
* @param name The name for this gateway and associated resources
* @param zone DNS zone to use for this API
* @param environment Environment variables for the backing Lambda function
* @param apiDomainName Domain name to use for this API. Defaults to `api.${zone.zoneName}`
* @returns
*/
export declare function apiGateway(construct: Construct, name: string, zone: route53.IHostedZone, environment?: {
[key: string]: string;
}, apiDomainName?: string, memory?: number): {
lambda: Function;
api: LambdaRestApi;
};
/**
* An API gateway backed by a Lambda function.
* @param construct Parent CDK construct (typically 'this')
* @param initialPass If the infrastructure is being built from scratch: true;
* for incremental deployments: false
* @param name The name for this gateway and associated resources
* @param zone DNS zone to use for this API
* @param environment Environment variables for the backing Lambda function
* @param domainName Domain name to use for this API. Defaults to `api.${zone.zoneName}`
* @returns
*/
export declare function apiGatewayContainer(construct: Construct, initialPass: boolean, name: string, zone: route53.IHostedZone, environment?: {
[key: string]: string;
}, apiDomainName?: string): {
lambda: Function;
api: LambdaRestApi;
repository: IRepository;
};