UNPKG

@seasketch/geoprocessing

Version:

Geoprocessing and reporting framework for SeaSketch 2.0

63 lines (62 loc) 2.62 kB
import { NestedStack, NestedStackProps } from "aws-cdk-lib"; import { Construct } from "constructs"; import { Manifest, ProcessingFunctionMetadata } from "../manifest.js"; import { ProcessingFunctions } from "./types.js"; import { Function } from "aws-cdk-lib/aws-lambda"; export interface GeoprocessingNestedStackProps extends NestedStackProps { /** Name of the geoprocessing project */ projectName: string; /** Path to top-level of geoprocessing project */ projectPath: string; /** Manifest used to figure out what resources should be created for this stack */ manifest: Manifest; /** maximum number of functions to allow per LambdaStack */ functionsPerStack?: number; /** State of function stacks if already deployed (by function title). */ existingFunctionStacks?: string[][]; /** State of worker stacks if already deployed (by function title) */ existingWorkerStacks?: string[][]; } /** * Nested stack for Lambda functions. Can contain sync or async functions * Create multiple instances to handle both */ export declare class LambdaStack extends NestedStack { props: GeoprocessingNestedStackProps; /** * Once stack created, this array will contain all processing functions */ private processingFunctions; /** * Once stack created, this array will contain all sync function ARNs */ private syncLambdaArns; /** * Once stack created, this array will contain all async run lambda functions */ private asyncRunLambdas; constructor(scope: Construct, id: string, props: GeoprocessingNestedStackProps); getProcessingFunctions(): ProcessingFunctions; getAsyncRunLambdas(): Function[]; getSyncLambdaArns(): string[]; /** * Create Lambda function constructs */ createProcessingFunctions: () => void; /** Create Lambda function constructs for sync functions that return result immediately */ private createSyncFunctions; /** Create Lambda function constructs for functions that return result async */ private createAsyncFunctions; /** * Given run lambda functions across all lambda stacks, creates policies allowing them to invoke sync lambdas within this lambda stack */ createLambdaSyncPolicies(runLambdas: Function[]): void; } /** * Returns root lambda handler method pointer in module.function dot notation */ export declare function getHandlerPointer(funcMeta: ProcessingFunctionMetadata): string; /** * Returns build package name to look for handler */ export declare function getHandlerPkgName(funcMeta: ProcessingFunctionMetadata): string;