class WaiterStateMachine (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.CustomResources.WaiterStateMachine |
Go | github.com/aws/aws-cdk-go/awscdk/v2/customresources#WaiterStateMachine |
Java | software.amazon.awscdk.customresources.WaiterStateMachine |
Python | aws_cdk.custom_resources.WaiterStateMachine |
TypeScript (source) | aws-cdk-lib » custom_resources » WaiterStateMachine |
Implements
IConstruct, IDependable
A very simple StateMachine construct highly customized to the provider framework.
We previously used CfnResource instead of CfnStateMachine to avoid depending
on aws-stepfunctions module, but now it is okay.
The state machine continuously calls the isCompleteHandler, until it succeeds or times out.
The handler is called maxAttempts times with an interval duration and a backoffRate rate.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';
import { custom_resources } from 'aws-cdk-lib';
import { aws_logs as interfaces_logs } from 'aws-cdk-lib/interfaces';
declare const function_: lambda.Function;
declare const logGroupRef: interfaces_logs.ILogGroupRef;
const waiterStateMachine = new custom_resources.WaiterStateMachine(this, 'MyWaiterStateMachine', {
backoffRate: 123,
interval: cdk.Duration.minutes(30),
isCompleteHandler: function_,
maxAttempts: 123,
timeoutHandler: function_,
// the properties below are optional
disableLogging: false,
logOptions: {
destination: logGroupRef,
includeExecutionData: false,
level: stepfunctions.LogLevel.OFF,
},
});
Initializer
new WaiterStateMachine(scope: Construct, id: string, props: WaiterStateMachineProps)
Parameters
- scope
Construct - id
string - props
WaiterState Machine Props
Construct Props
| Name | Type | Description |
|---|---|---|
| backoff | number | Backoff between attempts. |
| interval | Duration | The interval to wait between attempts. |
| is | IFunction | The main handler that notifies if the waiter to decide 'complete' or 'incomplete'. |
| max | number | Number of attempts. |
| timeout | IFunction | The handler to call if the waiter times out and is incomplete. |
| disable | boolean | Whether logging for the state machine is disabled. |
| log | Log | Defines what execution history events are logged and where they are logged. |
backoffRate
Type:
number
Backoff between attempts.
interval
Type:
Duration
The interval to wait between attempts.
isCompleteHandler
Type:
IFunction
The main handler that notifies if the waiter to decide 'complete' or 'incomplete'.
maxAttempts
Type:
number
Number of attempts.
timeoutHandler
Type:
IFunction
The handler to call if the waiter times out and is incomplete.
disableLogging?
Type:
boolean
(optional, default: false)
Whether logging for the state machine is disabled.
logOptions?
Type:
Log
(optional, default: A default log group will be created if logging is enabled.)
Defines what execution history events are logged and where they are logged.
Properties
| Name | Type | Description |
|---|---|---|
| node | Node | The tree node. |
| state | string | The ARN of the state machine. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
node
Type:
Node
The tree node.
stateMachineArn
Type:
string
The ARN of the state machine.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| grant | Grant the given identity permissions on StartExecution of the state machine. |
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
grantStartExecution(identity)
public grantStartExecution(identity: IGrantable): Grant
Parameters
- identity
IGrantable
Returns
Grant the given identity permissions on StartExecution of the state machine.
[disable-awslint:no-grants]
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixin— The mixins to apply.
Returns
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.

.NET
Go
Java
Python
TypeScript (