class WaiterStateMachine (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.IntegTests.Alpha.WaiterStateMachine |
Go | github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2#WaiterStateMachine |
Java | software.amazon.awscdk.integtests.alpha.WaiterStateMachine |
Python | aws_cdk.integ_tests_alpha.WaiterStateMachine |
TypeScript (source) | @aws-cdk/integ-tests-alpha ยป WaiterStateMachine |
Implements
IConstruct
, IDependable
A very simple StateMachine construct highly customized to the provider framework.
This is so that this package does not need to depend on aws-stepfunctions module.
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.
For example with:
- maxAttempts = 360 (30 minutes)
- interval = 5
- backoffRate = 1 (no backoff)
it will make the API Call every 5 seconds and fail after 360 failures.
If the backoff rate is changed to 2 (for example), it will
- make the first call
- wait 5 seconds
- make the second call
- wait 15 seconds
- etc.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as integ_tests_alpha from '@aws-cdk/integ-tests-alpha';
import * as cdk from 'aws-cdk-lib';
const waiterStateMachine = new integ_tests_alpha.WaiterStateMachine(this, 'MyWaiterStateMachine', /* all optional props */ {
backoffRate: 123,
interval: cdk.Duration.minutes(30),
totalTimeout: cdk.Duration.minutes(30),
});
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 (number of seconds) to wait between attempts. |
total | Duration | The total time that the state machine will wait for a successful response. |
backoffRate?
Type:
number
(optional, default: 1 (no backoff))
Backoff between attempts.
This is the multiplier by which the retry interval increases after each retry attempt.
By default there is no backoff. Each retry will wait the amount of time
specified by interval
.
interval?
Type:
Duration
(optional, default: Duration.seconds(5))
The interval (number of seconds) to wait between attempts.
totalTimeout?
Type:
Duration
(optional, default: Duration.minutes(30))
The total time that the state machine will wait for a successful response.
Properties
Name | Type | Description |
---|---|---|
is | Assertions | The AssertionsProvide that handles async requests. |
node | Node | The tree node. |
role | string | The IAM Role ARN of the role used by the state machine. |
state | string | The ARN of the statemachine. |
isCompleteProvider
Type:
Assertions
The AssertionsProvide that handles async requests.
node
Type:
Node
The tree node.
roleArn
Type:
string
The IAM Role ARN of the role used by the state machine.
stateMachineArn
Type:
string
The ARN of the statemachine.
Methods
Name | Description |
---|---|
to | Returns a string representation of this construct. |
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.