class TaskRole
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.StepFunctions.TaskRole |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#TaskRole |
![]() | software.amazon.awscdk.services.stepfunctions.TaskRole |
![]() | aws_cdk.aws_stepfunctions.TaskRole |
![]() | aws-cdk-lib » aws_stepfunctions » TaskRole |
Role to be assumed by the State Machine's execution role for invoking a task's resource.
Example
import * as lambda from 'aws-cdk-lib/aws-lambda';
declare const submitLambda: lambda.Function;
declare const iamRole: iam.Role;
// use a fixed role for all task invocations
const role = sfn.TaskRole.fromRole(iamRole);
// or use a json expression to resolve the role at runtime based on task inputs
//const role = sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn');
const submitJob = new tasks.LambdaInvoke(this, 'Submit Job', {
lambdaFunction: submitLambda,
outputPath: '$.Payload',
// use credentials
credentials: { role },
});
Initializer
new TaskRole()
Properties
Name | Type | Description |
---|---|---|
resource | string | Retrieves the resource for use in IAM Policies for this TaskRole. |
role | string | Retrieves the roleArn for this TaskRole. |
resource
Type:
string
Retrieves the resource for use in IAM Policies for this TaskRole.
roleArn
Type:
string
Retrieves the roleArn for this TaskRole.
Methods
Name | Description |
---|---|
static from | Construct a task role based on the provided IAM Role. |
static from | Construct a task role retrieved from task inputs using a json expression. |
static fromRole(role)
public static fromRole(role: IRole): TaskRole
Parameters
- role
IRole
— IAM Role.
Returns
Construct a task role based on the provided IAM Role.
static fromRoleArnJsonPath(expression)
public static fromRoleArnJsonPath(expression: string): TaskRole
Parameters
- expression
string
— json expression to roleArn.
Returns
Construct a task role retrieved from task inputs using a json expression. Example
sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn');