@wheatstalk/aws-cdk-exec
Version:
An AWS CDK Cloud Assembly-aware command to help find and execute lambda functions and state machines
96 lines (95 loc) • 2.47 kB
TypeScript
import * as AWS from 'aws-sdk';
import { IAwsSdk } from './aws-sdk';
import { FindMatchingResourceOptionsCommon } from './find-matching-resources';
/**
* Options for `StateMachineExecutor`
*/
export interface ExecutorOptions {
/**
* The construct path of the matching resource.
*/
readonly constructPath: string;
/**
* The logical id of the matching resource.
*/
readonly logicalResourceId: string;
/**
* The physical resource of the resource to execute.
*/
readonly physicalResourceId: string;
}
/**
* Executor base class.
*/
export declare abstract class Executor {
/**
* Find an executor
*/
static find(options: FindExecutorOptions): Promise<Executor[]>;
readonly constructPath: string;
readonly physicalResourceId: string;
readonly logicalResourceId: string;
protected constructor(options: ExecutorOptions);
/**
* Execute the resource
*
* @param input Input for execution.
*/
abstract execute(input?: string): Promise<ExecuteResult>;
env(): Promise<Record<string, string>>;
protected validateJsonObjectInput(input: string | undefined): void;
}
/**
* Options for finding executors.
*/
export interface FindExecutorOptions extends FindMatchingResourceOptionsCommon {
/**
* AWS SDK
*/
readonly sdk: IAwsSdk;
}
/**
* Options for `StateMachineExecutor`
*/
export interface StateMachineExecutorOptions extends ExecutorOptions {
/**
* The Step Functions SDK
*/
readonly stepFunctions: AWS.StepFunctions;
}
/**
* Executes a Step Functions State Machine
*/
export declare class StateMachineExecutor extends Executor {
private readonly stepFunctions;
constructor(options: StateMachineExecutorOptions);
execute(input?: string): Promise<ExecuteResult>;
}
/**
* The executor's result.
*/
export interface ExecuteResult {
/**
* The execution's output.
*/
readonly output?: any;
/**
* Error message
*/
readonly error?: string;
}
export interface LambdaFunctionExecutorOptions extends ExecutorOptions {
/**
* The Lambda SDK
*/
readonly lambda: AWS.Lambda;
}
/**
* Executes a lambda function
*/
export declare class LambdaFunctionExecutor extends Executor {
private readonly lambda;
constructor(options: LambdaFunctionExecutorOptions);
execute(input?: string): Promise<ExecuteResult>;
env(): Promise<Record<string, string>>;
}