Class TaskRole
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.stepfunctions.TaskRole
- All Implemented Interfaces:
- software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
           date="2025-10-29T11:15:49.486Z")
@Stability(Stable)
public abstract class TaskRole
extends software.amazon.jsii.JsiiObject
Role to be assumed by the State Machine's execution role for invoking a task's resource.
 
Example:
 import software.amazon.awscdk.services.lambda.*;
 Function submitLambda;
 Role iamRole;
 // use a fixed role for all task invocations
 TaskRole role = TaskRole.fromRole(iamRole);
 // or use a json expression to resolve the role at runtime based on task inputs
 //const role = sfn.TaskRole.fromRoleArnJsonPath('$.RoleArn');
 LambdaInvoke submitJob = LambdaInvoke.Builder.create(this, "Submit Job")
         .lambdaFunction(submitLambda)
         .outputPath("$.Payload")
         // use credentials
         .credentials(Credentials.builder().role(role).build())
         .build();
 - See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class software.amazon.jsii.JsiiObjectsoftware.amazon.jsii.JsiiObject.InitializationMode
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic TaskRoleConstruct a task role based on the provided IAM Role.static TaskRolefromRoleArnJsonPath(String expression) Construct a task role retrieved from task inputs using a json expression.abstract StringRetrieves the resource for use in IAM Policies for this TaskRole.abstract StringRetrieves the roleArn for this TaskRole.Methods inherited from class software.amazon.jsii.JsiiObjectjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable$jsii$toJson
- 
Constructor Details- 
TaskRoleprotected TaskRole(software.amazon.jsii.JsiiObjectRef objRef) 
- 
TaskRoleprotected TaskRole(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) 
- 
TaskRole@Stability(Stable) protected TaskRole()
 
- 
- 
Method Details- 
fromRoleConstruct a task role based on the provided IAM Role.- Parameters:
- role- IAM Role. This parameter is required.
 
- 
fromRoleArnJsonPathConstruct a task role retrieved from task inputs using a json expression.Example: TaskRole.fromRoleArnJsonPath("$.RoleArn");- Parameters:
- expression- json expression to roleArn. This parameter is required.
 
- 
getResourceRetrieves the resource for use in IAM Policies for this TaskRole.
- 
getRoleArnRetrieves the roleArn for this TaskRole.
 
-