mihirsoni / odfe-monitor-cli

Manage your Alerting monitors
Apache License 2.0
34 stars 22 forks source link

Support Action Throttle #9

Closed yteraoka closed 3 years ago

yteraoka commented 4 years ago

This PR is very similar to #6, with one difference. To make omitempty work, I added a Throttle struct as a pointer.

Enabled

throttleEnabled: true
throttle:
  value: 10
  unit: MINUTES

convert to

"throttle_enabled": true,
"throttle": {
  "value": 10,
  "unit": "MINUTES"
}

Disabled

throttleEnabled: false
throttle: null

convert to none.

yaml version

I got a error below with gopkg.in/mihirsoni/yaml.v2. So I changed to yaml.v3.

Unable to parse monitor correctly: json: unsupported type: map[interface {}]interface {}
mihirsoni commented 4 years ago

@yteraoka Thanks for the PR.

Were you able test this changes on cluster, just to ensure there are no breaking changes by switching to v3 ?

yteraoka commented 4 years ago

I’m not sure about difference between yaml.v2 and yaml.v3. But it worked for me (Amazon ES 7.4). We'll need to write test code.