Condition¶
-
class
aws_cdk.aws_stepfunctions.
Condition
¶ Bases:
object
A Condition for use in a Choice state branch.
- ExampleMetadata
infused
Example:
import aws_cdk.aws_lambda as lambda_ # submit_lambda: lambda.Function # get_status_lambda: lambda.Function submit_job = tasks.LambdaInvoke(self, "Submit Job", lambda_function=submit_lambda, # Lambda's result is in the attribute `Payload` output_path="$.Payload" ) wait_x = sfn.Wait(self, "Wait X Seconds", time=sfn.WaitTime.seconds_path("$.waitSeconds") ) get_status = tasks.LambdaInvoke(self, "Get Job Status", lambda_function=get_status_lambda, # Pass just the field named "guid" into the Lambda, put the # Lambda's result in a field called "status" in the response input_path="$.guid", output_path="$.Payload" ) job_failed = sfn.Fail(self, "Job Failed", cause="AWS Batch Job Failed", error="DescribeJob returned FAILED" ) final_status = tasks.LambdaInvoke(self, "Get Final Job Status", lambda_function=get_status_lambda, # Use "guid" field as input input_path="$.guid", output_path="$.Payload" ) definition = submit_job.next(wait_x).next(get_status).next(sfn.Choice(self, "Job Complete?").when(sfn.Condition.string_equals("$.status", "FAILED"), job_failed).when(sfn.Condition.string_equals("$.status", "SUCCEEDED"), final_status).otherwise(wait_x)) sfn.StateMachine(self, "StateMachine", definition=definition, timeout=Duration.minutes(5) )
Methods
-
abstract
render_condition
()¶ Render Amazon States Language JSON for the condition.
- Return type
Any
Static Methods
-
classmethod
and_
(*conditions)¶ Combine two or more conditions with a logical AND.
-
classmethod
boolean_equals
(variable, value)¶ Matches if a boolean field has the given value.
- Parameters
variable (
str
) –value (
bool
) –
- Return type
-
classmethod
boolean_equals_json_path
(variable, value)¶ Matches if a boolean field equals to a value at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
is_boolean
(variable)¶ Matches if variable is boolean.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_not_boolean
(variable)¶ Matches if variable is not boolean.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_not_null
(variable)¶ Matches if variable is not null.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_not_numeric
(variable)¶ Matches if variable is not numeric.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_not_present
(variable)¶ Matches if variable is not present.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_not_string
(variable)¶ Matches if variable is not a string.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_not_timestamp
(variable)¶ Matches if variable is not a timestamp.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_null
(variable)¶ Matches if variable is Null.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_numeric
(variable)¶ Matches if variable is numeric.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_present
(variable)¶ Matches if variable is present.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_string
(variable)¶ Matches if variable is a string.
- Parameters
variable (
str
) –- Return type
-
classmethod
is_timestamp
(variable)¶ Matches if variable is a timestamp.
- Parameters
variable (
str
) –- Return type
-
classmethod
not_
(condition)¶ Negate a condition.
-
classmethod
number_equals
(variable, value)¶ Matches if a numeric field has the given value.
- Parameters
variable (
str
) –value (
Union
[int
,float
]) –
- Return type
-
classmethod
number_equals_json_path
(variable, value)¶ Matches if a numeric field has the value in a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
number_greater_than
(variable, value)¶ Matches if a numeric field is greater than the given value.
- Parameters
variable (
str
) –value (
Union
[int
,float
]) –
- Return type
-
classmethod
number_greater_than_equals
(variable, value)¶ Matches if a numeric field is greater than or equal to the given value.
- Parameters
variable (
str
) –value (
Union
[int
,float
]) –
- Return type
-
classmethod
number_greater_than_equals_json_path
(variable, value)¶ Matches if a numeric field is greater than or equal to the value at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
number_greater_than_json_path
(variable, value)¶ Matches if a numeric field is greater than the value at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
number_less_than
(variable, value)¶ Matches if a numeric field is less than the given value.
- Parameters
variable (
str
) –value (
Union
[int
,float
]) –
- Return type
-
classmethod
number_less_than_equals
(variable, value)¶ Matches if a numeric field is less than or equal to the given value.
- Parameters
variable (
str
) –value (
Union
[int
,float
]) –
- Return type
-
classmethod
number_less_than_equals_json_path
(variable, value)¶ Matches if a numeric field is less than or equal to the numeric value at given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
number_less_than_json_path
(variable, value)¶ Matches if a numeric field is less than the value at the given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
or_
(*conditions)¶ Combine two or more conditions with a logical OR.
-
classmethod
string_equals
(variable, value)¶ Matches if a string field has the given value.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_equals_json_path
(variable, value)¶ Matches if a string field equals to a value at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_greater_than
(variable, value)¶ Matches if a string field sorts after a given value.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_greater_than_equals
(variable, value)¶ Matches if a string field sorts after or equal to a given value.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_greater_than_equals_json_path
(variable, value)¶ Matches if a string field sorts after or equal to value at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_greater_than_json_path
(variable, value)¶ Matches if a string field sorts after a value at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_less_than
(variable, value)¶ Matches if a string field sorts before a given value.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_less_than_equals
(variable, value)¶ Matches if a string field sorts equal to or before a given value.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_less_than_equals_json_path
(variable, value)¶ Matches if a string field sorts equal to or before a given mapping.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_less_than_json_path
(variable, value)¶ Matches if a string field sorts before a given value at a particular mapping.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
string_matches
(variable, value)¶ Matches if a field matches a string pattern that can contain a wild card (*) e.g: log-.txt or *LATEST. No other characters other than “*” have any special meaning - * can be escaped: *.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_equals
(variable, value)¶ Matches if a timestamp field is the same time as the given timestamp.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_equals_json_path
(variable, value)¶ Matches if a timestamp field is the same time as the timestamp at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_greater_than
(variable, value)¶ Matches if a timestamp field is after the given timestamp.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_greater_than_equals
(variable, value)¶ Matches if a timestamp field is after or equal to the given timestamp.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_greater_than_equals_json_path
(variable, value)¶ Matches if a timestamp field is after or equal to the timestamp at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_greater_than_json_path
(variable, value)¶ Matches if a timestamp field is after the timestamp at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_less_than
(variable, value)¶ Matches if a timestamp field is before the given timestamp.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_less_than_equals
(variable, value)¶ Matches if a timestamp field is before or equal to the given timestamp.
- Parameters
variable (
str
) –value (
str
) –
- Return type
-
classmethod
timestamp_less_than_equals_json_path
(variable, value)¶ Matches if a timestamp field is before or equal to the timestamp at a given mapping path.
- Parameters
variable (
str
) –value (
str
) –
- Return type