> **Experimental**
>
> `@aws-cdk/integ-tests-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# WaiterStateMachine

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.

Extends: Construct › WaiterStateMachine
Implements: IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/assertions/waiter-state-machine.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/integ-tests-alpha/lib/assertions/waiter-state-machine.ts#L66)

## Example

```ts
// 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';
import { aws_lambda as lambda } from 'aws-cdk-lib';
const waiterStateMachine = new integ_tests_alpha.WaiterStateMachine(this, 'MyWaiterStateMachine', /* all optional props */ {
  backoffRate: 123,
  interval: cdk.Duration.minutes(30),
  providerLogLevel: lambda.ApplicationLogLevel.INFO,
  totalTimeout: cdk.Duration.minutes(30),
});
```

## Initializer

```ts
new WaiterStateMachine(scope: Construct, id: string, props?: WaiterStateMachineProps)
```

## Construct Props

- `backoffRate`: number — Backoff between attempts.

  **Default:** 1 (no backoff)

  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`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.seconds(5) — The interval (number of seconds) to wait between attempts.

- `providerLogLevel`: [ApplicationLogLevel](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.ApplicationLogLevel.html) = ApplicationLogLevel.FATAL — The log level of the provider lambda function.

- `totalTimeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.minutes(30) — The total time that the state machine will wait for a successful response.

## Properties

- `isCompleteProvider`: [AssertionsProvider](/cdk/api/v2/docs/@aws-cdk_integ-tests-alpha.AssertionsProvider.html) — The AssertionsProvide that handles async requests.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `roleArn`: string — The IAM Role ARN of the role used by the state machine.

- `stateMachineArn`: string — The ARN of the statemachine.

## Methods

- `isConstruct(x: any): boolean` (static) — 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 object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — 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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
