WaiterStateMachine
- class aws_cdk.custom_resources.WaiterStateMachine(scope, id, *, backoff_rate, interval, is_complete_handler, max_attempts, timeout_handler, disable_logging=None, log_options=None)
Bases:
Construct
A very simple StateMachine construct highly customized to the provider framework.
We previously used
CfnResource
instead ofCfnStateMachine
to avoid depending onaws-stepfunctions
module, but now it is okay.The state machine continuously calls the isCompleteHandler, until it succeeds or times out. The handler is called
maxAttempts
times with aninterval
duration and abackoffRate
rate.- 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 as cdk from aws_cdk import aws_lambda as lambda_ from aws_cdk import aws_logs as logs from aws_cdk import aws_stepfunctions as stepfunctions from aws_cdk import custom_resources # function_: lambda.Function # log_group: logs.LogGroup waiter_state_machine = custom_resources.WaiterStateMachine(self, "MyWaiterStateMachine", backoff_rate=123, interval=cdk.Duration.minutes(30), is_complete_handler=function_, max_attempts=123, timeout_handler=function_, # the properties below are optional disable_logging=False, log_options=custom_resources.LogOptions( destination=log_group, include_execution_data=False, level=stepfunctions.LogLevel.OFF ) )
- Parameters:
scope (
Construct
) –id (
str
) –backoff_rate (
Union
[int
,float
]) – Backoff between attempts.interval (
Duration
) – The interval to wait between attempts.is_complete_handler (
IFunction
) – The main handler that notifies if the waiter to decide ‘complete’ or ‘incomplete’.max_attempts (
Union
[int
,float
]) – Number of attempts.timeout_handler (
IFunction
) – The handler to call if the waiter times out and is incomplete.disable_logging (
Optional
[bool
]) – Whether logging for the state machine is disabled. Default: - falselog_options (
Union
[LogOptions
,Dict
[str
,Any
],None
]) – Defines what execution history events are logged and where they are logged. Default: - A default log group will be created if logging is enabled.
Methods
- grant_start_execution(identity)
Grant the given identity permissions on StartExecution of the state machine.
- Parameters:
identity (
IGrantable
) –- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- node
The tree node.
- state_machine_arn
The ARN of the state machine.
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
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 classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
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 theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, 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 extendsConstruct
.