WaiterStateMachineOptions
- class aws_cdk.integ_tests_alpha.WaiterStateMachineOptions(*, backoff_rate=None, interval=None, total_timeout=None)
Bases:
object
(experimental) Options for creating a WaiterStateMachine.
- Parameters:
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 byinterval
. 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
- ExampleMetadata:
lit=../@aws-cdk-testing/framework-integ/test/aws-kinesisfirehose/test/integ.s3-bucket.lit.ts infused
Example:
import path as path import aws_cdk.aws_kinesisfirehose as firehose import aws_cdk.aws_kms as kms import aws_cdk.aws_lambda_nodejs as lambdanodejs import aws_cdk.aws_logs as logs import aws_cdk.aws_s3 as s3 import aws_cdk as cdk from aws_cdk.integ_tests_alpha import AwsApiCall, ExpectedResult, IntegTest app = cdk.App() stack = cdk.Stack(app, "aws-cdk-firehose-delivery-stream-s3-all-properties") bucket = s3.Bucket(stack, "FirehoseDeliveryStreamS3AllPropertiesBucket", removal_policy=cdk.RemovalPolicy.DESTROY, auto_delete_objects=True ) backup_bucket = s3.Bucket(stack, "FirehoseDeliveryStreamS3AllPropertiesBackupBucket", removal_policy=cdk.RemovalPolicy.DESTROY, auto_delete_objects=True ) log_group = logs.LogGroup(stack, "LogGroup", removal_policy=cdk.RemovalPolicy.DESTROY ) data_processor_function = lambdanodejs.NodejsFunction(stack, "DataProcessorFunction", entry=path.join(__dirname, "lambda-data-processor.js"), timeout=cdk.Duration.minutes(1) ) processor = firehose.LambdaFunctionProcessor(data_processor_function, buffer_interval=cdk.Duration.seconds(60), buffer_size=cdk.Size.mebibytes(1), retries=1 ) key = kms.Key(stack, "Key", removal_policy=cdk.RemovalPolicy.DESTROY ) backup_key = kms.Key(stack, "BackupKey", removal_policy=cdk.RemovalPolicy.DESTROY ) delivery_stream = firehose.DeliveryStream(stack, "DeliveryStream", destination=firehose.S3Bucket(bucket, logging_config=firehose.EnableLogging(log_group), processor=processor, compression=firehose.Compression.GZIP, data_output_prefix="regularPrefix", error_output_prefix="errorPrefix", buffering_interval=cdk.Duration.seconds(60), buffering_size=cdk.Size.mebibytes(1), encryption_key=key, s3_backup=firehose.DestinationS3BackupProps( mode=firehose.BackupMode.ALL, bucket=backup_bucket, compression=firehose.Compression.ZIP, data_output_prefix="backupPrefix", error_output_prefix="backupErrorPrefix", buffering_interval=cdk.Duration.seconds(60), buffering_size=cdk.Size.mebibytes(1), encryption_key=backup_key ) ) ) firehose.DeliveryStream(stack, "ZeroBufferingDeliveryStream", destination=firehose.S3Bucket(bucket, compression=firehose.Compression.GZIP, data_output_prefix="regularPrefix", error_output_prefix="errorPrefix", buffering_interval=cdk.Duration.seconds(0) ) ) test_case = IntegTest(app, "integ-tests", test_cases=[stack], regions=["us-east-1"] ) test_case.assertions.aws_api_call("Firehose", "putRecord", { "DeliveryStreamName": delivery_stream.delivery_stream_name, "Record": { "Data": "testData123" } }) s3_api_call = test_case.assertions.aws_api_call("S3", "listObjectsV2", { "Bucket": bucket.bucket_name, "MaxKeys": 1 }).expect(ExpectedResult.object_like({ "KeyCount": 1 })).wait_for_assertions( interval=cdk.Duration.seconds(30), total_timeout=cdk.Duration.minutes(10) ) if s3_api_call instanceof AwsApiCall && s3_api_call.waiter_provider: s3_api_call.waiter_provider.add_to_role_policy({ "Effect": "Allow", "Action": ["s3:GetObject", "s3:ListBucket"], "Resource": ["*"] })
Attributes
- backoff_rate
(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)
- Stability:
experimental
- interval
(experimental) The interval (number of seconds) to wait between attempts.
- Default:
Duration.seconds(5)
- Stability:
experimental
- total_timeout
(experimental) The total time that the state machine will wait for a successful response.
- Default:
Duration.minutes(30)
- Stability:
experimental