Class CustomStateProps
Properties for defining a custom state definition.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CustomStateProps : ICustomStatePropsSyntax (vb)
Public Class CustomStateProps Implements ICustomStatePropsRemarks
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
            });
            // catch errors with addCatch
            var errorHandler = new Pass(this, "handle failure");
            custom.AddCatch(errorHandler);
            // retry the task if something goes wrong
            custom.AddRetry(new RetryProps {
                Errors = new [] { Errors.ALL },
                Interval = Duration.Seconds(10),
                MaxAttempts = 5
            });
            var chain = Chain.Start(custom).Next(finalStatus);
            var sm = new StateMachine(this, "StateMachine", new StateMachineProps {
                DefinitionBody = DefinitionBody.FromChainable(chain),
                Timeout = Duration.Seconds(30),
                Comment = "a super cool state machine"
            });
            // don't forget permissions. You need to assign them
            table.GrantWriteData(sm);Synopsis
Constructors
| CustomStateProps() | Properties for defining a custom state definition. | 
Properties
| StateJson | Amazon States Language (JSON-based) definition of the state. | 
Constructors
CustomStateProps()
Properties for defining a custom state definition.
public CustomStateProps()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
            });
            // catch errors with addCatch
            var errorHandler = new Pass(this, "handle failure");
            custom.AddCatch(errorHandler);
            // retry the task if something goes wrong
            custom.AddRetry(new RetryProps {
                Errors = new [] { Errors.ALL },
                Interval = Duration.Seconds(10),
                MaxAttempts = 5
            });
            var chain = Chain.Start(custom).Next(finalStatus);
            var sm = new StateMachine(this, "StateMachine", new StateMachineProps {
                DefinitionBody = DefinitionBody.FromChainable(chain),
                Timeout = Duration.Seconds(30),
                Comment = "a super cool state machine"
            });
            // don't forget permissions. You need to assign them
            table.GrantWriteData(sm);Properties
StateJson
Amazon States Language (JSON-based) definition of the state.
public IDictionary<string, object> StateJson { get; set; }