@aws-cdk_integ-tests-alpha.LambdaInvokeFunction

class LambdaInvokeFunction (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.IntegTests.Alpha.LambdaInvokeFunction
Gogithub.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2#LambdaInvokeFunction
Javasoftware.amazon.awscdk.integtests.alpha.LambdaInvokeFunction
Pythonaws_cdk.integ_tests_alpha.LambdaInvokeFunction
TypeScript (source)@aws-cdk/integ-tests-alpha ยป LambdaInvokeFunction

Implements IConstruct, IDependable, IApiCall

An AWS Lambda Invoke function API call.

Use this istead of the generic AwsApiCall in order to invoke a lambda function. This will automatically create the correct permissions to invoke the function

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as integ_tests_alpha from '@aws-cdk/integ-tests-alpha';
const lambdaInvokeFunction = new integ_tests_alpha.LambdaInvokeFunction(this, 'MyLambdaInvokeFunction', {
  functionName: 'functionName',

  // the properties below are optional
  invocationType: integ_tests_alpha.InvocationType.EVENT,
  logType: integ_tests_alpha.LogType.NONE,
  payload: 'payload',
});

Initializer

new LambdaInvokeFunction(scope: Construct, id: string, props: LambdaInvokeFunctionProps)

Parameters

  • scope Construct
  • id string
  • props LambdaInvokeFunctionProps

Construct Props

NameTypeDescription
functionName๐Ÿ”นstringThe name of the function to invoke.
invocationType?๐Ÿ”นInvocationTypeThe type of invocation to use.
logType?๐Ÿ”นLogTypeWhether to return the logs as part of the response.
payload?๐Ÿ”นstringPayload to send as part of the invoke.

functionName๐Ÿ”น

Type: string

The name of the function to invoke.


invocationType?๐Ÿ”น

Type: InvocationType (optional, default: InvocationType.REQUEST_RESPONE)

The type of invocation to use.


logType?๐Ÿ”น

Type: LogType (optional, default: LogType.NONE)

Whether to return the logs as part of the response.


payload?๐Ÿ”น

Type: string (optional, default: no payload)

Payload to send as part of the invoke.

Properties

NameTypeDescription
node๐Ÿ”นNodeThe tree node.
provider๐Ÿ”นAssertionsProvideraccess the AssertionsProvider.
waiterProvider?๐Ÿ”นAssertionsProvideraccess the AssertionsProvider for the waiter state machine.

node๐Ÿ”น

Type: Node

The tree node.


provider๐Ÿ”น

Type: AssertionsProvider

access the AssertionsProvider.

This can be used to add additional IAM policies the the provider role policy


waiterProvider?๐Ÿ”น

Type: AssertionsProvider (optional)

access the AssertionsProvider for the waiter state machine.

This can be used to add additional IAM policies the the provider role policy Example

declare const apiCall: AwsApiCall;
apiCall.waiterProvider?.addToRolePolicy({
  Effect: 'Allow',
  Action: ['s3:GetObject'],
  Resource: ['*'],
});

Methods

NameDescription
assertAtPath(path, expected)๐Ÿ”นAssert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
expect(expected)๐Ÿ”นAssert that the ExpectedResult is equal to the result of the AwsApiCall.
getAtt(attributeName)๐Ÿ”นReturns the value of an attribute of the custom resource of an arbitrary type.
getAttString(attributeName)๐Ÿ”นReturns the value of an attribute of the custom resource of type string.
next(next)๐Ÿ”นAllows you to chain IApiCalls. This adds an explicit dependency betweent the two resources.
toString()๐Ÿ”นReturns a string representation of this construct.
waitForAssertions(options?)๐Ÿ”นWait for the IApiCall to return the expected response.

assertAtPath(path, expected)๐Ÿ”น

public assertAtPath(path: string, expected: ExpectedResult): IApiCall

Parameters

  • path string
  • expected ExpectedResult

Returns

  • IApiCall

Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.

Providing a path will filter the output of the initial API call.

For example the SQS.receiveMessage api response would look like:

If you wanted to assert the value of Body you could do


expect(expected)๐Ÿ”น

public expect(expected: ExpectedResult): IApiCall

Parameters

  • expected ExpectedResult

Returns

  • IApiCall

Assert that the ExpectedResult is equal to the result of the AwsApiCall.


getAtt(attributeName)๐Ÿ”น

public getAtt(attributeName: string): Reference

Parameters

  • attributeName string

Returns

  • Reference

Returns the value of an attribute of the custom resource of an arbitrary type.

Attributes are returned from the custom resource provider through the Data map where the key is the attribute name.


getAttString(attributeName)๐Ÿ”น

public getAttString(attributeName: string): string

Parameters

  • attributeName string

Returns

  • string

Returns the value of an attribute of the custom resource of type string.

Attributes are returned from the custom resource provider through the Data map where the key is the attribute name.


next(next)๐Ÿ”น

public next(next: IApiCall): IApiCall

Parameters

  • next IApiCall

Returns

  • IApiCall

Allows you to chain IApiCalls. This adds an explicit dependency betweent the two resources.

Returns the IApiCall provided as next


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


waitForAssertions(options?)๐Ÿ”น

public waitForAssertions(options?: WaiterStateMachineOptions): IApiCall

Parameters

  • options WaiterStateMachineOptions

Returns

  • IApiCall

Wait for the IApiCall to return the expected response.

If no expected response is specified then it will wait for the IApiCall to return a success