serverless-spy
Version:
CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.
73 lines (72 loc) • 2.43 kB
TypeScript
import { Construct, IConstruct } from 'constructs';
export interface ServerlessSpyProps {
readonly generateSpyEventsFileLocation?: string;
readonly spySqsWithNoSubscriptionAndDropAllMessages?: boolean;
readonly debugMode?: boolean;
}
export interface SpyFilter {
readonly spyLambda?: boolean;
readonly spySqs?: boolean;
readonly spySnsTopic?: boolean;
readonly spySnsSubsription?: boolean;
readonly spyEventBridge?: boolean;
readonly spyEventBridgeRule?: boolean;
readonly spyS3?: boolean;
readonly spyDynamoDB?: boolean;
}
export declare class ServerlessSpy extends Construct {
private props?;
private createdResourcesBySSpy;
private lambdaSubscriptionPool;
private lambdaSubscriptionMain;
private lambdasSpied;
serviceKeys: string[];
private spiedNodes;
private layerMap;
private readonly iotEndpoint;
constructor(scope: Construct, id: string, props?: ServerlessSpyProps | undefined);
private getDefaultLambdaEnvironmentVariables;
/**
* Initalize spying on resources given as parameter.
* @param nodes Which reources and their children to spy on.
*/
spyNodes(nodes: IConstruct[]): void;
/**
* Initalize spying on resources.
* @param filter Limit which resources to spy on.
*/
spy(filter?: SpyFilter): void;
private internalSpyNodes;
private finalizeSpy;
private getExtensionAssetLocation;
private getLanguageExtensionAssetLocation;
/**
* Write SpyEvents class, which helps with writing the code for tests.
* @param fileLocation
*/
private writeSpyEventsClass;
private getAllNodes;
private getAllNodesRecursive;
private internalSpyNode;
private getExtensionForRuntime;
private internalSpySpySqsWithNoSubscription;
private internalSpySqs;
private createFunctionForSubscription;
private internalSpyS3;
private internalSpyDynamodb;
private internalSpyEventBusRule;
private internalSpyEventBus;
private internalSpySnsTopic;
private internalSpySnsSubscription;
private provideFunctionForSubscription;
private setupForIoT;
private internalSpyLambda;
getConstructName(construct: IConstruct): string;
private cleanName;
private getTopic;
private getEventBridge;
private findRootStack;
private findElement;
private addMappingToFunction;
private getAssetLocation;
}