cdk-openapi-to-http-api
Version:
CDK Construct that lets you build AWS Api Gateway Http Api, backed by Lambdas, based on a OpenAPI spec file.
53 lines (52 loc) • 2.23 kB
TypeScript
import { aws_apigatewayv2 as apigwv2, aws_lambda as lambda } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { CorsOptions, Integration, IResource, IRestApi, MethodOptions, ResourceBase } from 'aws-cdk-lib/aws-apigateway';
import { CfnRoute } from 'aws-cdk-lib/aws-apigatewayv2';
import { CfnWebACLAssociation } from 'aws-cdk-lib/aws-wafv2';
import { HttpApiProps, MethodMapping } from './types';
export declare class HttpOpenApi extends Construct {
/**
* Api Resource being created based on openAPI definition
*/
readonly cfnApi: apigwv2.CfnApi;
/**
* Default stage being created & deployed for the API
*/
readonly apiStage: apigwv2.CfnStage;
/**
* Maps operationId to lambda Function that is being created
*/
readonly functions: Record<string, lambda.Function>;
readonly permissions: Record<string, lambda.CfnPermission>;
readonly routes: CfnRoute[];
/**
* Maps operationId to http path and method - for routing purposes
*/
readonly methodMappings: Record<string, MethodMapping>;
readonly association?: CfnWebACLAssociation;
constructor(scope: Construct, id: string, props: HttpApiProps);
/**
* Enable custom domain for this API
* @param customDomainName - customDomainName to be created in Api Gateway
* @param certificateArn Arn of the certificate needed for the creation of custom domain. It must be a regional certificate.
*/
enableCustomDomain(customDomainName: string, certificateArn: string, zoneName: string): void;
/**
* Extracts path and method that map to the operationId needed
* So finding the right place on the spec is just a matter of accessing the right attribute
* @param spec
* @returns methods
*/
private buildMethodMappings;
private toAuthorizerSpec;
}
export declare class RootResource extends ResourceBase {
parentResource?: IResource | undefined;
api: IRestApi;
resourceId: string;
path: string;
defaultIntegration?: Integration | undefined;
defaultMethodOptions?: MethodOptions | undefined;
defaultCorsPreflightOptions?: CorsOptions | undefined;
constructor(api: IRestApi, resourceId: string);
}