Experimental
@aws-cdk/integ-tests-alpha is an experimental (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.
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';
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),
});
# 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
from aws_cdk import aws_lambda as lambda_
waiter_state_machine = integ_tests_alpha.WaiterStateMachine(self, "MyWaiterStateMachine",
backoff_rate=123,
interval=cdk.Duration.minutes(30),
provider_log_level=lambda_.ApplicationLogLevel.INFO,
total_timeout=cdk.Duration.minutes(30)
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.integtests.alpha.*;
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.lambda.*;
WaiterStateMachine waiterStateMachine = WaiterStateMachine.Builder.create(this, "MyWaiterStateMachine")
.backoffRate(123)
.interval(Duration.minutes(30))
.providerLogLevel(ApplicationLogLevel.INFO)
.totalTimeout(Duration.minutes(30))
.build();
// Install: dotnet add package Amazon.CDK.IntegTests.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.IntegTests.Alpha;
using Amazon.CDK;
using Amazon.CDK.AWS.Lambda;
var waiterStateMachine = new WaiterStateMachine(this, "MyWaiterStateMachine", new WaiterStateMachineProps {
BackoffRate = 123,
Interval = Duration.Minutes(30),
ProviderLogLevel = ApplicationLogLevel.INFO,
TotalTimeout = Duration.Minutes(30)
});
// Install: go get github.com/aws/aws-cdk-go/awscdkintegtestsalpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import integ_tests_alpha "github.com/aws/aws-cdk-go/awscdkintegtestsalpha"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
waiterStateMachine := integ_tests_alpha.NewWaiterStateMachine(this, jsii.String("MyWaiterStateMachine"), &WaiterStateMachineProps{
BackoffRate: jsii.Number(123),
Interval: cdk.Duration_Minutes(jsii.Number(30)),
ProviderLogLevel: awscdk.Aws_lambda.ApplicationLogLevel_INFO,
TotalTimeout: cdk.Duration_*Minutes(jsii.Number(30)),
})
Initializer
new WaiterStateMachine(scope: Construct, id: string, props?: WaiterStateMachineProps)
WaiterStateMachine(scope: Construct, id: str, props: typing.Optional[WaiterStateMachineProps] = None)
new WaiterStateMachine(Construct scope, String id, WaiterStateMachineProps props)
new WaiterStateMachine(Construct scope, string id, WaiterStateMachineProps? props = null)
NewWaiterStateMachine(Scope Construct, Id *string, Props WaiterStateMachineProps)
Construct Props
backoffRatenumberbackoff_rateint | floatbackoffRateNumberBackoffRatedoubleBackoffRate*float64= 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.
intervalDurationintervalDurationintervalDurationIntervalDurationIntervalDuration= Duration.seconds(5)#providerLogLevelApplicationLogLevelprovider_log_levelApplicationLogLevelproviderLogLevelApplicationLogLevelProviderLogLevelApplicationLogLevelProviderLogLevelApplicationLogLevel= ApplicationLogLevel.FATAL#Properties
isCompleteProviderAssertionsProvideris_complete_providerAssertionsProviderisCompleteProviderAssertionsProviderIsCompleteProviderAssertionsProviderIsCompleteProviderAssertionsProviderrequired#stateMachineArnstringstate_machine_arnstrstateMachineArnStringStateMachineArnstringStateMachineArn*stringrequired#Methods
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
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
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#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.
1 parameter · returns
Parameters
mixinsmixinsmixinsmixinsMixins— The mixins to apply.
Returns: This construct for chaining