software.amazon.textract.idp.TextractA2ISfnTask Maven / Gradle / Ivy
Show all versions of idp-cdk-constructs Show documentation
package software.amazon.textract.idp;
/**
* Calls and A2I endpoint arn with a task_token and waits for the A2I job to finish in order to continue the workflow.
*
* Basic implementation
*
* Input: "Payload"."a2iInputPath"
* Output:
*
*
* {
* 'humanLoopStatus': human_loop_status,
* 'humanLoopResultPath': human_loop_result,
* 'humanLoopCreationTime': human_loop_creation_time,
* }
*
*
*
* textract_a2i_task = tcdk.TextractA2ISfnTask(
* self,
* "TextractA2I",
* a2i_flow_definition_arn=
* "arn:aws:sagemaker:us-east-1:913165245630:flow-definition/textract-classifiction",
* integration_pattern=sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
* lambda_log_level="DEBUG",
* timeout=Duration.hours(24),
* input=sfn.TaskInput.from_object({
* "Token":
* sfn.JsonPath.task_token,
* "ExecutionId":
* sfn.JsonPath.string_at('$$.Execution.Id'),
* "Payload":
* sfn.JsonPath.entire_payload,
* }),
* result_path="$.a2i_result")
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.90.0 (build d6bdb4d)", date = "2023-10-26T15:43:30.333Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = software.amazon.textract.idp.$Module.class, fqn = "amazon-textract-idp-cdk-constructs.TextractA2ISfnTask")
public class TextractA2ISfnTask extends software.amazon.awscdk.services.stepfunctions.TaskStateBase {
protected TextractA2ISfnTask(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected TextractA2ISfnTask(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id Descriptive identifier for this chainable. This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public TextractA2ISfnTask(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.textract.idp.TextractA2ISfnTaskProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
protected @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.stepfunctions.TaskMetricsConfig getTaskMetrics() {
return software.amazon.jsii.Kernel.get(this, "taskMetrics", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.stepfunctions.TaskMetricsConfig.class));
}
/**
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
protected @org.jetbrains.annotations.Nullable java.util.List getTaskPolicies() {
return java.util.Optional.ofNullable((java.util.List)(software.amazon.jsii.Kernel.get(this, "taskPolicies", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.PolicyStatement.class))))).map(java.util.Collections::unmodifiableList).orElse(null);
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.stepfunctions.IStateMachine getStateMachine() {
return software.amazon.jsii.Kernel.get(this, "stateMachine", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.stepfunctions.IStateMachine.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void setStateMachine(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.stepfunctions.IStateMachine value) {
software.amazon.jsii.Kernel.set(this, "stateMachine", java.util.Objects.requireNonNull(value, "stateMachine is required"));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getTaskTokenTableName() {
return software.amazon.jsii.Kernel.get(this, "taskTokenTableName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void setTaskTokenTableName(final @org.jetbrains.annotations.NotNull java.lang.String value) {
software.amazon.jsii.Kernel.set(this, "taskTokenTableName", java.util.Objects.requireNonNull(value, "taskTokenTableName is required"));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getVersion() {
return software.amazon.jsii.Kernel.get(this, "version", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public void setVersion(final @org.jetbrains.annotations.NotNull java.lang.String value) {
software.amazon.jsii.Kernel.set(this, "version", java.util.Objects.requireNonNull(value, "version is required"));
}
/**
* A fluent builder for {@link software.amazon.textract.idp.TextractA2ISfnTask}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id Descriptive identifier for this chainable. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final software.amazon.textract.idp.TextractA2ISfnTaskProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new software.amazon.textract.idp.TextractA2ISfnTaskProps.Builder();
}
/**
* An optional description for this state.
*
* Default: - No comment
*
* @return {@code this}
* @param comment An optional description for this state. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder comment(final java.lang.String comment) {
this.props.comment(comment);
return this;
}
/**
* Credentials for an IAM Role that the State Machine assumes for executing the task.
*
* This enables cross-account resource invocations.
*
* Default: - None (Task is executed using the State Machine's execution role)
*
* @return {@code this}
* @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-access-cross-acct-resources.html
* @param credentials Credentials for an IAM Role that the State Machine assumes for executing the task. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder credentials(final software.amazon.awscdk.services.stepfunctions.Credentials credentials) {
this.props.credentials(credentials);
return this;
}
/**
* (deprecated) Timeout for the heartbeat.
*
* Default: - None
*
* @return {@code this}
* @deprecated use heartbeatTimeout
* @param heartbeat Timeout for the heartbeat. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder heartbeat(final software.amazon.awscdk.Duration heartbeat) {
this.props.heartbeat(heartbeat);
return this;
}
/**
* Timeout for the heartbeat.
*
* [disable-awslint:duration-prop-type] is needed because all props interface in
* aws-stepfunctions-tasks extend this interface
*
* Default: - None
*
* @return {@code this}
* @param heartbeatTimeout Timeout for the heartbeat. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder heartbeatTimeout(final software.amazon.awscdk.services.stepfunctions.Timeout heartbeatTimeout) {
this.props.heartbeatTimeout(heartbeatTimeout);
return this;
}
/**
* JSONPath expression to select part of the state to be the input to this state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* input to be the empty object {}.
*
* Default: - The entire task input (JSON path '$')
*
* @return {@code this}
* @param inputPath JSONPath expression to select part of the state to be the input to this state. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder inputPath(final java.lang.String inputPath) {
this.props.inputPath(inputPath);
return this;
}
/**
* AWS Step Functions integrates with services directly in the Amazon States Language.
*
* You can control these AWS services using service integration patterns
*
* Default: - `IntegrationPattern.REQUEST_RESPONSE` for most tasks.
* `IntegrationPattern.RUN_JOB` for the following exceptions:
* `BatchSubmitJob`, `EmrAddStep`, `EmrCreateCluster`, `EmrTerminationCluster`, and `EmrContainersStartJobRun`.
*
* @return {@code this}
* @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token
* @param integrationPattern AWS Step Functions integrates with services directly in the Amazon States Language. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder integrationPattern(final software.amazon.awscdk.services.stepfunctions.IntegrationPattern integrationPattern) {
this.props.integrationPattern(integrationPattern);
return this;
}
/**
* JSONPath expression to select select a portion of the state output to pass to the next state.
*
* May also be the special value JsonPath.DISCARD, which will cause the effective
* output to be the empty object {}.
*
* Default: - The entire JSON node determined by the state input, the task result,
* and resultPath is passed to the next state (JSON path '$')
*
* @return {@code this}
* @param outputPath JSONPath expression to select select a portion of the state output to pass to the next state. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder outputPath(final java.lang.String outputPath) {
this.props.outputPath(outputPath);
return this;
}
/**
* JSONPath expression to indicate where to inject the state's output.
*
* May also be the special value JsonPath.DISCARD, which will cause the state's
* input to become its output.
*
* Default: - Replaces the entire input with the result (JSON path '$')
*
* @return {@code this}
* @param resultPath JSONPath expression to indicate where to inject the state's output. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder resultPath(final java.lang.String resultPath) {
this.props.resultPath(resultPath);
return this;
}
/**
* The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
*
* You can use ResultSelector to create a payload with values that are static
* or selected from the state's raw result.
*
* Default: - None
*
* @return {@code this}
* @see https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector
* @param resultSelector The JSON that will replace the state's raw result and become the effective result before ResultPath is applied. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder resultSelector(final java.util.Map resultSelector) {
this.props.resultSelector(resultSelector);
return this;
}
/**
* Timeout for the task.
*
* [disable-awslint:duration-prop-type] is needed because all props interface in
* aws-stepfunctions-tasks extend this interface
*
* Default: - None
*
* @return {@code this}
* @param taskTimeout Timeout for the task. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder taskTimeout(final software.amazon.awscdk.services.stepfunctions.Timeout taskTimeout) {
this.props.taskTimeout(taskTimeout);
return this;
}
/**
* (deprecated) Timeout for the task.
*
* Default: - None
*
* @return {@code this}
* @deprecated use taskTimeout
* @param timeout Timeout for the task. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder timeout(final software.amazon.awscdk.Duration timeout) {
this.props.timeout(timeout);
return this;
}
/**
* @return {@code this}
* @param a2IFlowDefinitionArn This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder a2IFlowDefinitionArn(final java.lang.String a2IFlowDefinitionArn) {
this.props.a2IFlowDefinitionArn(a2IFlowDefinitionArn);
return this;
}
/**
* Pass the execution ID from the context object to the execution input.
*
* This allows the Step Functions UI to link child executions from parent executions, making it easier to trace execution flow across state machines.
*
* If you set this property to true
, the input
property must be an object (provided by sfn.TaskInput.fromObject
) or omitted entirely.
*
* Default: - false
*
* @return {@code this}
* @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-nested-workflows.html#nested-execution-startid
* @param associateWithParent Pass the execution ID from the context object to the execution input. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder associateWithParent(final java.lang.Boolean associateWithParent) {
this.props.associateWithParent(associateWithParent);
return this;
}
/**
* The JSON input for the execution, same as that of StartExecution.
*
* Default: - The state input (JSON path '$')
*
* @return {@code this}
* @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html
* @param input The JSON input for the execution, same as that of StartExecution. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder input(final software.amazon.awscdk.services.stepfunctions.TaskInput input) {
this.props.input(input);
return this;
}
/**
* @return {@code this}
* @param lambdaLogLevel This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder lambdaLogLevel(final java.lang.String lambdaLogLevel) {
this.props.lambdaLogLevel(lambdaLogLevel);
return this;
}
/**
* The name of the execution, same as that of StartExecution.
*
* Default: - None
*
* @return {@code this}
* @see https://docs.aws.amazon.com/step-functions/latest/apireference/API_StartExecution.html
* @param name The name of the execution, same as that of StartExecution. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder name(final java.lang.String name) {
this.props.name(name);
return this;
}
/**
* @return {@code this}
* @param taskTokenTableName This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder taskTokenTableName(final java.lang.String taskTokenTableName) {
this.props.taskTokenTableName(taskTokenTableName);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.textract.idp.TextractA2ISfnTask}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public software.amazon.textract.idp.TextractA2ISfnTask build() {
return new software.amazon.textract.idp.TextractA2ISfnTask(
this.scope,
this.id,
this.props.build()
);
}
}
}