# TaskStateBaseOptions

Base options for all task states.

- Source: [`aws-stepfunctions/lib/states/task-base.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-stepfunctions/lib/states/task-base.ts#L18)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';

declare const taskRole: stepfunctions.TaskRole;
declare const timeout: stepfunctions.Timeout;
const taskStateBaseOptions: stepfunctions.TaskStateBaseOptions = {
  credentials: {
    role: taskRole,
  },
  heartbeat: cdk.Duration.minutes(30),
  heartbeatTimeout: timeout,
  integrationPattern: stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
  taskTimeout: timeout,
  timeout: cdk.Duration.minutes(30),
};
```

Python:

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

# task_role: stepfunctions.TaskRole
# timeout: stepfunctions.Timeout

task_state_base_options = stepfunctions.TaskStateBaseOptions(
    credentials=stepfunctions.Credentials(
        role=task_role
    ),
    heartbeat=cdk.Duration.minutes(30),
    heartbeat_timeout=timeout,
    integration_pattern=stepfunctions.IntegrationPattern.REQUEST_RESPONSE,
    task_timeout=timeout,
    timeout=cdk.Duration.minutes(30)
)
```

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.*;
import software.amazon.awscdk.services.stepfunctions.*;

TaskRole taskRole;
Timeout timeout;

TaskStateBaseOptions taskStateBaseOptions = TaskStateBaseOptions.builder()
        .credentials(Credentials.builder()
                .role(taskRole)
                .build())
        .heartbeat(Duration.minutes(30))
        .heartbeatTimeout(timeout)
        .integrationPattern(IntegrationPattern.REQUEST_RESPONSE)
        .taskTimeout(timeout)
        .timeout(Duration.minutes(30))
        .build();
```

C# / .NET:

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

TaskRole taskRole;
Timeout timeout;

var taskStateBaseOptions = new TaskStateBaseOptions {
    Credentials = new Credentials {
        Role = taskRole
    },
    Heartbeat = Duration.Minutes(30),
    HeartbeatTimeout = timeout,
    IntegrationPattern = IntegrationPattern.REQUEST_RESPONSE,
    TaskTimeout = timeout,
    Timeout = Duration.Minutes(30)
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/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/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var taskRole TaskRole
var timeout Timeout

taskStateBaseOptions := &TaskStateBaseOptions{
	Credentials: &Credentials{
		Role: taskRole,
	},
	Heartbeat: cdk.Duration_Minutes(jsii.Number(30)),
	HeartbeatTimeout: timeout,
	IntegrationPattern: awscdk.Aws_stepfunctions.IntegrationPattern_REQUEST_RESPONSE,
	TaskTimeout: timeout,
	Timeout: cdk.Duration_*Minutes(jsii.Number(30)),
}
```

## Properties

- `credentials`: [Credentials](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.Credentials.html) — Credentials for an IAM Role that the State Machine assumes for executing the task.

  **Default:** None (Task is executed using the State Machine's execution role)

  This enables cross-account resource invocations.

- `heartbeat`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = None — use `heartbeatTimeout`

- `heartbeatTimeout`: [Timeout](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.Timeout.html) = None — Timeout for the heartbeat.

  [disable-awslint:duration-prop-type] is needed because all props interface in
  aws-stepfunctions-tasks extend this interface

- `integrationPattern`: [IntegrationPattern](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.IntegrationPattern.html) — AWS Step Functions integrates with services directly in the Amazon States Language.

  **Default:** `IntegrationPattern.REQUEST_RESPONSE` for most tasks. `IntegrationPattern.RUN_JOB` for the following exceptions: `BatchSubmitJob`, `EmrAddStep`, `EmrCreateCluster`, `EmrTerminationCluster`, and `EmrContainersStartJobRun`.

  You can control these AWS services using service integration patterns.

  Depending on the AWS Service, the Service Integration Pattern availability will vary.

- `taskTimeout`: [Timeout](/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.Timeout.html) = None — Timeout for the task.

  [disable-awslint:duration-prop-type] is needed because all props interface in
  aws-stepfunctions-tasks extend this interface

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = None — use `taskTimeout`
