UNPKG

@scloud/cdk-patterns

Version:

Serverless CDK patterns for common infrastructure needs

30 lines (29 loc) 1.58 kB
import { Construct } from 'constructs'; import { Function } from 'aws-cdk-lib/aws-lambda'; import { LambdaRestApi } from 'aws-cdk-lib/aws-apigateway'; import { IHostedZone } from 'aws-cdk-lib/aws-route53'; import { ApiGateway } from 'aws-cdk-lib/aws-route53-targets'; import { ZipFunctionProps } from './ZipFunction'; import { ContainerFunctionProps } from './ContainerFunction'; /** * @param lambda The Lambda function to be triggered by the bucket. This will be generated for you if you use one of the static methods (node, python, container) * @param zone Optional: a DNS zone for this API. By default the domain name is set to 'api.<zoneName>' * @param domain Optional: If you want to specify a domain name that differs from the default 'api.<zoneName>' (e.g. 'subdomain.example.com') you can do so here */ export interface ApiFunctionProps { lambda: Function; zone?: IHostedZone; domain?: string; } /** * An API gateway backed by a Lambda function. */ export declare class ApiFunction extends Construct { lambda: Function; api: LambdaRestApi; apiGateway: ApiGateway; constructor(scope: Construct, id: string, props: ApiFunctionProps); static node(scope: Construct, id: string, functionProps?: ZipFunctionProps, zone?: IHostedZone, domain?: string): ApiFunction; static python(scope: Construct, id: string, functionProps?: ZipFunctionProps, zone?: IHostedZone, domain?: string): ApiFunction; static container(scope: Construct, id: string, functionProps?: ContainerFunctionProps, zone?: IHostedZone, domain?: string): ApiFunction; }