Skip to content

Commit b8490f2

Browse files
authored
feat(stepfunctions): added new condition operators (#9920)
Added the following Conditons: * `Condition.isPresent` - matches if a json path is present * `Condition.isNotPresent` - matches if a json path is not present * `Condition.isString` - matches if a json path contains a string * `Condition.isNotString` - matches if a json path is not a string * `Condition.isNumeric` - matches if a json path is numeric * `Condition.isNotNumeric` - matches if a json path is not numeric * `Condition.isBoolean` - matches if a json path is boolean * `Condition.isNotBoolean` - matches if a json path is not boolean * `Condition.isTimestamp` - matches if a json path is a timestamp * `Condition.isNotTimestamp` - matches if a json path is not a timestamp * `Condition.isNotNull` - matches if a json path is not null * `Condition.isNull` - matches if a json path is null * `Condition.booleanEqualsJsonPath` - matches if a boolean field equals a value in a given mapping path * `Condition.stringEqualsJsonPath` - matches if a string field equals a given mapping path * `Condition.stringLessThanJsonPath` - Matches if a string field sorts before a value at given mapping path * `Condition.stringLessThanEqualsJsonPath` - Matches if a string field sorts equal to or before a given mapping * `Condition.stringGreaterThanJsonPath` - Matches if a string field sorts after a value at a given mapping path * `Condition.stringGreaterThanEqualsJsonPath` - Matches if a string field sorts after or equal to value at a given mapping path * `Condition.numberEqualsJsonPath` - matches if a numeric field has the value in a given mapping path * `Condition.numberLessThan` - matches if a numeric field is less than the given value * `Condition.numberLessThanJsonPath` - matches if a numeric field is less than the value at the given mapping path * `Condition.numberLessThanEqualsJsonPath` - matches if a numeric field is less than or equal to the numeric value at given mapping path * `Condition.numberGreaterThanJsonPath` - matches if a numeric field is greater than the value at a given mapping path * `Condition.numberGreaterThanEqualsJsonPath` - matches if a numeric field is greater than or equal to the value at a given mapping path * `Condition.timestampEqualsJsonPath` - matches if a timestamp field is the same time as the timestamp at a given mapping path * `Condition.timestampLessThanJsonPath` - matches if a timestamp field is before the timestamp at a given mapping path * `Condition.timestampLessThanEqualsJsonPath` - matches if a timestamp field is before or equal to the timestamp at a given mapping path * `Condition.timestampGreaterThanJsonPath` - matches if a timestamp field is after the timestamp at a given mapping path * `Condition.timestampGreaterThanEqualsJsonPath` - matches if a timestamp field is after or equal to the timestamp at a given mapping path * `Condition.stringMatches` - matches a field with the ability to use as a wild card e.g: log-.txt or LATEST. No other characters other than "*" have any special meaning (* can be escaped: \\*) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 483e319 commit b8490f2

File tree

3 files changed

+361
-1
lines changed

3 files changed

+361
-1
lines changed

packages/@aws-cdk/aws-stepfunctions/README.md

+49-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ and also injects a field called `otherData`.
154154
```ts
155155
const pass = new stepfunctions.Pass(this, 'Filter input and inject data', {
156156
parameters: { // input to the pass state
157-
input: stepfunctions.JsonPath.stringAt('$.input.greeting')
157+
input: stepfunctions.JsonPath.stringAt('$.input.greeting'),
158158
otherData: 'some-extra-stuff'
159159
},
160160
});
@@ -217,6 +217,54 @@ If your `Choice` doesn't have an `otherwise()` and none of the conditions match
217217
the JSON state, a `NoChoiceMatched` error will be thrown. Wrap the state machine
218218
in a `Parallel` state if you want to catch and recover from this.
219219

220+
#### Available Conditions:
221+
see [step function comparison operators](https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html#amazon-states-language-choice-state-rules)
222+
* `Condition.isPresent` - matches if a json path is present
223+
* `Condition.isNotPresent` - matches if a json path is not present
224+
* `Condition.isString` - matches if a json path contains a string
225+
* `Condition.isNotString` - matches if a json path is not a string
226+
* `Condition.isNumeric` - matches if a json path is numeric
227+
* `Condition.isNotNumeric` - matches if a json path is not numeric
228+
* `Condition.isBoolean` - matches if a json path is boolean
229+
* `Condition.isNotBoolean` - matches if a json path is not boolean
230+
* `Condition.isTimestamp` - matches if a json path is a timestamp
231+
* `Condition.isNotTimestamp` - matches if a json path is not a timestamp
232+
* `Condition.isNotNull` - matches if a json path is not null
233+
* `Condition.isNull` - matches if a json path is null
234+
* `Condition.booleanEquals` - matches if a boolean field has a given value
235+
* `Condition.booleanEqualsJsonPath` - matches if a boolean field equals a value in a given mapping path
236+
* `Condition.stringEqualsJsonPath` - matches if a string field equals a given mapping path
237+
* `Condition.stringEquals` - matches if a field equals a string value
238+
* `Condition.stringLessThan` - matches if a string field sorts before a given value
239+
* `Condition.stringLessThanJsonPath` - matches if a string field sorts before a value at given mapping path
240+
* `Condition.stringLessThanEquals` - matches if a string field sorts equal to or before a given value
241+
* `Condition.stringLessThanEqualsJsonPath` - matches if a string field sorts equal to or before a given mapping
242+
* `Condition.stringGreaterThan` - matches if a string field sorts after a given value
243+
* `Condition.stringGreaterThanJsonPath` - matches if a string field sorts after a value at a given mapping path
244+
* `Condition.stringGreaterThanEqualsJsonPath` - matches if a string field sorts after or equal to value at a given mapping path
245+
* `Condition.stringGreaterThanEquals` - matches if a string field sorts after or equal to a given value
246+
* `Condition.numberEquals` - matches if a numeric field has the given value
247+
* `Condition.numberEqualsJsonPath` - matches if a numeric field has the value in a given mapping path
248+
* `Condition.numberLessThan` - matches if a numeric field is less than the given value
249+
* `Condition.numberLessThanJsonPath` - matches if a numeric field is less than the value at the given mapping path
250+
* `Condition.numberLessThanEquals` - matches if a numeric field is less than or equal to the given value
251+
* `Condition.numberLessThanEqualsJsonPath` - matches if a numeric field is less than or equal to the numeric value at given mapping path
252+
* `Condition.numberGreaterThan` - matches if a numeric field is greater than the given value
253+
* `Condition.numberGreaterThanJsonPath` - matches if a numeric field is greater than the value at a given mapping path
254+
* `Condition.numberGreaterThanEquals` - matches if a numeric field is greater than or equal to the given value
255+
* `Condition.numberGreaterThanEqualsJsonPath` - matches if a numeric field is greater than or equal to the value at a given mapping path
256+
* `Condition.timestampEquals` - matches if a timestamp field is the same time as the given timestamp
257+
* `Condition.timestampEqualsJsonPath` - matches if a timestamp field is the same time as the timestamp at a given mapping path
258+
* `Condition.timestampLessThan` - matches if a timestamp field is before the given timestamp
259+
* `Condition.timestampLessThanJsonPath` - matches if a timestamp field is before the timestamp at a given mapping path
260+
* `Condition.timestampLessThanEquals` - matches if a timestamp field is before or equal to the given timestamp
261+
* `Condition.timestampLessThanEqualsJsonPath` - matches if a timestamp field is before or equal to the timestamp at a given mapping path
262+
* `Condition.timestampGreaterThan` - matches if a timestamp field is after the timestamp at a given mapping path
263+
* `Condition.timestampGreaterThanJsonPath` - matches if a timestamp field is after the timestamp at a given mapping path
264+
* `Condition.timestampGreaterThanEquals` - matches if a timestamp field is after or equal to the given timestamp
265+
* `Condition.timestampGreaterThanEqualsJsonPath` - matches if a timestamp field is after or equal to the timestamp at a given mapping path
266+
* `Condition.stringMatches` - 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: \\\\*
267+
220268
### Parallel
221269

222270
A `Parallel` state executes one or more subworkflows in parallel. It can also

0 commit comments

Comments
 (0)