import { StateMachine } from '@matthewbonig/state-machine'
new StateMachine(scope: Construct, id: string, props: StateMachineProps)| Name | Type | Description |
|---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
StateMachineProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: StateMachineProps
| Name | Description |
|---|---|
toString |
Returns a string representation of this construct. |
applyRemovalPolicy |
Apply the given removal policy to this resource. |
addToRolePolicy |
Add the given statement to the role's policy. |
grant |
Grant the given identity custom permissions. |
grantExecution |
Grant the given identity permissions on all executions of the state machine. |
grantRead |
Grant the given identity permissions to read results from state machine. |
grantRedriveExecution |
Grant the given identity permission to redrive the execution of the state machine. |
grantStartExecution |
Grant the given identity permissions to start an execution of this state machine. |
grantStartSyncExecution |
Grant the given identity permissions to start a synchronous execution of this state machine. |
grantTaskResponse |
Grant the given identity task response permissions on a state machine. |
metric |
Return the given named metric for this State Machine's executions. |
metricAborted |
Metric for the number of executions that were aborted. |
metricFailed |
Metric for the number of executions that failed. |
metricStarted |
Metric for the number of executions that were started. |
metricSucceeded |
Metric for the number of executions that succeeded. |
metricThrottled |
Metric for the number of executions that were throttled. |
metricTime |
Metric for the interval, in milliseconds, between the time the execution starts and the time it closes. |
metricTimedOut |
Metric for the number of executions that timed out. |
public toString(): stringReturns a string representation of this construct.
public applyRemovalPolicy(policy: RemovalPolicy): voidApply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
- Type: aws-cdk-lib.RemovalPolicy
public addToRolePolicy(statement: PolicyStatement): voidAdd the given statement to the role's policy.
- Type: aws-cdk-lib.aws_iam.PolicyStatement
public grant(identity: IGrantable, actions: ...string[]): GrantGrant the given identity custom permissions.
- Type: aws-cdk-lib.aws_iam.IGrantable
- Type: ...string[]
public grantExecution(identity: IGrantable, actions: ...string[]): GrantGrant the given identity permissions on all executions of the state machine.
- Type: aws-cdk-lib.aws_iam.IGrantable
- Type: ...string[]
public grantRead(identity: IGrantable): GrantGrant the given identity permissions to read results from state machine.
- Type: aws-cdk-lib.aws_iam.IGrantable
public grantRedriveExecution(identity: IGrantable): GrantGrant the given identity permission to redrive the execution of the state machine.
- Type: aws-cdk-lib.aws_iam.IGrantable
public grantStartExecution(identity: IGrantable): GrantGrant the given identity permissions to start an execution of this state machine.
- Type: aws-cdk-lib.aws_iam.IGrantable
public grantStartSyncExecution(identity: IGrantable): GrantGrant the given identity permissions to start a synchronous execution of this state machine.
- Type: aws-cdk-lib.aws_iam.IGrantable
public grantTaskResponse(identity: IGrantable): GrantGrant the given identity task response permissions on a state machine.
- Type: aws-cdk-lib.aws_iam.IGrantable
public metric(metricName: string, props?: MetricOptions): MetricReturn the given named metric for this State Machine's executions.
- Type: string
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricAborted(props?: MetricOptions): MetricMetric for the number of executions that were aborted.
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricFailed(props?: MetricOptions): MetricMetric for the number of executions that failed.
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricStarted(props?: MetricOptions): MetricMetric for the number of executions that were started.
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricSucceeded(props?: MetricOptions): MetricMetric for the number of executions that succeeded.
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricThrottled(props?: MetricOptions): MetricMetric for the number of executions that were throttled.
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricTime(props?: MetricOptions): MetricMetric for the interval, in milliseconds, between the time the execution starts and the time it closes.
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
public metricTimedOut(props?: MetricOptions): MetricMetric for the number of executions that timed out.
- Type: aws-cdk-lib.aws_cloudwatch.MetricOptions
| Name | Description |
|---|---|
isConstruct |
Checks if x is a construct. |
isOwnedResource |
Returns true if the construct was created by CDK, and false otherwise. |
isResource |
Check whether the given construct is a Resource. |
fromStateMachineArn |
Import a state machine. |
fromStateMachineName |
Import a state machine via resource name. |
import { StateMachine } from '@matthewbonig/state-machine'
StateMachine.isConstruct(x: any)Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
- Type: any
Any object.
import { StateMachine } from '@matthewbonig/state-machine'
StateMachine.isOwnedResource(construct: IConstruct)Returns true if the construct was created by CDK, and false otherwise.
- Type: constructs.IConstruct
import { StateMachine } from '@matthewbonig/state-machine'
StateMachine.isResource(construct: IConstruct)Check whether the given construct is a Resource.
- Type: constructs.IConstruct
import { StateMachine } from '@matthewbonig/state-machine'
StateMachine.fromStateMachineArn(scope: Construct, id: string, stateMachineArn: string)Import a state machine.
- Type: constructs.Construct
- Type: string
- Type: string
import { StateMachine } from '@matthewbonig/state-machine'
StateMachine.fromStateMachineName(scope: Construct, id: string, stateMachineName: string)Import a state machine via resource name.
- Type: constructs.Construct
- Type: string
- Type: string
| Name | Type | Description |
|---|---|---|
node |
constructs.Node |
The tree node. |
env |
aws-cdk-lib.ResourceEnvironment |
The environment this resource belongs to. |
stack |
aws-cdk-lib.Stack |
The stack in which this resource is defined. |
grantPrincipal |
aws-cdk-lib.aws_iam.IPrincipal |
The principal this state machine is running as. |
role |
aws-cdk-lib.aws_iam.IRole |
Execution role of this state machine. |
stateMachineArn |
string |
The ARN of the state machine. |
stateMachineName |
string |
The name of the state machine. |
stateMachineRevisionId |
string |
Identifier for the state machine revision, which is an immutable, read-only snapshot of a state machine’s definition and configuration. |
stateMachineType |
aws-cdk-lib.aws_stepfunctions.StateMachineType |
Type of the state machine. |
public readonly node: Node;- Type: constructs.Node
The tree node.
public readonly env: ResourceEnvironment;- Type: aws-cdk-lib.ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
public readonly stack: Stack;- Type: aws-cdk-lib.Stack
The stack in which this resource is defined.
public readonly grantPrincipal: IPrincipal;- Type: aws-cdk-lib.aws_iam.IPrincipal
The principal this state machine is running as.
public readonly role: IRole;- Type: aws-cdk-lib.aws_iam.IRole
Execution role of this state machine.
public readonly stateMachineArn: string;- Type: string
The ARN of the state machine.
public readonly stateMachineName: string;- Type: string
The name of the state machine.
public readonly stateMachineRevisionId: string;- Type: string
Identifier for the state machine revision, which is an immutable, read-only snapshot of a state machine’s definition and configuration.
public readonly stateMachineType: StateMachineType;- Type: aws-cdk-lib.aws_stepfunctions.StateMachineType
Type of the state machine.
| Name | Type | Description |
|---|---|---|
PROPERTY_INJECTION_ID |
string |
Uniquely identifies this class. |
public readonly PROPERTY_INJECTION_ID: string;- Type: string
Uniquely identifies this class.
A projen component for discovering AWS Step Function state machine workflow ASL files and generating a strongly typed interface and construct to use it.
Simply add a new instance and hand it your AwsCdkTypeScriptApp projen class:
const project = new AwsCdkTypeScriptApp({ ... });
new StepFunctionsAutoDiscover(project);
And any *.workflow.json file will cause the generation of a new strongly-typed StateMachine-derived class you can use. Note that these constructs are NOT jsii-compatible. If you need that, please open an issue
import { StepFunctionsAutoDiscover } from '@matthewbonig/state-machine'
new StepFunctionsAutoDiscover(project: AwsCdkTypeScriptApp, _options?: StepFunctionsAutoDiscoverOptions)| Name | Type | Description |
|---|---|---|
project |
projen.awscdk.AwsCdkTypeScriptApp |
No description. |
_options |
StepFunctionsAutoDiscoverOptions |
No description. |
- Type: projen.awscdk.AwsCdkTypeScriptApp
| Name | Description |
|---|---|
toString |
Returns a string representation of this construct. |
postSynthesize |
Called after synthesis. |
preSynthesize |
Called before synthesis. |
synthesize |
Synthesizes files to the project output directory. |
public toString(): stringReturns a string representation of this construct.
public postSynthesize(): voidCalled after synthesis.
Order is not guaranteed.
public preSynthesize(): voidCalled before synthesis.
public synthesize(): voidSynthesizes files to the project output directory.
| Name | Description |
|---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
import { StepFunctionsAutoDiscover } from '@matthewbonig/state-machine'
StepFunctionsAutoDiscover.isConstruct(x: any)Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
- Type: any
Any object.
import { StepFunctionsAutoDiscover } from '@matthewbonig/state-machine'
StepFunctionsAutoDiscover.isComponent(x: any)Test whether the given construct is a component.
- Type: any
| Name | Type | Description |
|---|---|---|
node |
constructs.Node |
The tree node. |
project |
projen.Project |
No description. |
entrypoints |
string[] |
Auto-discovered entry points with paths relative to the project directory. |
public readonly node: Node;- Type: constructs.Node
The tree node.
public readonly project: Project;- Type: projen.Project
public readonly entrypoints: string[];- Type: string[]
Auto-discovered entry points with paths relative to the project directory.
import { StateMachineProps } from '@matthewbonig/state-machine'
const stateMachineProps: StateMachineProps = { ... }| Name | Type | Description |
|---|---|---|
definition |
any |
An object that can be serialized into an ASL. |
aslYaml |
boolean |
Should the ASL definition be written as YAML. |
logs |
aws-cdk-lib.aws_stepfunctions.LogOptions |
Defines what execution history events are logged and where they are logged. |
overrides |
any |
An object that matches the schema/shape of the ASL .States map with overridden values. |
role |
aws-cdk-lib.aws_iam.IRole |
The execution role for the state machine service. |
stateMachineName |
string |
A name for the state machine. |
stateMachineType |
aws-cdk-lib.aws_stepfunctions.StateMachineType |
Type of the state machine. |
timeout |
aws-cdk-lib.Duration |
Maximum run time for this state machine. |
tracingEnabled |
boolean |
Specifies whether Amazon X-Ray tracing is enabled for this state machine. |
public readonly definition: any;- Type: any
An object that can be serialized into an ASL.
public readonly aslYaml: boolean;- Type: boolean
- Default: false
Should the ASL definition be written as YAML.
public readonly logs: LogOptions;- Type: aws-cdk-lib.aws_stepfunctions.LogOptions
- Default: No logging
Defines what execution history events are logged and where they are logged.
public readonly overrides: any;- Type: any
An object that matches the schema/shape of the ASL .States map with overridden values.
Example
{'My First State': { Parameters: { FunctionName: 'aLambdaFunctionArn' } } }public readonly role: IRole;- Type: aws-cdk-lib.aws_iam.IRole
- Default: A role is automatically created
The execution role for the state machine service.
public readonly stateMachineName: string;- Type: string
- Default: A name is automatically generated
A name for the state machine.
public readonly stateMachineType: StateMachineType;- Type: aws-cdk-lib.aws_stepfunctions.StateMachineType
- Default: StateMachineType.STANDARD
Type of the state machine.
public readonly timeout: Duration;- Type: aws-cdk-lib.Duration
- Default: No timeout
Maximum run time for this state machine.
public readonly tracingEnabled: boolean;- Type: boolean
- Default: false
Specifies whether Amazon X-Ray tracing is enabled for this state machine.
import { StepFunctionsAutoDiscoverOptions } from '@matthewbonig/state-machine'
const stepFunctionsAutoDiscoverOptions: StepFunctionsAutoDiscoverOptions = { ... }| Name | Type | Description |
|---|---|---|
extension |
string |
An optional extension to use for discovering state machine files. |
public readonly extension: string;- Type: string
- Default: '.workflow.json' (JSON_STEPFUNCTION_EXT)
An optional extension to use for discovering state machine files.