Skip to content

Latest commit

 

History

History
356 lines (219 loc) · 10.9 KB

File metadata and controls

356 lines (219 loc) · 10.9 KB

API Reference

Constructs

ServerlessSpy

Initializers

import { ServerlessSpy } from 'serverless-spy'

new ServerlessSpy(scope: Construct, id: string, props?: ServerlessSpyProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props ServerlessSpyProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsOptional

Methods

Name Description
toString Returns a string representation of this construct.
with Applies one or more mixins to this construct.
getConstructName No description.
spy Initalize spying on resources.
spyNodes Initalize spying on resources given as parameter.

toString
public toString(): string

Returns a string representation of this construct.

with
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired
  • Type: ...constructs.IMixin[]

The mixins to apply.


getConstructName
public getConstructName(construct: IConstruct): string
constructRequired
  • Type: constructs.IConstruct

spy
public spy(filter?: SpyFilter): void

Initalize spying on resources.

filterOptional

Limit which resources to spy on.


spyNodes
public spyNodes(nodes: IConstruct[]): void

Initalize spying on resources given as parameter.

nodesRequired
  • Type: constructs.IConstruct[]

Which reources and their children to spy on.


Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { ServerlessSpy } from 'serverless-spy'

ServerlessSpy.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
serviceKeys string[] No description.

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

The tree node.


serviceKeysRequired
public readonly serviceKeys: string[];
  • Type: string[]

Structs

ServerlessSpyProps

Initializer

import { ServerlessSpyProps } from 'serverless-spy'

const serverlessSpyProps: ServerlessSpyProps = { ... }

Properties

Name Type Description
debugMode boolean No description.
generateSpyEventsFileLocation string No description.
spySqsWithNoSubscriptionAndDropAllMessages boolean No description.

debugModeOptional
public readonly debugMode: boolean;
  • Type: boolean

generateSpyEventsFileLocationOptional
public readonly generateSpyEventsFileLocation: string;
  • Type: string

spySqsWithNoSubscriptionAndDropAllMessagesOptional
public readonly spySqsWithNoSubscriptionAndDropAllMessages: boolean;
  • Type: boolean

SpyFilter

Initializer

import { SpyFilter } from 'serverless-spy'

const spyFilter: SpyFilter = { ... }

Properties

Name Type Description
spyDynamoDB boolean No description.
spyEventBridge boolean No description.
spyEventBridgeRule boolean No description.
spyLambda boolean No description.
spyS3 boolean No description.
spySnsSubsription boolean No description.
spySnsTopic boolean No description.
spySqs boolean No description.

spyDynamoDBOptional
public readonly spyDynamoDB: boolean;
  • Type: boolean

spyEventBridgeOptional
public readonly spyEventBridge: boolean;
  • Type: boolean

spyEventBridgeRuleOptional
public readonly spyEventBridgeRule: boolean;
  • Type: boolean

spyLambdaOptional
public readonly spyLambda: boolean;
  • Type: boolean

spyS3Optional
public readonly spyS3: boolean;
  • Type: boolean

spySnsSubsriptionOptional
public readonly spySnsSubsription: boolean;
  • Type: boolean

spySnsTopicOptional
public readonly spySnsTopic: boolean;
  • Type: boolean

spySqsOptional
public readonly spySqs: boolean;
  • Type: boolean