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:
ConstructA very simple StateMachine construct highly customized to the provider framework.
We previously used
CfnResourceinstead ofCfnStateMachineto avoid depending onaws-stepfunctionsmodule, but now it is okay.The state machine continuously calls the isCompleteHandler, until it succeeds or times out. The handler is called
maxAttemptstimes with anintervalduration and abackoffRaterate.- 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
- PROPERTY_INJECTION_ID = 'aws-cdk-lib.custom-resources.WaiterStateMachine'
- node
The tree node.
- state_machine_arn
The ARN of the state machine.
Static Methods
- classmethod is_construct(x)
Checks if
xis a construct.Use this method instead of
instanceofto properly detectConstructinstances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the classConstructin each copy of theconstructslibrary is seen as a different class, and an instance of one class will not test asinstanceofthe other class.npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructslibrary can be accidentally installed, andinstanceofwill 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
xis an object created from a class which extendsConstruct.