import { Construct } from 'constructs'; import { GatewayResponseOptions, IntegrationOptions, MethodOptions, RestApi, RestApiProps } from 'aws-cdk-lib/aws-apigateway'; import { IUserPool } from 'aws-cdk-lib/aws-cognito'; import { Mutable } from '../../lib/Mutable'; import { HttpMethod } from '../../lib/HttpMethod'; import { Lambda } from './Lambda'; export interface ApiProps extends Mutable> { /** * The api stage name. This is an alias to the deployOptions.stageName. * * @default "prod" */ stage?: string; /** * The name of the api. If `prefix` and `name` are provided then the * apiName will be `${prefix}-${name}`. If no prefix is provided then * the apiName will be `name` */ name?: string; /** * The prefix to use with resource names. If `prefix` and `name` are * provided then the apiName will be `${prefix}-${name}`. If no name * is provided then the apiName will be `prefix`. For more info, see * [Naming](https://full-stack-pattern.matthewkeil.com/docs/naming) */ prefix?: string; /** * UserPool to create a gateway authorizer. It is not required to be added * when running the constructor. Can also add a cognito authorizer with * the api.attachCognitoAuthorizer() method */ userPool?: IUserPool; /** * Gateway responses to add to the api. By default the following responses are added: * { type: ResponseType.UNAUTHORIZED, statusCode: '401' } * { type: ResponseType.ACCESS_DENIED, statusCode: '403' } * { type: ResponseType.RESOURCE_NOT_FOUND, statusCode: '404' } * { type: ResponseType.DEFAULT_5XX, statusCode: '500' } */ gatewayResponses?: GatewayResponseOptions[]; /** * Uses `convert-lambda-to-express` to provision a dev server to develop the api. * * See [convert-lambda-to-express](https://www.npmjs.com/package/convert-lambda-to-express) * for more information about how to use this feature. * * @default true */ buildDevServer?: boolean; /** * LogicalId for the RestApi resource for in-place upgrades. For more * info, see [Naming](https://full-stack-pattern.matthewkeil.com/docs/naming) */ logicalId?: string; /** * Option to not use fixed logicalId's for the RestApi resource. For more * info, see [Naming](https://full-stack-pattern.matthewkeil.com/docs/naming) */ dontOverrideLogicalId?: boolean; } export declare class Api extends Construct { private props; api: RestApi; private allowedOrigins; private allowedMethods; private allowedHeaders; private authorizer?; private pascalName; private kebabName; private buildDevServer; constructor(scope: Construct, id: string, props?: ApiProps); attachCognitoAuthorizer(userPool: IUserPool): void; addLambda({ method, path, lambda, options }: { method: HttpMethod; path: string; lambda: Lambda; options?: Mutable; }): void; private addGatewayResponses; private addCorsMockIntegration; }