Skip to content
v2.275.0

Experimental

@aws-cdk/aws-iotevents-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

TimerDuration Class ​

The duration of the timer.

Example ​

ts
import * as iotevents from '@aws-cdk/aws-iotevents-alpha';
import * as actions from '@aws-cdk/aws-iotevents-actions-alpha';

declare const input: iotevents.IInput;

const state = new iotevents.State({
  stateName: 'MyState',
  onEnter: [{
    eventName: 'test-event',
    condition: iotevents.Expression.currentInput(input),
    actions: [
      new actions.SetTimerAction('MyTimer', {
        duration: cdk.Duration.seconds(60),
      }),
    ],
  }],
});

Initializer ​

ts
new TimerDuration()
python
TimerDuration()
java
new TimerDuration()
csharp
new TimerDuration()
go
NewTimerDuration()

Methods ​

fromDuration(duration: Duration): TimerDuration // chainable@staticmethod def from_duration(duration: Duration) -> TimerDurationpublic static TimerDuration fromDuration(Duration duration)public static TimerDuration FromDuration(Duration duration)func FromDuration(Duration Duration) TimerDurationstatic#
Create a timer-duration from Duration.
notes

The range of the duration is 60-31622400 seconds. The evaluated result of the duration expression is rounded down to the nearest whole number. For example, if you set the timer to 60.99 seconds, the evaluated result of the duration expression is 60 seconds.

fromExpression(expression: Expression): TimerDuration // chainable@staticmethod def from_expression(expression: Expression) -> TimerDurationpublic static TimerDuration fromExpression(Expression expression)public static TimerDuration FromExpression(Expression expression)func FromExpression(Expression Expression) TimerDurationstatic#
Create a timer-duration from Expression.
notes

You can use a string expression that includes numbers, variables (variable.&lt;variable-name>), and input values (input.<input-name>.<path-to-datum>) as the duration.

The range of the duration is 60-31622400 seconds. The evaluated result of the duration expression is rounded down to the nearest whole number. For example, if you set the timer to 60.99 seconds, the evaluated result of the duration expression is 60 seconds.