Alarm or collection filter

You can validate the content of an alarm, a collection or any map structured object with one or multiple filters.

A filter compare a content with the value of the given field based on an operation.

Filter.content

Value to compare with. Type depend on the type of the field or on the chosen operation.

Filter.operation

Operation to apply. The following operation are currently available:

  • EQUAL: values are the same

  • NOT_EQUAL: values are different

  • GREATER_THAN: value from data greater than filter content

  • GREATER_THAN_EQUAL: value from data greater than or equal to filter content

  • LESS_THAN: value from data lesser than filter content

  • LESS_THAN_EQUAL: value from data lesser than or equal to filter content

  • SIZE_EQUAL: (arrays only) values size are the same

  • SIZE_NOT_EQUAL: (arrays only) values size are different

  • SIZE_GREATER_THAN: (arrays only) value size from data greater than filter content size

  • SIZE_GREATER_THAN_EQUAL: (arrays only) value size from data greater than or equal to filter content size

  • SIZE_LESS_THAN: (arrays only) value size from data lesser than filter content size

  • SIZE_LESS_THAN_EQUAL: (arrays only) value size from data lesser than or equal to filter content size

  • CONTAIN: (array only) value contain filter content

  • NOT_CONTAIN: (array only) value doesn’t contain filter content

  • START_WITH: value starts with filter content

  • END_WITH: value ends with filter content

  • NEWER_THAN: (dates only) value (date) is newer than now - filter content (seconds)

  • NEWER_THAN_EQUAL: (dates only) value (date) is newer or equal than now - filter content (seconds)

  • OLDER_THAN: (dates only) value (date) is older than now - filter content (seconds)

  • OLDER_THAN_EQUAL: (dates only) value (date) is older or equal than now - filter content (seconds)

  • ARRAY_BETWEEN: filter content must be an array of 2. First element used in a GREATER_THAN_EQUAL filter and second element in a LESS_THAN filter. Is true if both are true

  • OR: Content is an array of filters. If any one of those filters are true, then true.

  • AND: Content is an array of filters. If every one of those filters are true, then true.

Filter.field

Name of the field from the data we want to filter (i.e. from an alarm could be severity, source or any other field from an alarm).

filters.allMatch(data: object, filters: object[])

Check if the provided data match all given filters.

Arguments:
  • data – Object to compare filter with.

  • filters – List of object of type Filter().

Returns:

Same as match().

filters.anyMatch(data: object, filters: object[])

Check if the provided data match any given filters.

Arguments:
  • data – Object to compare filter with.

  • filters – List of object of type Filter().

Returns:

Same as match().

filters.match(data: object, filter: object)

Check if the provided data match the given filter.

Arguments:
  • data – Object to compare filter with.

  • filter – Object of type Filter().

Returns:

Boolean that represent the state of the condition.

filters.noneMatch(data: object, filters: object[])

Check if the provided data match none of given filters.

Arguments:
  • data – Object to compare filter with.

  • filters – List of object of type Filter().

Returns:

Same as match().