Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ResourceGeneratorConstruct

Given a list of application resources with metadata attached, generate appropriate CDK resources.

This construct ingests a list of API classes and their methods and generates API routes and lambda function handlers.

Hierarchy

  • Construct
    • ResourceGeneratorConstruct

Index

Constructors

constructor

Properties

Optional databaseCluster

databaseCluster: SlsPgDb

Private funcCounter

funcCounter: number = 1

Optional functionOptions

functionOptions: FunctionOptions

Default options for Lambda functions. Can be overridden.

Optional functionPrefix

functionPrefix: string

generatedLambdas

generatedLambdas: JetKitLambdaFunction[]

Lambda functions that were generated.

Optional httpApi

httpApi: HttpApi

Private layerCounter

layerCounter: number = 1

Readonly node

node: ConstructNode

The construct tree node associated with this construct.

stability

stable

Private ruleCounter

ruleCounter: number = 1

Private seenFunctionNames

seenFunctionNames: Record<string, number>

Private viewCounter

viewCounter: number = 1

Methods

Protected configureAutoScaling

Protected configureVpc

  • Put function in VPC. Defaults to database VPC if database access is specified.

    N.B. NAT Gateways must exist in the VPC if a function needs internet access.

    Parameters

    Returns FunctionOptions

Protected createLambdaFunction

generateConstructsForClass

  • Create a single handler function for the class and any additional routed methods inside it.

    Parameters

    Returns undefined | JetKitLambdaFunction

generateConstructsForFunction

  • Create function handler for a simple routed function.

    Parameters

    • resource: PossibleLambdaHandlers

    Returns undefined | JetKitLambdaFunction

generateConstructsForResource

  • Parameters

    Returns void

Protected generateFunctionName

  • generateFunctionName(name: string, functionOptions: FunctionOptions): undefined | string
  • Parameters

    Returns undefined | string

getFunction

Protected grantFunctionAccess

  • Grant function access to what is configured.

    Parameters

    Returns void

mergeFunctionDefaults

Protected onPrepare

  • onPrepare(): void
  • Perform final modifications before synthesis.

    This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared.

    This is an advanced framework feature. Only use this if you understand the implications.

    stability

    stable

    Returns void

Protected onSynthesize

  • onSynthesize(session: ISynthesisSession): void
  • Allows this construct to emit artifacts into the cloud assembly during synthesis.

    This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

    stability

    stable

    Parameters

    • session: ISynthesisSession

      The synthesis session.

    Returns void

Protected onValidate

  • onValidate(): string[]
  • Validate the current construct.

    This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.

    stability

    stable

    Returns string[]

    An array of validation error messages, or an empty array if the construct is valid.

Protected prepare

  • prepare(): void
  • Perform final modifications before synthesis.

    This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared.

    This is an advanced framework feature. Only use this if you understand the implications.

    stability

    stable

    Returns void

Protected resolveLayerReferences

  • Converts Layer ARNs to LayerVersions Just for convenience

    Parameters

    Returns FunctionOptions

Protected synthesize

  • synthesize(session: ISynthesisSession): void
  • Allows this construct to emit artifacts into the cloud assembly during synthesis.

    This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

    stability

    stable

    Parameters

    • session: ISynthesisSession

      The synthesis session.

    Returns void

toString

  • toString(): string
  • Returns a string representation of this construct.

    stability

    stable

    Returns string

Protected validate

  • validate(): string[]
  • Validate the current construct.

    This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.

    stability

    stable

    Returns string[]

    An array of validation error messages, or an empty array if the construct is valid.

Static isConstruct

  • isConstruct(x: any): x is Construct
  • Return whether the given object is a Construct.

    stability

    stable

    Parameters

    • x: any

    Returns x is Construct

Generated using TypeDoc