Class ChoiceTransitionOptions
Options for Choice Transition.
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ChoiceTransitionOptions : IChoiceTransitionOptions, IAssignableStateOptions
Syntax (vb)
Public Class ChoiceTransitionOptions Implements IChoiceTransitionOptions, IAssignableStateOptions
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Events;
Connection connection;
var getIssue = HttpInvoke.Jsonata(this, "Get Issue", new HttpInvokeJsonataProps {
Connection = connection,
ApiRoot = "{% 'https://' & $states.input.hostname %}",
ApiEndpoint = TaskInput.FromText("{% 'issues/' & $states.input.issue.id %}"),
Method = TaskInput.FromText("GET"),
// Parse the API call result to object and set to the variables
Assign = new Dictionary<string, object> {
{ "hostname", "{% $states.input.hostname %}" },
{ "issue", "{% $parse($states.result.ResponseBody) %}" }
}
});
var updateLabels = HttpInvoke.Jsonata(this, "Update Issue Labels", new HttpInvokeJsonataProps {
Connection = connection,
ApiRoot = "{% 'https://' & $states.input.hostname %}",
ApiEndpoint = TaskInput.FromText("{% 'issues/' & $states.input.issue.id & 'labels' %}"),
Method = TaskInput.FromText("POST"),
Body = TaskInput.FromObject(new Dictionary<string, object> {
{ "labels", "{% [$type, $component] %}" }
})
});
var notMatchTitleTemplate = Pass.Jsonata(this, "Not Match Title Template");
var definition = getIssue.Next(Choice.Jsonata(this, "Match Title Template?").When(Condition.Jsonata("{% $contains($issue.title, /(feat)|(fix)|(chore)(w*):.*/) %}"), updateLabels, new ChoiceTransitionOptions {
Assign = new Dictionary<string, object> {
{ "type", "{% $match($states.input.title, /(w*)((.*))/).groups[0] %}" },
{ "component", "{% $match($states.input.title, /(w*)((.*))/).groups[1] %}" }
}
}).Otherwise(notMatchTitleTemplate));
new StateMachine(this, "StateMachine", new StateMachineProps {
DefinitionBody = DefinitionBody.FromChainable(definition),
Timeout = Duration.Minutes(5),
Comment = "automate issue labeling state machine"
});
Synopsis
Constructors
ChoiceTransitionOptions() | Options for Choice Transition. |
Properties
Assign | Workflow variables to store in this step. |
Comment | An optional description for the choice transition. |
Outputs | This option for JSONata only. |
Constructors
ChoiceTransitionOptions()
Options for Choice Transition.
public ChoiceTransitionOptions()
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Events;
Connection connection;
var getIssue = HttpInvoke.Jsonata(this, "Get Issue", new HttpInvokeJsonataProps {
Connection = connection,
ApiRoot = "{% 'https://' & $states.input.hostname %}",
ApiEndpoint = TaskInput.FromText("{% 'issues/' & $states.input.issue.id %}"),
Method = TaskInput.FromText("GET"),
// Parse the API call result to object and set to the variables
Assign = new Dictionary<string, object> {
{ "hostname", "{% $states.input.hostname %}" },
{ "issue", "{% $parse($states.result.ResponseBody) %}" }
}
});
var updateLabels = HttpInvoke.Jsonata(this, "Update Issue Labels", new HttpInvokeJsonataProps {
Connection = connection,
ApiRoot = "{% 'https://' & $states.input.hostname %}",
ApiEndpoint = TaskInput.FromText("{% 'issues/' & $states.input.issue.id & 'labels' %}"),
Method = TaskInput.FromText("POST"),
Body = TaskInput.FromObject(new Dictionary<string, object> {
{ "labels", "{% [$type, $component] %}" }
})
});
var notMatchTitleTemplate = Pass.Jsonata(this, "Not Match Title Template");
var definition = getIssue.Next(Choice.Jsonata(this, "Match Title Template?").When(Condition.Jsonata("{% $contains($issue.title, /(feat)|(fix)|(chore)(w*):.*/) %}"), updateLabels, new ChoiceTransitionOptions {
Assign = new Dictionary<string, object> {
{ "type", "{% $match($states.input.title, /(w*)((.*))/).groups[0] %}" },
{ "component", "{% $match($states.input.title, /(w*)((.*))/).groups[1] %}" }
}
}).Otherwise(notMatchTitleTemplate));
new StateMachine(this, "StateMachine", new StateMachineProps {
DefinitionBody = DefinitionBody.FromChainable(definition),
Timeout = Duration.Minutes(5),
Comment = "automate issue labeling state machine"
});
Properties
Assign
Workflow variables to store in this step.
public IDictionary<string, object>? Assign { get; set; }
Property Value
Remarks
Using workflow variables, you can store data in a step and retrieve that data in future steps.
Default: - Not assign variables
See: https://docs.aws.amazon.com/step-functions/latest/dg/workflow-variables.html
Comment
An optional description for the choice transition.
public string? Comment { get; set; }
Property Value
Remarks
Default: No comment
Outputs
This option for JSONata only.
public object? Outputs { get; set; }
Property Value
Remarks
When you use JSONPath, then the state ignores this property. Used to specify and transform output from the state. When specified, the value overrides the state output default. The output field accepts any JSON value (object, array, string, number, boolean, null). Any string value, including those inside objects or arrays, will be evaluated as JSONata if surrounded by {% %} characters. Output also accepts a JSONata expression directly.
Default: - $states.result or $states.errorOutput
See: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-input-output-filtering.html