Class Fail
Define a Fail state in the state machine.
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.AWS.StepFunctions.dll
Syntax (csharp)
public class Fail : State, IConstruct, IDependable, IChainable
Syntax (vb)
Public Class Fail
Inherits State
Implements IConstruct, IDependable, IChainable
Remarks
Reaching a Fail state terminates the state execution in failure.
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
Fail(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Fail(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Fail(Construct, String, IFailProps) |
Properties
EndStates | Continuable states of this Chainable. |
Methods
ToStateJson() | Return the Amazon States Language object for this state. |
Constructors
Fail(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Fail(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Fail(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Fail(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Fail(Construct, String, IFailProps)
public Fail(Construct scope, string id, IFailProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IFailProps
Properties
EndStates
Continuable states of this Chainable.
public override INextable[] EndStates { get; }
Property Value
Overrides
Methods
ToStateJson()
Return the Amazon States Language object for this state.
public override JObject ToStateJson()
Returns
Newtonsoft.Json.Linq.JObject
Overrides
Implements
Constructs.IConstruct