import * as cdk from "@aws-cdk/core"; import * as acm from "@aws-cdk/aws-certificatemanager"; import * as apig from "@aws-cdk/aws-apigatewayv2"; import * as apigAuthorizers from "@aws-cdk/aws-apigatewayv2-authorizers"; import * as elb from "@aws-cdk/aws-elasticloadbalancingv2"; import * as logs from "@aws-cdk/aws-logs"; import { Function as Fn, FunctionProps, FunctionDefinition } from "./Function"; import { Permissions } from "./util/permission"; import * as apigV2Domain from "./util/apiGatewayV2Domain"; export declare enum ApiAuthorizationType { JWT = "JWT", NONE = "NONE", CUSTOM = "CUSTOM", AWS_IAM = "AWS_IAM" } export declare enum ApiPayloadFormatVersion { V1 = "1.0", V2 = "2.0" } export interface ApiProps { readonly httpApi?: apig.IHttpApi | apig.HttpApiProps; readonly routes?: { [key: string]: FunctionDefinition | ApiFunctionRouteProps | ApiAlbRouteProps; }; readonly cors?: boolean | apig.CorsPreflightOptions; readonly accessLog?: boolean | string | apig.CfnStage.AccessLogSettingsProperty; readonly customDomain?: string | ApiCustomDomainProps; readonly defaultFunctionProps?: FunctionProps; readonly defaultAuthorizationType?: ApiAuthorizationType; readonly defaultAuthorizer?: apigAuthorizers.HttpJwtAuthorizer | apigAuthorizers.HttpLambdaAuthorizer | apigAuthorizers.HttpUserPoolAuthorizer; readonly defaultAuthorizationScopes?: string[]; readonly defaultPayloadFormatVersion?: ApiPayloadFormatVersion; } export interface ApiFunctionRouteProps { readonly authorizationType?: ApiAuthorizationType; readonly authorizer?: apigAuthorizers.HttpJwtAuthorizer | apigAuthorizers.HttpLambdaAuthorizer | apigAuthorizers.HttpUserPoolAuthorizer; readonly authorizationScopes?: string[]; readonly payloadFormatVersion?: ApiPayloadFormatVersion; readonly function: FunctionDefinition; } export interface ApiAlbRouteProps { readonly authorizationType?: ApiAuthorizationType; readonly authorizer?: apigAuthorizers.HttpJwtAuthorizer | apigAuthorizers.HttpLambdaAuthorizer | apigAuthorizers.HttpUserPoolAuthorizer; readonly authorizationScopes?: string[]; readonly albListener: elb.IApplicationListener; readonly method?: apig.HttpMethod; readonly vpcLink?: apig.IVpcLink; } export declare type ApiCustomDomainProps = apigV2Domain.CustomDomainProps; export declare class Api extends cdk.Construct { readonly httpApi: apig.HttpApi; readonly accessLogGroup?: logs.LogGroup; readonly apiGatewayDomain?: apig.DomainName; readonly acmCertificate?: acm.Certificate; private readonly _customDomainUrl?; private readonly routesData; private readonly permissionsAttachedForAllRoutes; private readonly defaultFunctionProps?; private readonly defaultAuthorizer?; private readonly defaultAuthorizationType?; private readonly defaultAuthorizationScopes?; private readonly defaultPayloadFormatVersion?; constructor(scope: cdk.Construct, id: string, props?: ApiProps); get url(): string; get customDomainUrl(): string | undefined; get routes(): string[]; addRoutes(scope: cdk.Construct, routes: { [key: string]: FunctionDefinition | ApiFunctionRouteProps | ApiAlbRouteProps; }): void; getFunction(routeKey: string): Fn | undefined; attachPermissions(permissions: Permissions): void; attachPermissionsToRoute(routeKey: string, permissions: Permissions): void; private buildCorsConfig; private addRoute; private createAlbIntegration; private createFunctionIntegration; private buildRouteAuth; private normalizeRouteKey; }