kapacitor-ruby 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 821ace263cd605e3233f42c76b01ff93c8d9a2bd08764634d843183296eef674
4
- data.tar.gz: ce299b58d8e2d5eb1efc792c36a6a101fb3504773e4b610fc8ea91457369936b
3
+ metadata.gz: 4855f87f3ec102488bb9c853b8f7a9d1d9e161d759ec62617859a784b8b521ac
4
+ data.tar.gz: a7875fdb26ce45b801297caec2ebc17946a6b8e1932f07c11e73fced251e03cd
5
5
  SHA512:
6
- metadata.gz: ab76b9f3b5dd49d919f7b38422c68f5d2ae286694584dbaa53dd1e2b7e72fc088022a78b996c8106846f9047985f23776bf18f3d4c7b53456bf3d7f606b58181
7
- data.tar.gz: 509abc65bc1104000e58cc8871e36d8557055db8b937a09c90d19f35f3c6cdb67ce6ae469d1847bf35aba2dee371b7c36f4d2c09372ed24cbf7dfd81de585979
6
+ metadata.gz: 6a7c13869776805389686060b8e3a47abda670b81d1adf2c8ff2690774af85d61dda6cf83c3ad35fb21f286b37f01d62c668253403e7c45d405dc76148f196c8
7
+ data.tar.gz: 321f5d4263ae5ec53fde9bb28ea158a4881967643e0071edaee2778ac37485cdf5db72de58503c6659fe06da362786a6f5d1cc667726e21bcac6708053502780
@@ -188,20 +188,17 @@ module Kapacitor
188
188
  #
189
189
  # @param id [String] Handler ID
190
190
  # @param topic [String] Topic name
191
- # @param actions [Array[Hash]] Handler actions
191
+ # @param kind [String] Kind of handler
192
+ # @param match [String] Lambda expression
193
+ # @param options [Hash] Handler options
192
194
  #
193
- def define_topic_handler(id:, topic:, actions:)
194
- req = {}
195
- req['id'] = id
196
-
197
- actions = [actions] unless actions.is_a?(Array)
198
- raise ArgumentError, "Kapacitor topic handler requires one or more actions" unless actions.size > 0
199
-
200
- actions.each do |action|
201
- raise ArgumentError, "Missing required kind attribute for action #{action}"
202
- end
203
-
204
- req['actions'] = actions
195
+ def define_topic_handler(id:, topic:, kind:, match: nil, options: {})
196
+ req = {
197
+ 'id': id,
198
+ 'kind': kind
199
+ }
200
+ req['match'] = match unless match.nil?
201
+ req['options'] = options
205
202
  api_post(endpoint: "alerts/topics/#{topic}/handlers", data: req)
206
203
  end
207
204
 
@@ -209,15 +206,17 @@ module Kapacitor
209
206
  #
210
207
  # @param id [String] Handler ID
211
208
  # @param topic [String] Topic name
212
- # @param actions [Array[Hash]] Handler actions
209
+ # @param kind [String] Kind of handler
210
+ # @param match [String] Lambda expression
211
+ # @param options [Hash] Handler options
213
212
  #
214
- def update_topic_handler(id:, topic:, actions:)
215
- req = {}
216
-
217
- actions = [actions] unless actions.is_a?(Array)
218
- raise ArgumentError, "Kapacitor topic handler requires one or more actions" unless actions.size > 0
219
-
220
- req['actions'] = actions
213
+ def update_topic_handler(id:, topic:, kind:, match: nil, options: {})
214
+ req = {
215
+ 'id': id,
216
+ 'kind': kind
217
+ }
218
+ req['match'] = match unless match.nil?
219
+ req['options'] = options
221
220
  api_put(endpoint: "alerts/topics/#{topic}/handlers/#{id}", data: req) unless req.empty?
222
221
  end
223
222
 
@@ -3,7 +3,7 @@
3
3
  #
4
4
 
5
5
  module Kapacitor
6
- VERSION = "1.0.6"
6
+ VERSION = "1.0.7"
7
7
 
8
8
  def self.version
9
9
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kapacitor-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Cerutti