Class CustomState
State defined by supplying Amazon States Language (ASL) in the state machine.
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.AWS.StepFunctions.dll
Syntax (csharp)
public class CustomState : State, IConstruct, IDependable, IChainable, INextable
Syntax (vb)
Public Class CustomState
Inherits State
Implements IConstruct, IDependable, IChainable, INextable
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.DynamoDB;
// create a table
var table = new Table(this, "montable", new TableProps {
PartitionKey = new Attribute {
Name = "id",
Type = AttributeType.STRING
}
});
var finalStatus = new Pass(this, "final step");
// States language JSON to put an item into DynamoDB
// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
IDictionary<string, object> stateJson = new Dictionary<string, object> {
{ "Type", "Task" },
{ "Resource", "arn:aws:states:::dynamodb:putItem" },
{ "Parameters", new Dictionary<string, object> {
{ "TableName", table.TableName },
{ "Item", new Dictionary<string, IDictionary<string, string>> {
{ "id", new Dictionary<string, string> {
{ "S", "MyEntry" }
} }
} }
} },
{ "ResultPath", null }
};
// custom state which represents a task to insert data into DynamoDB
var custom = new CustomState(this, "my custom task", new CustomStateProps {
StateJson = stateJson
});
var chain = Chain.Start(custom).Next(finalStatus);
var sm = new StateMachine(this, "StateMachine", new StateMachineProps {
Definition = chain,
Timeout = Duration.Seconds(30)
});
// don't forget permissions. You need to assign them
table.GrantWriteData(sm);
Synopsis
Constructors
CustomState(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CustomState(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CustomState(Construct, String, ICustomStateProps) |
Properties
EndStates | Continuable states of this Chainable. |
Methods
Next(IChainable) | Continue normal execution with the given state. |
ToStateJson() | Returns the Amazon States Language object for this state. |
Constructors
CustomState(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CustomState(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CustomState(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CustomState(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CustomState(Construct, String, ICustomStateProps)
public CustomState(Construct scope, string id, ICustomStateProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ICustomStateProps
Properties
EndStates
Continuable states of this Chainable.
public override INextable[] EndStates { get; }
Property Value
Overrides
Methods
Next(IChainable)
Continue normal execution with the given state.
public virtual Chain Next(IChainable next)
Parameters
- next IChainable
Returns
ToStateJson()
Returns the Amazon States Language object for this state.
public override JObject ToStateJson()
Returns
Newtonsoft.Json.Linq.JObject