class Expression
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.IoTEvents.Expression |
Java | software.amazon.awscdk.services.iotevents.Expression |
Python | aws_cdk.aws_iotevents.Expression |
TypeScript (source) | @aws-cdk/aws-iotevents » Expression |
Expression for events in Detector Model state.
Example
import * as iotevents from '@aws-cdk/aws-iotevents';
import * as actions from '@aws-cdk/aws-iotevents-actions';
declare const input: iotevents.IInput;
const state = new iotevents.State({
stateName: 'MyState',
onEnter: [{
eventName: 'test-event',
condition: iotevents.Expression.currentInput(input),
actions: [
actions: [
new actions.SetVariableAction(
'MyVariable',
iotevents.Expression.inputAttribute(input, 'payload.temperature'),
),
],
],
}],
});
Initializer
new Expression()
Methods
Name | Description |
---|---|
evaluate(parentPriority?) | This is called to evaluate the expression. |
static and(left, right) | Create a expression for the AND operator. |
static current | Create a expression for function currentInput() . |
static eq(left, right) | Create a expression for the Equal operator. |
static from | Create a expression from the given string. |
static gt(left, right) | Create a expression for the Greater Than operator. |
static gte(left, right) | Create a expression for the Greater Than Or Equal operator. |
static input | Create a expression for get an input attribute as $input.TemperatureInput.temperatures[2] . |
static lt(left, right) | Create a expression for the Less Than operator. |
static lte(left, right) | Create a expression for the Less Than Or Equal operator. |
static neq(left, right) | Create a expression for the Not Equal operator. |
static or(left, right) | Create a expression for the OR operator. |
evaluate(parentPriority?)
public evaluate(parentPriority?: number): string
Parameters
- parentPriority
number
— priority of the parent of this expression, used for determining whether or not to add parenthesis around the expression.
Returns
string
This is called to evaluate the expression.
static and(left, right)
public static and(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the AND operator.
Input(input)
static currentpublic static currentInput(input: IInput): Expression
Parameters
- input
IInput
Returns
Create a expression for function currentInput()
.
It is evaluated to true if the specified input message was received.
static eq(left, right)
public static eq(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the Equal operator.
String(value)
static frompublic static fromString(value: string): Expression
Parameters
- value
string
Returns
Create a expression from the given string.
static gt(left, right)
public static gt(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the Greater Than operator.
static gte(left, right)
public static gte(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the Greater Than Or Equal operator.
Attribute(input, path)
static inputpublic static inputAttribute(input: IInput, path: string): Expression
Parameters
- input
IInput
- path
string
Returns
Create a expression for get an input attribute as $input.TemperatureInput.temperatures[2]
.
static lt(left, right)
public static lt(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the Less Than operator.
static lte(left, right)
public static lte(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the Less Than Or Equal operator.
static neq(left, right)
public static neq(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the Not Equal operator.
static or(left, right)
public static or(left: Expression, right: Expression): Expression
Parameters
- left
Expression
- right
Expression
Returns
Create a expression for the OR operator.