@aws/pdk
Version:
All documentation is located at: https://aws.github.io/aws-pdk
74 lines (73 loc) • 2.97 kB
TypeScript
import { Size } from "aws-cdk-lib";
import { GatewayResponseOptions, RestApiBaseProps, SpecRestApi } from "aws-cdk-lib/aws-apigateway";
import { IBucket } from "aws-cdk-lib/aws-s3";
import { CfnIPSet, CfnWebACL, CfnWebACLAssociation } from "aws-cdk-lib/aws-wafv2";
import { Construct } from "constructs";
import { TypeSafeApiOptions } from "./spec";
import { TypeSafeApiWebAclOptions } from "./waf/types";
/**
* Configuration for the TypeSafeRestApi construct
*/
export interface TypeSafeRestApiProps extends RestApiBaseProps, TypeSafeApiOptions {
/**
* Path to the JSON open api spec
*/
readonly specPath: string;
/**
* Options for the AWS WAF v2 WebACL associated with the api. By default, a Web ACL with the AWS default managed
* rule set will be associated with the API. These options may disable or override the defaults.
*/
readonly webAclOptions?: TypeSafeApiWebAclOptions;
/**
* A Size(in bytes, kibibytes, mebibytes etc) that is used to enable compression (with non-negative
* between 0 and 10485760 (10M) bytes, inclusive) or disable compression
* (when undefined) on an API. When compression is enabled, compression or
* decompression is not applied on the payload if the payload size is
* smaller than this value. Setting it to zero allows compression for any
* payload size.
*
* @default - Compression is disabled.
*/
readonly minCompressionSize?: Size;
/**
* By default, the spec is prepared and outputted into the CDK assets bucket. If this is undesired,
* use this option to specify the output bucket.
*/
readonly outputSpecBucket?: IBucket;
/**
* Optional gateway responses for the API.
*
* Note that Type Safe API automatically configures request validation for you, and defines a
* default BAD_REQUEST_BODY gateway response which returns the validation error message. You can
* use this property to override this gateway response if desired.
*
* @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-gatewayResponse-definition.html
*/
readonly gatewayResponses?: GatewayResponseOptions[];
}
/**
* A construct for creating an api gateway rest api based on the definition in the OpenAPI spec.
*/
export declare class TypeSafeRestApi extends Construct {
/**
* Underlying API Gateway API construct
*/
readonly api: SpecRestApi;
/**
* The OpenAPI specification with applied API gateway extensions
*/
readonly extendedApiSpecification: any;
/**
* Reference to the webacl, if created
*/
readonly webAcl?: CfnWebACL;
/**
* Reference to the IP set if created
*/
readonly ipSet?: CfnIPSet;
/**
* Reference to the web acl association if created
*/
readonly webAclAssociation?: CfnWebACLAssociation;
constructor(scope: Construct, id: string, props: TypeSafeRestApiProps);
}