WaitTime

class aws_cdk.aws_stepfunctions.WaitTime(*args: Any, **kwargs)

Bases: object

Represents the Wait state which delays a state machine from continuing for a specified time.

See:

https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-wait-state.html

ExampleMetadata:

infused

Example:

convert_to_seconds = tasks.EvaluateExpression(self, "Convert to seconds",
    expression="$.waitMilliseconds / 1000",
    result_path="$.waitSeconds"
)

create_message = tasks.EvaluateExpression(self, "Create message",
    # Note: this is a string inside a string.
    expression="`Now waiting ${$.waitSeconds} seconds...`",
    runtime=lambda_.Runtime.NODEJS_LATEST,
    result_path="$.message"
)

publish_message = tasks.SnsPublish(self, "Publish message",
    topic=sns.Topic(self, "cool-topic"),
    message=sfn.TaskInput.from_json_path_at("$.message"),
    result_path="$.sns"
)

wait = sfn.Wait(self, "Wait",
    time=sfn.WaitTime.seconds_path("$.waitSeconds")
)

sfn.StateMachine(self, "StateMachine",
    definition=convert_to_seconds.next(create_message).next(publish_message).next(wait)
)

Static Methods

classmethod duration(duration)

Wait a fixed amount of time.

Parameters:

duration (Duration) –

Return type:

WaitTime

classmethod seconds_path(path)

Wait for a number of seconds stored in the state object.

Example value: $.waitSeconds

Parameters:

path (str) –

Return type:

WaitTime

classmethod timestamp(timestamp)

Wait until the given ISO8601 timestamp.

Example value: 2016-03-14T01:59:00Z

Parameters:

timestamp (str) –

Return type:

WaitTime

classmethod timestamp_path(path)

Wait until a timestamp found in the state object.

Example value: $.waitTimestamp

Parameters:

path (str) –

Return type:

WaitTime