github.com/Jeffail/benthos/v3@v3.65.0/template/test/stdin_uppercase.yaml (about)

     1  name: stdin_uppercase
     2  type: input
     3  status: experimental
     4  categories: [ Pointless ]
     5  summary: Reads messages from stdin but uppercases everything for some reason.
     6  
     7  mapping: |
     8    root.stdin = {}
     9    root.processors = []
    10    root.processors."-".bloblang = """
    11      root = content().uppercase().string()
    12    """
    13  
    14  metrics_mapping: |
    15    map decrement_processor {
    16      let start_index = this.index_of("processor")
    17      let prefix = this.slice(0, $start_index)
    18      let suffix = this.slice($start_index)
    19  
    20      let index = $suffix.split(".").1.number().floor()
    21  
    22      root = $prefix + if $index == 0 {
    23        $suffix.replace("processor.0.", "mapping.")
    24      } else {
    25        $suffix.re_replace("processor\\.[0-9]+\\.", "processor.%v.".format($index - 1))
    26      }
    27    }
    28  
    29    root = if this.contains("processor") {
    30      this.apply("decrement_processor")
    31    }