Condition

Table of contents

  1. Description
  2. Properties
  3. Example
  4. Associated types
    1. Predicate
      1. Description
      2. Properties
      3. Example

Description

Condition is an entity which defines a condition in the context of the Alert Notification service which must be met in order for some Action to be triggered

Properties

Field Type Description
id? string An identification string which will be generated on its creation
name string Unique name, used for identification
description string Brief description of the condition, e.g. explaining what it will be used for
propertyKey string Property key of the event, e.g. eventType
predicate Predicate (string) Predefined matching criteria
propertyValue string Value to be expected when matching the propertyKey with the given predicate
labels? string[] Representing meaningful identifiers, which enable custom displaying & filtering capabilities
mandatory? boolean Explicitly set which conditions must be mandatory. If not set conditions will be treated as follows:
- Conditions with different property keys will be evaluated with the AND operator
- Conditions with the same property key will be evaluated with OR operator

Example

import { Predicate } from '@sap_oss/alert-notification-client';

const condition = {
    name: 'event-type-contains-HighCpu',
    description: 'Match events which body contains HighCpu',
    propertyKey: 'eventType',
    predicate: Predicate.CONTAINS,
    propertyValue: 'HighCpu'
};

Associated types

Predicate

Description

Predicate is an enum value representing a matching criteria for a condition.

Properties

Type Available values
string CONTAINS
string DOES_NOT_CONTAIN
string STARTS_WITH
string DOES_NOT_START_WITH
string ENDS_WITH
string DOES_NOT_END_WITH
string EQUALS
string NOT_EQUALS
string ANY
string LESS_THAN
string NO_VALUE
string GREATHER_THAN
string NUMBER_EQUALS

Example

import { Predicate } from '@sap_oss/alert-notification-client';

console.log(Predicate.CONTAINS); // will print 'CONTAINS'