> **Experimental**
>
> `@aws-cdk/integ-tests-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# LambdaInvokeFunction

An AWS Lambda Invoke function API call.

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

Extends: [Construct](/cdk/api/v2/docs/constructs.Construct.html) › [ApiCallBase](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.ApiCallBase.html) › [AwsApiCall](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.AwsApiCall.html) › LambdaInvokeFunction
Implements: [IApiCall](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.IApiCall.html), [IConstruct](/cdk/api/v2/docs/constructs.IConstruct.html), [IDependable](/cdk/api/v2/docs/constructs.IDependable.html)

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/assertions/sdk.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/integ-tests-alpha/lib/assertions/sdk.ts#L246)

## Example

TypeScript:

```ts
// 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';
import { aws_logs as logs } from 'aws-cdk-lib';
const lambdaInvokeFunction = new integ_tests_alpha.LambdaInvokeFunction(this, 'MyLambdaInvokeFunction', {
  functionName: 'functionName',

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

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.integ_tests_alpha as integ_tests_alpha
from aws_cdk import aws_logs as logs

lambda_invoke_function = integ_tests_alpha.LambdaInvokeFunction(self, "MyLambdaInvokeFunction",
    function_name="functionName",

    # the properties below are optional
    invocation_type=integ_tests_alpha.InvocationType.EVENT,
    log_retention=logs.RetentionDays.ONE_DAY,
    log_type=integ_tests_alpha.LogType.NONE,
    payload="payload"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.integtests.alpha.*;
import software.amazon.awscdk.services.logs.*;

LambdaInvokeFunction lambdaInvokeFunction = LambdaInvokeFunction.Builder.create(this, "MyLambdaInvokeFunction")
        .functionName("functionName")

        // the properties below are optional
        .invocationType(InvocationType.EVENT)
        .logRetention(RetentionDays.ONE_DAY)
        .logType(LogType.NONE)
        .payload("payload")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.IntegTests.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.IntegTests.Alpha;
using Amazon.CDK.AWS.Logs;

var lambdaInvokeFunction = new LambdaInvokeFunction(this, "MyLambdaInvokeFunction", new LambdaInvokeFunctionProps {
    FunctionName = "functionName",

    // the properties below are optional
    InvocationType = InvocationType.EVENT,
    LogRetention = RetentionDays.ONE_DAY,
    LogType = LogType.NONE,
    Payload = "payload"
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdkintegtestsalpha"
import "github.com/aws/aws-cdk-go/awscdk"

lambdaInvokeFunction := integ_tests_alpha.NewLambdaInvokeFunction(this, jsii.String("MyLambdaInvokeFunction"), &LambdaInvokeFunctionProps{
	FunctionName: jsii.String("functionName"),

	// the properties below are optional
	InvocationType: integ_tests_alpha.InvocationType_EVENT,
	LogRetention: awscdk.Aws_logs.RetentionDays_ONE_DAY,
	LogType: integ_tests_alpha.LogType_NONE,
	Payload: jsii.String("payload"),
})
```

## Initializer

TypeScript:

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

Python:

```python
LambdaInvokeFunction(scope: Construct, id: str, props: LambdaInvokeFunctionProps)
```

Java:

```java
new LambdaInvokeFunction(Construct scope, String id, LambdaInvokeFunctionProps props)
```

C# / .NET:

```csharp
new LambdaInvokeFunction(Construct scope, string id, LambdaInvokeFunctionProps props)
```

Golang:

```go
NewLambdaInvokeFunction(Scope Construct, Id *string, Props LambdaInvokeFunctionProps)
```

## Construct Props

- `functionName`: string (required) — The name of the function to invoke.

- `invocationType`: [InvocationType](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.InvocationType.html) = InvocationType.REQUEST_RESPONSE — The type of invocation to use.

- `logRetention`: [RetentionDays](/cdk/api/v2/docs/aws-cdk-lib.aws_logs.RetentionDays.html) — How long, in days, the log contents will be retained.

  **Default:** no retention days specified

- `logType`: [LogType](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.LogType.html) = LogType.NONE — Whether to return the logs as part of the response.

- `payload`: string — Payload to send as part of the invoke.

  **Default:** no payload

## Properties

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `provider`: [AssertionsProvider](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.AssertionsProvider.html) — access the AssertionsProvider.

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

- `waiterProvider`: [AssertionsProvider](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.AssertionsProvider.html) — access the AssertionsProvider for the waiter state machine.

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

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

## Methods

- `assertAtPath(path: string, expected: ExpectedResult): 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: ExpectedResult): IApiCall` — Assert that the ExpectedResult is equal to the result of the AwsApiCall.

- `getAtt(attributeName: string): 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: string): 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.

- `isConstruct(x: any): boolean` (static) — 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.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `next(next: IApiCall): IApiCall` — Allows you to chain IApiCalls. This adds an explicit dependency betweent the two resources.

  Returns the IApiCall provided as `next`

- `toString(): string` — Returns a string representation of this construct.

- `waitForAssertions(options?: WaiterStateMachineOptions): 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

- `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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
