Skip to content

Latest commit

 

History

History
353 lines (214 loc) · 10.9 KB

API.md

File metadata and controls

353 lines (214 loc) · 10.9 KB

API Reference

Constructs

LambdaCorsProxy

A Lambda proxy that can be used to proxy requests to hit a sigV4-required target endpoint.

Initializers

import { LambdaCorsProxy } from 'cdk-cors-proxy'

new LambdaCorsProxy(scope: Construct, id: string, props: LambdaCorsProxyProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props LambdaCorsProxyProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { LambdaCorsProxy } from 'cdk-cors-proxy'

LambdaCorsProxy.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
functionUrl aws-cdk-lib.aws_lambda.IFunctionUrl No description.
lambdaFunction aws-cdk-lib.aws_lambda.IFunction No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


functionUrlRequired
public readonly functionUrl: IFunctionUrl;
  • Type: aws-cdk-lib.aws_lambda.IFunctionUrl

lambdaFunctionRequired
public readonly lambdaFunction: IFunction;
  • Type: aws-cdk-lib.aws_lambda.IFunction

Structs

LambdaCorsProxyProps

Initializer

import { LambdaCorsProxyProps } from 'cdk-cors-proxy'

const lambdaCorsProxyProps: LambdaCorsProxyProps = { ... }

Properties

Name Type Description
targetEndpoint ProxyOptions No description.
lambdaFunctionUrlOptions aws-cdk-lib.aws_lambda.FunctionUrlOptions No description.
lambdaLogLevel string No description.
lambdaOptions aws-cdk-lib.aws_lambda.FunctionOptions No description.
sigV4Options SigV4Options No description.

targetEndpointRequired
public readonly targetEndpoint: ProxyOptions;

lambdaFunctionUrlOptionsOptional
public readonly lambdaFunctionUrlOptions: FunctionUrlOptions;
  • Type: aws-cdk-lib.aws_lambda.FunctionUrlOptions

lambdaLogLevelOptional
public readonly lambdaLogLevel: string;
  • Type: string
  • Default: 'info'

lambdaOptionsOptional
public readonly lambdaOptions: FunctionOptions;
  • Type: aws-cdk-lib.aws_lambda.FunctionOptions

sigV4OptionsOptional
public readonly sigV4Options: SigV4Options;

ProxyOptions

Initializer

import { ProxyOptions } from 'cdk-cors-proxy'

const proxyOptions: ProxyOptions = { ... }

Properties

Name Type Description
url string No description.
allowSelfSignedCerts boolean No description.
forceDecodeBody boolean For 'content-type' of 'application/json' or 'text/*', body will not be base64 encoded.
needToStripHeaderKeys string[] No description.

urlRequired
public readonly url: string;
  • Type: string

allowSelfSignedCertsOptional
public readonly allowSelfSignedCerts: boolean;
  • Type: boolean
  • Default: false

forceDecodeBodyOptional
public readonly forceDecodeBody: boolean;
  • Type: boolean
  • Default: false

For 'content-type' of 'application/json' or 'text/*', body will not be base64 encoded.

For other content types, please enable this option as needed.

"Don’t forget to set the request’s Content-type to application/json or text/* in your tests, otherwise, the body will be base64-encoded by default, and you’ll need to decode it in the Lambda handler." ref: https://aws.amazon.com/blogs/aws/announcing-aws-lambda-function-urls-built-in-https-endpoints-for-single-function-microservices/


needToStripHeaderKeysOptional
public readonly needToStripHeaderKeys: string[];
  • Type: string[]
  • Default: LambdaCorsProxy.DEFAULT_HEADERS_TO_STRIP

SigV4Options

Initializer

import { SigV4Options } from 'cdk-cors-proxy'

const sigV4Options: SigV4Options = { ... }

Properties

Name Type Description
region string The targeting region.
service string The requesting service name.

regionOptional
public readonly region: string;

The targeting region.


serviceOptional
public readonly service: string;
  • Type: string
  • Default: 'execute-api' for API Gateway

The requesting service name.


Classes

Hello

Initializers

import { Hello } from 'cdk-cors-proxy'

new Hello()
Name Type Description

Methods

Name Description
sayHello No description.

sayHello
public sayHello(): string