WaiterStateMachine

class aws_cdk.integ_tests_alpha.WaiterStateMachine(scope, id, *, backoff_rate=None, interval=None, total_timeout=None)

Bases: Construct

(experimental) 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.

Stability:

experimental

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.integ_tests_alpha as integ_tests_alpha
import aws_cdk as cdk

waiter_state_machine = integ_tests_alpha.WaiterStateMachine(self, "MyWaiterStateMachine",
    backoff_rate=123,
    interval=cdk.Duration.minutes(30),
    total_timeout=cdk.Duration.minutes(30)
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • backoff_rate (Union[int, float, None]) – (experimental) 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. Default: 1 (no backoff)

  • interval (Optional[Duration]) – (experimental) The interval (number of seconds) to wait between attempts. Default: Duration.seconds(5)

  • total_timeout (Optional[Duration]) – (experimental) The total time that the state machine will wait for a successful response. Default: Duration.minutes(30)

Stability:

experimental

Methods

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

is_complete_provider

(experimental) The AssertionsProvide that handles async requests.

Stability:

experimental

node

The tree node.

role_arn

(experimental) The IAM Role ARN of the role used by the state machine.

Stability:

experimental

state_machine_arn

(experimental) The ARN of the statemachine.

Stability:

experimental

Static Methods

classmethod is_construct(x)

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.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.