Skip to content

RuleDefinition

Class in Oadm.Sdk.Events · Oadm.Sdk.dll

An event rule as clients edit it (definition JSON of gRPC EventService).

public sealed class RuleDefinition
List<RuleAction> Actions { get; set; }

The actions, run in order.

List<RuleCondition> Conditions { get; set; }

The conditions; the first is the trigger.

int CooldownSeconds { get; set; }

Per device: at least this long between two “turns on” (0..3600).

bool Enabled { get; set; }

Turned on.

Guid Id { get; set; }

The rule id; empty for a new rule.

int MaxRunsPerMinute { get; set; }

For the whole rule: at most this many action runs per minute (1..1000).

string Name { get; set; }

The rule name.

RuleDefinition Clone()

A copy.

static RuleDefinition FromJson(string json)

Throws JsonException for text that is not a rule.

string ToJson()

The rule as JSON.

const int DefaultCooldownSeconds = 10

Default dead time per device.

const int DefaultMaxRunsPerMinute = 60

Default limit of action runs per minute.

static readonly JsonSerializerOptions Json

The JSON format of rules (camelCase).

const int MaxActions = 5

Most actions per rule.

const int MaxConditions = 10

Most conditions per rule.

const int MaxNameLength = 64

Longest rule name.