kapacitor-ruby 1.0.2 → 1.0.3
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 +4 -4
- data/lib/kapacitor/client.rb +10 -10
- data/lib/kapacitor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30d665b31a22923dcfe3f323870cd2dbca608f4d
|
4
|
+
data.tar.gz: 2ade7584998c461366148de74ed744e29f111396
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 067d28ae1d7d640bbce58ee6304859065057d1d554a7685f08ae2703edd17504d771aac95c8cdf144554fad8060c0e74511591dea6344c67b25191a973110f2a
|
7
|
+
data.tar.gz: ae4153783f39f02933cf12f19e24c390a88bf173a6c363962aea1369ca6b9045441e377cdc84ba977053760b47c564ae1f687852b07a457152868672bbfb07f6
|
data/lib/kapacitor/client.rb
CHANGED
@@ -14,8 +14,8 @@ module Kapacitor
|
|
14
14
|
# @param version [Integer] API version (defaults to `v1preview`)
|
15
15
|
#
|
16
16
|
def initialize(url: 'http://localhost:9092/kapacitor', version: 'v1preview')
|
17
|
-
@url = URI.join(url, version)
|
18
17
|
@http = HTTPClient.new
|
18
|
+
@url = [url, version].join('/')
|
19
19
|
end
|
20
20
|
|
21
21
|
# Define a Kapacitor template
|
@@ -33,7 +33,7 @@ module Kapacitor
|
|
33
33
|
'script' => script
|
34
34
|
}
|
35
35
|
|
36
|
-
api_post(endpoint: '
|
36
|
+
api_post(endpoint: 'templates', data: req)
|
37
37
|
end
|
38
38
|
|
39
39
|
# Update a Kapacitor template
|
@@ -50,7 +50,7 @@ module Kapacitor
|
|
50
50
|
raise ArgumentError, "Kapacitor template type can be either 'batch' or 'stream'" unless opts[:type] == 'batch' or opts[:type] == 'stream'
|
51
51
|
end
|
52
52
|
|
53
|
-
api_patch(endpoint: "
|
53
|
+
api_patch(endpoint: "templates/#{id}", data: req) unless req.empty?
|
54
54
|
end
|
55
55
|
|
56
56
|
# Delete a Kapacitor template
|
@@ -58,7 +58,7 @@ module Kapacitor
|
|
58
58
|
# @param id [String] Template ID
|
59
59
|
#
|
60
60
|
def delete_template(id:)
|
61
|
-
api_delete(endpoint: "
|
61
|
+
api_delete(endpoint: "templates/#{id}")
|
62
62
|
end
|
63
63
|
|
64
64
|
# Retrieve Kapacitor templates
|
@@ -116,7 +116,7 @@ module Kapacitor
|
|
116
116
|
|
117
117
|
req['vars'] = opts[:vars] if opts[:vars]
|
118
118
|
|
119
|
-
api_post(endpoint: '
|
119
|
+
api_post(endpoint: 'tasks', data: req)
|
120
120
|
end
|
121
121
|
|
122
122
|
# Update a Kapacitor task
|
@@ -141,7 +141,7 @@ module Kapacitor
|
|
141
141
|
raise ArgumentError, "Kapacitor task status can be either 'enabled' or 'disabled'" unless opts[:status] == 'enabled' || opts[:status] == 'disabled'
|
142
142
|
end
|
143
143
|
|
144
|
-
api_patch(endpoint: "
|
144
|
+
api_patch(endpoint: "tasks/#{id}", data: req) unless req.empty?
|
145
145
|
end
|
146
146
|
|
147
147
|
# Delete a Kapacitor task
|
@@ -149,7 +149,7 @@ module Kapacitor
|
|
149
149
|
# @param id [String] Task ID
|
150
150
|
#
|
151
151
|
def delete_task(id:)
|
152
|
-
api_delete(endpoint: "
|
152
|
+
api_delete(endpoint: "tasks/#{id}")
|
153
153
|
end
|
154
154
|
|
155
155
|
# Retrieve Kapacitor tasks
|
@@ -193,7 +193,7 @@ module Kapacitor
|
|
193
193
|
end
|
194
194
|
|
195
195
|
req['actions'] = actions
|
196
|
-
api_post(endpoint: "
|
196
|
+
api_post(endpoint: "alerts/topics/#{topic}/handlers", data: req)
|
197
197
|
end
|
198
198
|
|
199
199
|
# Update a topic handler
|
@@ -209,7 +209,7 @@ module Kapacitor
|
|
209
209
|
raise ArgumentError, "Kapacitor topic handler requires one or more actions" unless actions.size > 0
|
210
210
|
|
211
211
|
req['actions'] = actions
|
212
|
-
api_put(endpoint: "
|
212
|
+
api_put(endpoint: "alerts/topics/#{topic}/handlers/#{id}", data: req) unless req.empty?
|
213
213
|
end
|
214
214
|
|
215
215
|
# Delete a topic handler
|
@@ -218,7 +218,7 @@ module Kapacitor
|
|
218
218
|
# @param topic [String] Topic name
|
219
219
|
#
|
220
220
|
def delete_topic_handler(id:, topic:)
|
221
|
-
api_delete(endpoint: "
|
221
|
+
api_delete(endpoint: "alerts/topics/#{topic}/handlers/#{id}")
|
222
222
|
end
|
223
223
|
|
224
224
|
# Retrieve topic's handlers
|
data/lib/kapacitor/version.rb
CHANGED