Class StateMachine
Define a StepFunctions State Machine.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class StateMachine : Resource, IStateMachine, IResource, IGrantable, IStateMachineRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class StateMachine Inherits Resource Implements IStateMachine, IResource, IGrantable, IStateMachineRef, IConstruct, IDependable, IEnvironmentAware
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.StepFunctions;
var pipeline = new Pipeline(this, "MyPipeline");
var inputArtifact = new Artifact();
var startState = new Pass(this, "StartState");
var simpleStateMachine = new StateMachine(this, "SimpleStateMachine", new StateMachineProps {
Definition = startState
});
var stepFunctionAction = new StepFunctionInvokeAction(new StepFunctionsInvokeActionProps {
ActionName = "Invoke",
StateMachine = simpleStateMachine,
StateMachineInput = StateMachineInput.FilePath(inputArtifact.AtPath("assets/input.json"))
});
pipeline.AddStage(new StageOptions {
StageName = "StepFunctions",
Actions = new [] { stepFunctionAction }
});
Synopsis
Constructors
| StateMachine(Construct, string, IStateMachineProps) | Define a StepFunctions State Machine. |
Properties
| GrantPrincipal | The principal this state machine is running as. |
| Grants | Collection of grant methods for a StateMachine. |
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
| Role | Execution role of this state machine. |
| StateMachineArn | The ARN of the state machine. |
| StateMachineName | The name of the state machine. |
| StateMachineRef | A reference to a StateMachine resource. |
| StateMachineRevisionId | Identifier for the state machine revision, which is an immutable, read-only snapshot of a state machine’s definition and configuration. |
| StateMachineType | Type of the state machine. |
Methods
| AddToRolePolicy(PolicyStatement) | Add the given statement to the role's policy. |
| FromStateMachineArn(Construct, string, string) | Import a state machine. |
| FromStateMachineName(Construct, string, string) | Import a state machine via resource name. |
| Grant(IGrantable, params string[]) | Grant the given identity custom permissions. |
| GrantExecution(IGrantable, params string[]) | Grant the given identity permissions on all executions of the state machine. |
| GrantRead(IGrantable) | Grant the given identity permissions to read results from state machine. |
| GrantRedriveExecution(IGrantable) | Grant the given identity permission to redrive the execution of the state machine. |
| GrantStartExecution(IGrantable) | Grant the given identity permissions to start an execution of this state machine. |
| GrantStartSyncExecution(IGrantable) | Grant the given identity permissions to start a synchronous execution of this state machine. |
| GrantTaskResponse(IGrantable) | Grant the given identity task response permissions on a state machine. |
| Metric(string, IMetricOptions?) | Return the given named metric for this State Machine's executions. |
| MetricAborted(IMetricOptions?) | Metric for the number of executions that were aborted. |
| MetricFailed(IMetricOptions?) | Metric for the number of executions that failed. |
| MetricStarted(IMetricOptions?) | Metric for the number of executions that were started. |
| MetricSucceeded(IMetricOptions?) | Metric for the number of executions that succeeded. |
| MetricThrottled(IMetricOptions?) | Metric for the number of executions that were throttled. |
| MetricTime(IMetricOptions?) | Metric for the interval, in milliseconds, between the time the execution starts and the time it closes. |
| MetricTimedOut(IMetricOptions?) | Metric for the number of executions that timed out. |
Constructors
StateMachine(Construct, string, IStateMachineProps)
Define a StepFunctions State Machine.
public StateMachine(Construct scope, string id, IStateMachineProps props)
Parameters
- scope Construct
- id string
- props IStateMachineProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.StepFunctions;
var pipeline = new Pipeline(this, "MyPipeline");
var inputArtifact = new Artifact();
var startState = new Pass(this, "StartState");
var simpleStateMachine = new StateMachine(this, "SimpleStateMachine", new StateMachineProps {
Definition = startState
});
var stepFunctionAction = new StepFunctionInvokeAction(new StepFunctionsInvokeActionProps {
ActionName = "Invoke",
StateMachine = simpleStateMachine,
StateMachineInput = StateMachineInput.FilePath(inputArtifact.AtPath("assets/input.json"))
});
pipeline.AddStage(new StageOptions {
StageName = "StepFunctions",
Actions = new [] { stepFunctionAction }
});
Properties
GrantPrincipal
The principal this state machine is running as.
public virtual IPrincipal GrantPrincipal { get; }
Property Value
Remarks
ExampleMetadata: infused
Grants
Collection of grant methods for a StateMachine.
public virtual StateMachineGrants Grants { get; set; }
Property Value
Remarks
ExampleMetadata: infused
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
ExampleMetadata: infused
Role
Execution role of this state machine.
public virtual IRole Role { get; }
Property Value
Remarks
ExampleMetadata: infused
StateMachineArn
The ARN of the state machine.
public virtual string StateMachineArn { get; }
Property Value
Remarks
ExampleMetadata: infused
StateMachineName
The name of the state machine.
public virtual string StateMachineName { get; }
Property Value
Remarks
Attribute: true
StateMachineRef
A reference to a StateMachine resource.
public virtual IStateMachineReference StateMachineRef { get; }
Property Value
Remarks
ExampleMetadata: infused
StateMachineRevisionId
Identifier for the state machine revision, which is an immutable, read-only snapshot of a state machine’s definition and configuration.
public virtual string StateMachineRevisionId { get; }
Property Value
Remarks
Attribute: true
StateMachineType
Type of the state machine.
public virtual StateMachineType StateMachineType { get; }
Property Value
Remarks
Attribute: true
Methods
AddToRolePolicy(PolicyStatement)
Add the given statement to the role's policy.
public virtual void AddToRolePolicy(PolicyStatement statement)
Parameters
- statement PolicyStatement
Remarks
ExampleMetadata: infused
FromStateMachineArn(Construct, string, string)
Import a state machine.
public static IStateMachine FromStateMachineArn(Construct scope, string id, string stateMachineArn)
Parameters
Returns
Remarks
ExampleMetadata: infused
FromStateMachineName(Construct, string, string)
Import a state machine via resource name.
public static IStateMachine FromStateMachineName(Construct scope, string id, string stateMachineName)
Parameters
Returns
Remarks
ExampleMetadata: infused
Grant(IGrantable, params string[])
Grant the given identity custom permissions.
public virtual Grant Grant(IGrantable identity, params string[] actions)
Parameters
- identity IGrantable
- actions string[]
Returns
Remarks
ExampleMetadata: infused
GrantExecution(IGrantable, params string[])
Grant the given identity permissions on all executions of the state machine.
public virtual Grant GrantExecution(IGrantable identity, params string[] actions)
Parameters
- identity IGrantable
- actions string[]
Returns
Remarks
ExampleMetadata: infused
GrantRead(IGrantable)
Grant the given identity permissions to read results from state machine.
public virtual Grant GrantRead(IGrantable identity)
Parameters
- identity IGrantable
Returns
Remarks
ExampleMetadata: infused
GrantRedriveExecution(IGrantable)
Grant the given identity permission to redrive the execution of the state machine.
public virtual Grant GrantRedriveExecution(IGrantable identity)
Parameters
- identity IGrantable
Returns
Remarks
ExampleMetadata: infused
GrantStartExecution(IGrantable)
Grant the given identity permissions to start an execution of this state machine.
public virtual Grant GrantStartExecution(IGrantable identity)
Parameters
- identity IGrantable
Returns
Remarks
ExampleMetadata: infused
GrantStartSyncExecution(IGrantable)
Grant the given identity permissions to start a synchronous execution of this state machine.
public virtual Grant GrantStartSyncExecution(IGrantable identity)
Parameters
- identity IGrantable
Returns
Remarks
ExampleMetadata: infused
GrantTaskResponse(IGrantable)
Grant the given identity task response permissions on a state machine.
public virtual Grant GrantTaskResponse(IGrantable identity)
Parameters
- identity IGrantable
Returns
Remarks
ExampleMetadata: infused
Metric(string, IMetricOptions?)
Return the given named metric for this State Machine's executions.
public virtual Metric Metric(string metricName, IMetricOptions? props = null)
Parameters
- metricName string
- props IMetricOptions
Returns
Remarks
Default: - sum over 5 minutes
MetricAborted(IMetricOptions?)
Metric for the number of executions that were aborted.
public virtual Metric MetricAborted(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: - sum over 5 minutes
MetricFailed(IMetricOptions?)
Metric for the number of executions that failed.
public virtual Metric MetricFailed(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: - sum over 5 minutes
MetricStarted(IMetricOptions?)
Metric for the number of executions that were started.
public virtual Metric MetricStarted(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: - sum over 5 minutes
MetricSucceeded(IMetricOptions?)
Metric for the number of executions that succeeded.
public virtual Metric MetricSucceeded(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: - sum over 5 minutes
MetricThrottled(IMetricOptions?)
Metric for the number of executions that were throttled.
public virtual Metric MetricThrottled(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: - sum over 5 minutes
MetricTime(IMetricOptions?)
Metric for the interval, in milliseconds, between the time the execution starts and the time it closes.
public virtual Metric MetricTime(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: - average over 5 minutes
MetricTimedOut(IMetricOptions?)
Metric for the number of executions that timed out.
public virtual Metric MetricTimedOut(IMetricOptions? props = null)
Parameters
- props IMetricOptions
Returns
Remarks
Default: - sum over 5 minutes