UNPKG

@softchef/cdk-restapi

Version:
38 lines (37 loc) 1.27 kB
import { AuthorizationType, IAuthorizer, RestApi as AwsRestApi, RestApiProps as AwsRestApiProps } from 'aws-cdk-lib/aws-apigateway'; import { Construct } from 'constructs'; import { RestApiResourceProps } from './resource'; export interface RestApiProps extends AwsRestApiProps { /** * Custom RestApi */ readonly restApi?: AwsRestApi; /** * Define Rest API resources */ readonly resources: RestApiResourceProps[]; /** * Enable cors, default is true */ readonly enableCors?: boolean; /** * Specify globally AuthorizationType by aws-apigateway.AuthorizationType, default is NONE */ readonly authorizationType?: AuthorizationType; /** * Specify globally Authorizer by aws-Authorizer, default is null */ readonly authorizer?: IAuthorizer | undefined; } export declare class RestApi extends Construct { private globalAuthorizationType?; private globalAuthorizer?; private awsRestApi; private resources; constructor(scope: Construct, id: string, props: RestApiProps); get restApi(): AwsRestApi; get restApiId(): string; get url(): string; addResources(resources: RestApiResourceProps[]): this; addResource(resource: RestApiResourceProps): this; }