# Working with NTL

## Overview

The Nimbus Transformation Language (NTL) is a high level language for reshaping telemetry data.

When Nimbus makes an optimization, it generates NTL to describe when and how an optimization should be made.

You can edit generated transforms to tailor it for your specific business requirements (this is not necessary in the majority of cases).

## Nimbus Predicates

Nimbus predicates evaluate a series of expressions and return a boolean. They have the following syntax

```yml
- key: 
  op:
  val:
```

* key: the dot delimited path
* op: any NTL valid operator
* val: the expected value

Note that `key` can be omitted in which case the value is expected to be a list of Nimbus predicates.

## Comparison Operators

### EQUAL

Checks whether two elements are exactly equal in value

```yml
key: foo
op: equal
val: 42
```

### EXISTS

Checks whether a particular path exists in an object

```yml
key: foo
op: exists
val: true
```

### MATCH

Regex match

```yml
key: foo
op: match
val: "foo"
```

### MATCH\_ANY

Regex match against an array of values

```yml
key: foo
op: match_any
val: ["foo", "foobar"]
```

## Logical Operators

### AND

```yml
op: AND
val: 
  - key: foo
    op: exists
    val: true
  - key: foo
    op: equal
    val: 42
```

### NOT

```yml
op: NOT
val: 
  key: foo
  op: equal
  val: 42
```

### OR

```yml
op: OR
val: 
  - key: foo
    op: exists
    val: true
  - key: foo
    op: equal
    val: 42
```
