class LambdaInvokeFunction (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.IntegTests.LambdaInvokeFunction |
Java | software.amazon.awscdk.integtests.LambdaInvokeFunction |
Python | aws_cdk.integ_tests.LambdaInvokeFunction |
TypeScript (source) | @aws-cdk/integ-tests » LambdaInvokeFunction |
Implements
IConstruct
, IConstruct
, IDependable
, IAws
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 from '@aws-cdk/integ-tests';
const lambdaInvokeFunction = new integ_tests.LambdaInvokeFunction(this, 'MyLambdaInvokeFunction', {
functionName: 'functionName',
// the properties below are optional
invocationType: integ_tests.InvocationType.EVENT,
logType: integ_tests.LogType.NONE,
payload: 'payload',
});
Initializer
new LambdaInvokeFunction(scope: Construct, id: string, props: LambdaInvokeFunctionProps)
Parameters
- scope
Construct
- id
string
- props
Lambda
Invoke Function Props
Construct Props
Name | Type | Description |
---|---|---|
function | string | The name of the function to invoke. |
invocation | Invocation | The type of invocation to use. |
log | Log | Whether to return the logs as part of the response. |
payload? | string | Payload to send as part of the invoke. |
functionName
Type:
string
The name of the function to invoke.
invocationType?
Type:
Invocation
(optional, default: InvocationType.REQUEST_RESPONE)
The type of invocation to use.
logType?
Type:
Log
(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
Name | Type | Description |
---|---|---|
node | Construct | The construct tree node associated with this construct. |
node
Type:
Construct
The construct tree node associated with this construct.
Methods
Name | Description |
---|---|
assert | 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. |
get | Returns the value of an attribute of the custom resource of an arbitrary type. |
get | Returns the value of an attribute of the custom resource of type string. |
to | Returns a string representation of this construct. |
AtPath(path, expected)
assertpublic assertAtPath(path: string, expected: ExpectedResult): void
Parameters
- path
string
- expected
Expected
Result
Assert that the ExpectedResult is equal to the result of the AwsApiCall at the given path.
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): void
Parameters
- expected
Expected
Result
Assert that the ExpectedResult is equal to the result of the AwsApiCall.
Att(attributeName)
getpublic getAtt(attributeName: string): Reference
Parameters
- attributeName
string
Returns
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.
AttString(attributeName)
getpublic 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.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.