Class FailProps
Properties for defining a Fail state.
Inheritance
System.Object
FailProps
Implements
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.AWS.StepFunctions.dll
Syntax (csharp)
public class FailProps : Object, IFailProps
Syntax (vb)
Public Class FailProps
Inherits Object
Implements IFailProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Lambda;
Function submitLambda;
Function getStatusLambda;
var submitJob = new LambdaInvoke(this, "Submit Job", new LambdaInvokeProps {
LambdaFunction = submitLambda,
// Lambda's result is in the attribute `Payload`
OutputPath = "$.Payload"
});
var waitX = new Wait(this, "Wait X Seconds", new WaitProps {
Time = WaitTime.SecondsPath("$.waitSeconds")
});
var getStatus = new LambdaInvoke(this, "Get Job Status", new LambdaInvokeProps {
LambdaFunction = getStatusLambda,
// Pass just the field named "guid" into the Lambda, put the
// Lambda's result in a field called "status" in the response
InputPath = "$.guid",
OutputPath = "$.Payload"
});
var jobFailed = new Fail(this, "Job Failed", new FailProps {
Cause = "AWS Batch Job Failed",
Error = "DescribeJob returned FAILED"
});
var finalStatus = new LambdaInvoke(this, "Get Final Job Status", new LambdaInvokeProps {
LambdaFunction = getStatusLambda,
// Use "guid" field as input
InputPath = "$.guid",
OutputPath = "$.Payload"
});
var definition = submitJob.Next(waitX).Next(getStatus).Next(new Choice(this, "Job Complete?").When(Condition.StringEquals("$.status", "FAILED"), jobFailed).When(Condition.StringEquals("$.status", "SUCCEEDED"), finalStatus).Otherwise(waitX));
new StateMachine(this, "StateMachine", new StateMachineProps {
Definition = definition,
Timeout = Duration.Minutes(5)
});
Synopsis
Constructors
FailProps() |
Properties
Cause | A description for the cause of the failure. |
Comment | An optional description for this state. |
Error | Error code used to represent this failure. |
Constructors
FailProps()
public FailProps()
Properties
Cause
A description for the cause of the failure.
public string Cause { get; set; }
Property Value
System.String
Remarks
Default: No description
Comment
An optional description for this state.
public string Comment { get; set; }
Property Value
System.String
Remarks
Default: No comment
Error
Error code used to represent this failure.
public string Error { get; set; }
Property Value
System.String
Remarks
Default: No error code