class WaiterStateMachine (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.CustomResources.WaiterStateMachine |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/customresources#WaiterStateMachine |
![]() | software.amazon.awscdk.customresources.WaiterStateMachine |
![]() | aws_cdk.custom_resources.WaiterStateMachine |
![]() | 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_logs as logs } from 'aws-cdk-lib';
import { aws_stepfunctions as stepfunctions } from 'aws-cdk-lib';
import { custom_resources } from 'aws-cdk-lib';
declare const function_: lambda.Function;
declare const logGroup: logs.LogGroup;
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: logGroup,
includeExecutionData: false,
level: stepfunctions.LogLevel.OFF,
},
});
Initializer
new WaiterStateMachine(scope: Construct, id: string, props: WaiterStateMachineProps)
Parameters
- scope
Construct
- id
string
- props
Waiter
State 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. |
node
Type:
Node
The tree node.
stateMachineArn
Type:
string
The ARN of the state machine.
Methods
Name | Description |
---|---|
grant | Grant the given identity permissions on StartExecution of the state machine. |
to | Returns a string representation of this construct. |
grantStartExecution(identity)
public grantStartExecution(identity: IGrantable): Grant
Parameters
- identity
IGrantable
Returns
Grant the given identity permissions on StartExecution of the state machine.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.