mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-02 00:49:11 +00:00
* Split the action into two constructs: `Input` and `ExecutableInput`. The former holds all the input configuration, the latter can execute the input based on that configuration (an executable input holds an input) - This the code clearer to understand and maintain. - This also enabled to pull some common implementation code into the `ExecutableInput` and by that reduce the implementation details of each executable to the minimum required. * Also, extracted the `Input.Parser` to its own top level class, and renamed it to - `InputFactory`. The main thing that the factory does is: 1) delegate to the parsing to the `Input` class, 2) construct & wire up the `ExecutableInput`. * With the introduction of `Input`, we no longer need the `SourceBuilder` for inputs. Instead, we have an `Input.Builder` that help you build an input. This is much more intuitive from the client perspective. * Changed the `request` xcontent field in the http input result to `sent_request` for clarity * Changed the `request` xcontent field in the search input result to `executed_request` for clarity Original commit: elastic/x-pack-elasticsearch@63b93f9c7b
66 lines
1.9 KiB
YAML
66 lines
1.9 KiB
YAML
---
|
|
"Test execute watch api with empty body":
|
|
- do:
|
|
cluster.health:
|
|
wait_for_status: green
|
|
|
|
- do:
|
|
put_watch:
|
|
id: "my_logging_watch"
|
|
body: >
|
|
{
|
|
"trigger" : {
|
|
"schedule" : { "cron" : "0 0/1 * * * ?" }
|
|
},
|
|
"input" : {
|
|
"search" : {
|
|
"request" : {
|
|
"indices" : [ "logstash*" ],
|
|
"body" : {
|
|
"query" : {
|
|
"filtered": {
|
|
"query": {
|
|
"match": {
|
|
"response": 404
|
|
}
|
|
},
|
|
"filter": {
|
|
"range": {
|
|
"@timestamp" : {
|
|
"from": "{{ctx.trigger.scheduled_time}}||-5m",
|
|
"to": "{{ctx.trigger.triggered_time}}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"condition" : {
|
|
"script" : {
|
|
"script" : "ctx.payload.hits.total > 1"
|
|
}
|
|
},
|
|
"actions" : {
|
|
"Logging" : {
|
|
"logging" : {
|
|
"text" : "foobar"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- match: { _id: "my_logging_watch" }
|
|
|
|
- do:
|
|
execute_watch:
|
|
id: "my_logging_watch"
|
|
body: null
|
|
|
|
- match: { "watch_id": "my_logging_watch" }
|
|
- match: { "watch_execution.condition_result.always_true": {} }
|
|
- match: { "state": "executed" }
|
|
- match: { "watch_execution.actions_results.Logging.logging.success" : true }
|
|
- match: { "watch_execution.actions_results.Logging.logging.logged_text" : "foobar" }
|