Skip to content

Latest commit

 

History

History
317 lines (190 loc) · 11.7 KB

API.md

File metadata and controls

317 lines (190 loc) · 11.7 KB

API Reference

Constructs

MicroApi

A CDK construct that creates an API Gateway and Lambda function that can be used to expose a Micro API project for RenovoLive.

Initializers

import { MicroApi } from '@renovosolutions/cdk-library-renovo-microapi'

new MicroApi(scope: Construct, id: string, props: MicroApiProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props MicroApiProps 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 { MicroApi } from '@renovosolutions/cdk-library-renovo-microapi'

MicroApi.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.

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

The tree node.


Structs

MicroApiProps

Initializer

import { MicroApiProps } from '@renovosolutions/cdk-library-renovo-microapi'

const microApiProps: MicroApiProps = { ... }

Properties

Name Type Description
allowedOrigins string[] The allowed origins for CORS policy on the API Gateway.
apiName string The name of the project this Micro API is for.
code aws-cdk-lib.aws_lambda.Code The lambda code to use for this Micro API.
handler string The name of the method within your code that Lambda calls to execute your function.
vpc aws-cdk-lib.aws_ec2.IVpc The vpc where the Lambda function will run.
vpcEndpoint aws-cdk-lib.aws_ec2.IInterfaceVpcEndpoint The vpc endpoint to associate the API with.
authorizationType aws-cdk-lib.aws_apigateway.AuthorizationType The type of authorization to use for the API.
environment {[ key: string ]: string} The environment variables the Lambda function will use.
ephemeralStorageSize aws-cdk-lib.Size The size of the functions /tmp directory in MB.
memorySize number The amount of memory, in MB, that is allocated to your Lambda function.
runtime aws-cdk-lib.aws_lambda.Runtime The runtime to use for this Micro API.
stageName string The stage name to use for the deployment.
timeout aws-cdk-lib.Duration The lambda function timeout.

allowedOriginsRequired
public readonly allowedOrigins: string[];
  • Type: string[]

The allowed origins for CORS policy on the API Gateway.


apiNameRequired
public readonly apiName: string;
  • Type: string

The name of the project this Micro API is for.


codeRequired
public readonly code: Code;
  • Type: aws-cdk-lib.aws_lambda.Code

The lambda code to use for this Micro API.


handlerRequired
public readonly handler: string;
  • Type: string

The name of the method within your code that Lambda calls to execute your function.

The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information:

[https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-features.html#gettingstarted-features-programmingmodel

Use Handler.FROM_IMAGE when defining a function from a Docker image.

NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-features.html#gettingstarted-features-programmingmodel

Use Handler.FROM_IMAGE when defining a function from a Docker image.

NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.)


vpcRequired
public readonly vpc: IVpc;
  • Type: aws-cdk-lib.aws_ec2.IVpc

The vpc where the Lambda function will run.


vpcEndpointRequired
public readonly vpcEndpoint: IInterfaceVpcEndpoint;
  • Type: aws-cdk-lib.aws_ec2.IInterfaceVpcEndpoint

The vpc endpoint to associate the API with.


authorizationTypeOptional
public readonly authorizationType: AuthorizationType;
  • Type: aws-cdk-lib.aws_apigateway.AuthorizationType
  • Default: apigateway.AuthorizationType.IAM

The type of authorization to use for the API.


environmentOptional
public readonly environment: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

The environment variables the Lambda function will use.


ephemeralStorageSizeOptional
public readonly ephemeralStorageSize: Size;
  • Type: aws-cdk-lib.Size
  • Default: Size.mebibytes(512)

The size of the functions /tmp directory in MB.


memorySizeOptional
public readonly memorySize: number;
  • Type: number
  • Default: 128

The amount of memory, in MB, that is allocated to your Lambda function.

Lambda uses this value to proportionally allocate the amount of CPU power.

https://docs.aws.amazon.com/lambda/latest/dg/configuration-function-common.html#configuration-memory-console


runtimeOptional
public readonly runtime: Runtime;
  • Type: aws-cdk-lib.aws_lambda.Runtime
  • Default: lambda.Runtime.DOTNET_6

The runtime to use for this Micro API.


stageNameOptional
public readonly stageName: string;
  • Type: string
  • Default: 'dev'

The stage name to use for the deployment.


timeoutOptional
public readonly timeout: Duration;
  • Type: aws-cdk-lib.Duration
  • Default: Duration.seconds(30)

The lambda function timeout.