flapjack-diner 2.0.0.pre.alpha.3 → 2.0.0
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/.travis.yml +6 -10
- data/README.md +165 -272
- data/flapjack-diner.gemspec +1 -1
- data/lib/flapjack-diner.rb +54 -25
- data/lib/flapjack-diner/argument_validator.rb +0 -17
- data/lib/flapjack-diner/configuration.rb +417 -0
- data/lib/flapjack-diner/log_formatter.rb +22 -0
- data/lib/flapjack-diner/query.rb +114 -0
- data/lib/flapjack-diner/relationships.rb +180 -0
- data/lib/flapjack-diner/request.rb +280 -0
- data/lib/flapjack-diner/resources.rb +64 -0
- data/lib/flapjack-diner/response.rb +91 -0
- data/lib/flapjack-diner/tools.rb +46 -456
- data/lib/flapjack-diner/utility.rb +16 -0
- data/lib/flapjack-diner/version.rb +1 -1
- data/spec/flapjack-diner_spec.rb +9 -18
- data/spec/{resources/relationships_spec.rb → relationships_spec.rb} +75 -29
- data/spec/resources/checks_spec.rb +7 -7
- data/spec/resources/contacts_spec.rb +21 -19
- data/spec/resources/events_spec.rb +13 -13
- data/spec/resources/maintenance_periods_spec.rb +3 -3
- data/spec/resources/media_spec.rb +3 -3
- data/spec/resources/metrics_spec.rb +1 -1
- data/spec/resources/rules_spec.rb +278 -0
- data/spec/resources/states_spec.rb +1 -1
- data/spec/resources/statistics_spec.rb +1 -1
- data/spec/resources/tags_spec.rb +75 -19
- data/spec/support/fixture_data.rb +57 -98
- metadata +21 -29
- data/.rubocop.yml +0 -21
- data/.rubocop_todo.yml +0 -135
- data/lib/flapjack-diner/resources/acceptors.rb +0 -77
- data/lib/flapjack-diner/resources/checks.rb +0 -52
- data/lib/flapjack-diner/resources/contacts.rb +0 -54
- data/lib/flapjack-diner/resources/events.rb +0 -54
- data/lib/flapjack-diner/resources/maintenance_periods.rb +0 -76
- data/lib/flapjack-diner/resources/media.rb +0 -75
- data/lib/flapjack-diner/resources/metrics.rb +0 -23
- data/lib/flapjack-diner/resources/rejectors.rb +0 -77
- data/lib/flapjack-diner/resources/relationships.rb +0 -314
- data/lib/flapjack-diner/resources/states.rb +0 -24
- data/lib/flapjack-diner/resources/statistics.rb +0 -24
- data/lib/flapjack-diner/resources/tags.rb +0 -47
- data/spec/resources/acceptors_spec.rb +0 -278
- data/spec/resources/rejectors_spec.rb +0 -278
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72b89f956e1bc8d1eb623e24da91f1de80828ad6
|
4
|
+
data.tar.gz: 2418fe5e016a69ffb8355352351698a6a1289d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb421813c0a6cd5be784e6007cd6e87914b169014fc0199ab00a6c1778e302e3e15948bdad5998af586110ba72fbe101d84a6a4f53e7c470d4f3347ab97801ae
|
7
|
+
data.tar.gz: b51e0afbeb9625e3e464b245683322022a7a7b9c2e2715677f7bd77fae885ccedf5565816957d9658468a2ace6fc03cb73a7a37ae59669109a3e577d64c63531
|
data/.travis.yml
CHANGED
@@ -4,18 +4,14 @@ rvm:
|
|
4
4
|
- '2.0'
|
5
5
|
- '2.1'
|
6
6
|
- '2.2'
|
7
|
+
- '2.3'
|
7
8
|
cache: bundler
|
8
|
-
script:
|
9
|
+
script: bundle exec rspec
|
9
10
|
notifications:
|
10
11
|
irc:
|
11
12
|
channels:
|
12
|
-
|
13
|
+
- irc.freenode.net#flapjack
|
13
14
|
template:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}
|
18
|
-
(<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
|
19
|
-
format: html
|
20
|
-
rooms:
|
21
|
-
secure: BfENxsVOSS6YKJn/kMr8ctXTvOvZHHlpgRN8AWshCEEaorPwFlCwlQuEYz+DSR7COjwLNZav5xnTFRaPkcCG8wc4ztMgSdv9XkrGjwJHxEEIzsjPT556LtLF4d8U2Di1MNsD6YGU7kvvzhh5hAPpEn0LBGhYlz+TCv+XCjI8/6I=
|
15
|
+
- "%{message} %{repository}#%{build_number} (%{branch} - %{commit} : %{author})"
|
16
|
+
slack:
|
17
|
+
secure: OSSVSOzOOsGV58lo88tiXQiOlFt4YeRz7yQ0r2kaGV1IFpCISbLxMPTCR6qyngGJWV/QB7cgfKs39xUiAD/bU0cqz1D8BgnhLjRKcU53CymMEWV6s/TTyCgoQy+b/7DM3d7ebvEySS7fxWtApJ/DdpqbkhcgGJbNMIpaXuWd5Ro=
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
Access the JSON API of a [Flapjack](http://flapjack.io/) system monitoring server.
|
9
9
|
|
10
|
-
Please note that the following documentation refers to the `v2.0.
|
10
|
+
Please note that the following documentation refers to the `v2.0.0b1` pre-release of this gem. You may instead be looking for [documentation for the latest stable version](https://github.com/flapjack/flapjack-diner/blob/maint/1.x/README.md).
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -45,7 +45,7 @@ Flapjack::Diner.open_timeout(30)
|
|
45
45
|
Flapjack::Diner.read_timeout(300)
|
46
46
|
```
|
47
47
|
|
48
|
-
If you want the old behaviour
|
48
|
+
If you want the old behaviour with respect to returning hashes with keys as strings (they're now symbols by default) then:
|
49
49
|
|
50
50
|
```ruby
|
51
51
|
Flapjack::Diner.return_keys_as_strings = true
|
@@ -55,8 +55,8 @@ Flapjack::Diner.return_keys_as_strings = true
|
|
55
55
|
|
56
56
|
Options for all of **flapjack-diner**'s functions are organised as either:
|
57
57
|
|
58
|
-
* Ids
|
59
|
-
* Parameters
|
58
|
+
* Ids -- One or more String or Integer values; or
|
59
|
+
* Parameters -- One or more Hashes
|
60
60
|
|
61
61
|
While these can be passed in in any order, the convention is that they will be ordered as listed above.
|
62
62
|
|
@@ -84,19 +84,12 @@ If any operation fails (returning nil), the `Flapjack::Diner.last_error` method
|
|
84
84
|
* <a name="contents_update_media"> </a>[update_media](#update_media)
|
85
85
|
* <a name="contents_delete_media"> </a>[delete_media](#delete_media)
|
86
86
|
|
87
|
-
### <a name="
|
87
|
+
### <a name="contents_section_rules"> </a>[Rules](#section_rules)
|
88
88
|
|
89
|
-
* <a name="
|
90
|
-
* <a name="
|
91
|
-
* <a name="
|
92
|
-
* <a name="
|
93
|
-
|
94
|
-
### <a name="contents_section_rejectors"> </a>[Rejectors](#section_rejectors)
|
95
|
-
|
96
|
-
* <a name="contents_create_rejectors"> </a>[create_rejectors](#create_rejectors)
|
97
|
-
* <a name="contents_rejectors"> </a>[rejectors](#get_rejectors)
|
98
|
-
* <a name="contents_update_rejectors"> </a>[update_rejectors](#update_rejectors)
|
99
|
-
* <a name="contents_delete_rejectors"> </a>[delete_rejectors](#delete_rejectors)
|
89
|
+
* <a name="contents_create_rules"> </a>[create_rules](#create_rules)
|
90
|
+
* <a name="contents_rules"> </a>[rules](#get_rules)
|
91
|
+
* <a name="contents_update_rules"> </a>[update_rules](#update_rules)
|
92
|
+
* <a name="contents_delete_rules"> </a>[delete_rules](#delete_rules)
|
100
93
|
|
101
94
|
### <a name="contents_section_tags"> </a>[Tags](#section_tags)
|
102
95
|
|
@@ -143,10 +136,12 @@ Flapjack::Diner.create_checks(CHECK, ...)
|
|
143
136
|
```
|
144
137
|
CHECK
|
145
138
|
{
|
146
|
-
:id =>
|
139
|
+
:id => UUID_STRING,
|
147
140
|
:name => STRING,
|
148
141
|
:enabled => BOOLEAN,
|
149
|
-
:
|
142
|
+
:initial_failure_delay => INTEGER,
|
143
|
+
:repeat_failure_delay => INTEGER,
|
144
|
+
:tags => [UUID_STRING, ...]
|
150
145
|
}
|
151
146
|
```
|
152
147
|
|
@@ -160,8 +155,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
160
155
|
Return data for one, some or all checks.
|
161
156
|
|
162
157
|
```ruby
|
163
|
-
check = Flapjack::Diner.checks(
|
164
|
-
some_checks = Flapjack::Diner.checks(
|
158
|
+
check = Flapjack::Diner.checks(UUID_STRING)
|
159
|
+
some_checks = Flapjack::Diner.checks(UUID_STRING, UUID_STRING, ...)
|
165
160
|
first_page_of_checks = Flapjack::Diner.checks
|
166
161
|
```
|
167
162
|
|
@@ -174,15 +169,15 @@ Update data for one or more checks.
|
|
174
169
|
|
175
170
|
```ruby
|
176
171
|
# update values for one check
|
177
|
-
Flapjack::Diner.update_checks(
|
172
|
+
Flapjack::Diner.update_checks(UUID_STRING, KEY => VALUE, ...)
|
178
173
|
|
179
174
|
# update values for multiple checks
|
180
|
-
Flapjack::Diner.update_checks({
|
175
|
+
Flapjack::Diner.update_checks({UUID_STRING, KEY => VALUE, ...}, {UUID_STRING, KEY => VALUE, ...})
|
181
176
|
```
|
182
177
|
|
183
178
|
Acceptable update field keys are
|
184
179
|
|
185
|
-
`:enabled`, `:name` and `:tags`
|
180
|
+
`:enabled`, `:name`, `:initial_failure_delay`, `:repeat_failure_delay` and `:tags`
|
186
181
|
|
187
182
|
Returns true if updating succeeded or false if updating failed.
|
188
183
|
|
@@ -195,10 +190,10 @@ Delete one or more checks.
|
|
195
190
|
|
196
191
|
```ruby
|
197
192
|
# delete one check
|
198
|
-
Flapjack::Diner.delete_checks(
|
193
|
+
Flapjack::Diner.delete_checks(UUID_STRING)
|
199
194
|
|
200
195
|
# delete multiple check
|
201
|
-
Flapjack::Diner.delete_checks(
|
196
|
+
Flapjack::Diner.delete_checks(UUID_STRING, UUID_STRING, ...)
|
202
197
|
```
|
203
198
|
|
204
199
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -219,13 +214,13 @@ Create one or more contacts.
|
|
219
214
|
Flapjack::Diner.create_contacts(CONTACT, ...)
|
220
215
|
```
|
221
216
|
|
222
|
-
```
|
223
|
-
CONTACT
|
217
|
+
```ruby
|
218
|
+
# CONTACT
|
224
219
|
{
|
225
|
-
:id =>
|
220
|
+
:id => UUID_STRING,
|
226
221
|
:name => STRING,
|
227
222
|
:timezone => STRING,
|
228
|
-
:tags => [
|
223
|
+
:tags => [UUID_STRING, ...]
|
229
224
|
}
|
230
225
|
```
|
231
226
|
|
@@ -239,8 +234,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
239
234
|
Return data for one, some or all contacts.
|
240
235
|
|
241
236
|
```ruby
|
242
|
-
contact = Flapjack::Diner.contacts(
|
243
|
-
some_contacts = Flapjack::Diner.contacts(
|
237
|
+
contact = Flapjack::Diner.contacts(UUID_STRING)
|
238
|
+
some_contacts = Flapjack::Diner.contacts(UUID_STRING, UUID_STRING, ...)
|
244
239
|
first_page_of_contacts = Flapjack::Diner.contacts
|
245
240
|
```
|
246
241
|
|
@@ -253,10 +248,10 @@ Update data for one or more contacts.
|
|
253
248
|
|
254
249
|
```ruby
|
255
250
|
# update values for one contact
|
256
|
-
Flapjack::Diner.update_contacts(
|
251
|
+
Flapjack::Diner.update_contacts(UUID_STRING, KEY => VALUE, ...)
|
257
252
|
|
258
253
|
# update values for multiple contacts
|
259
|
-
Flapjack::Diner.update_contacts({
|
254
|
+
Flapjack::Diner.update_contacts({UUID_STRING, KEY => VALUE, ...}, {UUID_STRING, KEY => VALUE, ...})
|
260
255
|
```
|
261
256
|
|
262
257
|
Acceptable update field keys are
|
@@ -274,10 +269,10 @@ Delete one or more contacts.
|
|
274
269
|
|
275
270
|
```ruby
|
276
271
|
# delete one contact
|
277
|
-
Flapjack::Diner.delete_contacts(
|
272
|
+
Flapjack::Diner.delete_contacts(UUID_STRING)
|
278
273
|
|
279
274
|
# delete multiple contacts
|
280
|
-
Flapjack::Diner.delete_contacts(
|
275
|
+
Flapjack::Diner.delete_contacts(UUID_STRING, UUID_STRING, ...)
|
281
276
|
```
|
282
277
|
|
283
278
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -301,7 +296,7 @@ Flapjack::Diner.create_media(MEDIUM, MEDIUM, ...)
|
|
301
296
|
```ruby
|
302
297
|
# MEDIUM
|
303
298
|
{
|
304
|
-
:id =>
|
299
|
+
:id => UUID_STRING,
|
305
300
|
:transport => STRING, # required
|
306
301
|
:address => STRING, # required (context depends on transport)
|
307
302
|
:interval => INTEGER, # required (if transport != 'pagerduty')
|
@@ -309,9 +304,8 @@ Flapjack::Diner.create_media(MEDIUM, MEDIUM, ...)
|
|
309
304
|
:pagerduty_subdomain => STRING, # required (if transport == 'pagerduty')
|
310
305
|
:pagerduty_token => STRING, # required (if transport == 'pagerduty')
|
311
306
|
:pagerduty_ack_duration => INTEGER, # required (if transport == 'pagerduty')
|
312
|
-
:contact =>
|
313
|
-
:
|
314
|
-
:rejectors => [REJECTOR_ID, REJECTOR_ID, ...]
|
307
|
+
:contact => UUID_STRING, # required
|
308
|
+
:rules => [UUID_STRING, UUID_STRING, ...]
|
315
309
|
}
|
316
310
|
```
|
317
311
|
|
@@ -325,8 +319,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
325
319
|
Return data for one, some or all notification media.
|
326
320
|
|
327
321
|
```ruby
|
328
|
-
medium = Flapjack::Diner.media(
|
329
|
-
some_media = Flapjack::Diner.media(
|
322
|
+
medium = Flapjack::Diner.media(UUID_STRING)
|
323
|
+
some_media = Flapjack::Diner.media(UUID_STRING, UUID_STRING, ...)
|
330
324
|
first_page_of_media = Flapjack::Diner.media
|
331
325
|
```
|
332
326
|
|
@@ -339,15 +333,15 @@ Update data for one or more notification media.
|
|
339
333
|
|
340
334
|
```ruby
|
341
335
|
# update values for one medium
|
342
|
-
Flapjack::Diner.update_media(
|
336
|
+
Flapjack::Diner.update_media(UUID_STRING, KEY => VALUE, ...)
|
343
337
|
|
344
338
|
# update values for multiple media
|
345
|
-
Flapjack::Diner.update_media({
|
339
|
+
Flapjack::Diner.update_media({UUID_STRING, KEY => VALUE, ...}, {UUID_STRING, KEY => VALUE, ...})
|
346
340
|
```
|
347
341
|
|
348
342
|
Acceptable update field keys are
|
349
343
|
|
350
|
-
`:address`, `:interval`, `:rollup_threshold`, `:pagerduty_subdomain`, `:pagerduty_token`, `:pagerduty_ack_duration
|
344
|
+
`:address`, `:interval`, `:rollup_threshold`, `:pagerduty_subdomain`, `:pagerduty_token`, `:pagerduty_ack_duration` and `:rules`
|
351
345
|
|
352
346
|
Returns true if updating succeeded or false if updating failed.
|
353
347
|
|
@@ -360,10 +354,10 @@ Delete one or more notification media.
|
|
360
354
|
|
361
355
|
```ruby
|
362
356
|
# delete one medium
|
363
|
-
Flapjack::Diner.delete_media(
|
357
|
+
Flapjack::Diner.delete_media(UUID_STRING)
|
364
358
|
|
365
359
|
# delete multiple media
|
366
|
-
Flapjack::Diner.delete_media(
|
360
|
+
Flapjack::Diner.delete_media(UUID_STRING, UUID_STRING, ...)
|
367
361
|
```
|
368
362
|
|
369
363
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -372,175 +366,90 @@ Returns true if deletion succeeded or false if deletion failed.
|
|
372
366
|
|
373
367
|
---
|
374
368
|
|
375
|
-
<a name="
|
376
|
-
###
|
369
|
+
<a name="section_rules"> </a>
|
370
|
+
### Rules [^](#contents_section_rules)
|
377
371
|
|
378
|
-
<a name="
|
379
|
-
####
|
372
|
+
<a name="create_rules"> </a>
|
373
|
+
#### create_rules
|
380
374
|
|
381
|
-
Create one or more notification
|
375
|
+
Create one or more notification rules.
|
382
376
|
|
383
377
|
```ruby
|
384
|
-
Flapjack::Diner.
|
378
|
+
Flapjack::Diner.create_rules(RULE, ...)
|
385
379
|
```
|
386
380
|
|
387
|
-
**FIXME** time_restrictions data structure isn't handled yet
|
388
|
-
|
389
381
|
```ruby
|
390
|
-
#
|
382
|
+
# RULE
|
391
383
|
{
|
392
|
-
:id
|
393
|
-
:name
|
394
|
-
:
|
395
|
-
:
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
:
|
384
|
+
:id => UUID_STRING,
|
385
|
+
:name => STRING,
|
386
|
+
:enabled => BOOLEAN,
|
387
|
+
:blackhole => BOOLEAN,
|
388
|
+
:strategy => STRING, # one of ['global', 'all_tags', 'any_tag', 'no_tag']
|
389
|
+
:conditions_list => STRING, # which conditions the rule will match;
|
390
|
+
# all if empty, or comma-separated subset
|
391
|
+
# of 'critical,warning,unknown'
|
392
|
+
:time_restriction_ical => STRING,
|
393
|
+
:contact => UUID_STRING, # required
|
394
|
+
:media => [UUID_STRING, ...]
|
395
|
+
:tags => [UUID_STRING, ...]
|
401
396
|
}
|
402
397
|
```
|
403
398
|
|
404
399
|
Returns false if creation failed, or the created object(s) if it succeeded.
|
405
400
|
|
406
|
-
[^](#
|
401
|
+
[^](#contents_create_rules)
|
407
402
|
|
408
|
-
<a name="
|
409
|
-
####
|
403
|
+
<a name="get_rules"> </a>
|
404
|
+
#### rules
|
410
405
|
|
411
|
-
Return data for one, some or all notification
|
406
|
+
Return data for one, some or all notification rules.
|
412
407
|
|
413
408
|
```ruby
|
414
|
-
|
415
|
-
|
416
|
-
|
409
|
+
rule = Flapjack::Diner.rules(UUID_STRING)
|
410
|
+
some_rules = Flapjack::Diner.rules(UUID_STRING, UUID_STRING, ...)
|
411
|
+
first_page_of_rules = Flapjack::Diner.rules
|
417
412
|
```
|
418
413
|
|
419
|
-
[^](#
|
414
|
+
[^](#contents_rules)
|
420
415
|
|
421
|
-
<a name="
|
422
|
-
####
|
416
|
+
<a name="update_rules"> </a>
|
417
|
+
#### update_rules
|
423
418
|
|
424
|
-
Update data for one or more notification
|
419
|
+
Update data for one or more notification rules.
|
425
420
|
|
426
421
|
```ruby
|
427
|
-
# update values for one
|
428
|
-
Flapjack::Diner.
|
422
|
+
# update values for one rule
|
423
|
+
Flapjack::Diner.update_rules(:id => UUID_STRING, KEY => VALUE, ...)
|
429
424
|
|
430
|
-
# update values for multiple
|
431
|
-
Flapjack::Diner.
|
425
|
+
# update values for multiple rules
|
426
|
+
Flapjack::Diner.update_rules({:id => UUID_STRING, KEY => VALUE, ...}, {:id => UUID_STRING, KEY => VALUE, ...})
|
432
427
|
```
|
433
428
|
|
434
429
|
Acceptable update field keys are
|
435
430
|
|
436
|
-
`:conditions_list`, `:
|
431
|
+
`:name`, `:enabled`, `:blackhole`, `:strategy`, `:conditions_list`, `:time_restrictiosn_ical`, `:media` and `:tags`
|
437
432
|
|
438
433
|
Returns true if updating succeeded or false if updating failed.
|
439
434
|
|
440
|
-
[^](#
|
435
|
+
[^](#contents_update_rules)
|
441
436
|
|
442
|
-
<a name="
|
443
|
-
####
|
437
|
+
<a name="delete_rules"> </a>
|
438
|
+
#### delete_rules
|
444
439
|
|
445
|
-
Delete one or more notification
|
440
|
+
Delete one or more notification rules.
|
446
441
|
|
447
442
|
```ruby
|
448
|
-
# delete one
|
449
|
-
Flapjack::Diner.
|
443
|
+
# delete one rule
|
444
|
+
Flapjack::Diner.delete_rules(UUID_STRING)
|
450
445
|
|
451
|
-
# delete multiple
|
452
|
-
Flapjack::Diner.
|
446
|
+
# delete multiple rules
|
447
|
+
Flapjack::Diner.delete_rules(UUID_STRING, UUID_STRING, ...)
|
453
448
|
```
|
454
449
|
|
455
450
|
Returns true if deletion succeeded or false if deletion failed.
|
456
451
|
|
457
|
-
[^](#
|
458
|
-
|
459
|
-
---
|
460
|
-
|
461
|
-
<a name="section_rejectors"> </a>
|
462
|
-
### Rules [^](#contents_section_rejectors)
|
463
|
-
|
464
|
-
<a name="create_rejectors"> </a>
|
465
|
-
#### create_rejectors
|
466
|
-
|
467
|
-
Create one or more notification rejectors.
|
468
|
-
|
469
|
-
```ruby
|
470
|
-
Flapjack::Diner.create_rejectors(REJECTOR, ...)
|
471
|
-
```
|
472
|
-
|
473
|
-
**FIXME** time_restrictions data structure isn't handled yet
|
474
|
-
|
475
|
-
```ruby
|
476
|
-
# REJECTOR
|
477
|
-
{
|
478
|
-
:id => UUID_STRING,
|
479
|
-
:name => STRING,
|
480
|
-
:all => BOOLEAN, # apply to all checks, ignore tag linkages
|
481
|
-
:conditions_list => STRING, # which conditions the rejector will match;
|
482
|
-
# all if empty, or comma-separated subset
|
483
|
-
# of 'critical,warning,unknown'
|
484
|
-
:contact => CONTACT_ID, # required
|
485
|
-
:media => [MEDIUM_ID, ...]
|
486
|
-
:tags => [TAG_NAME, ...]
|
487
|
-
}
|
488
|
-
```
|
489
|
-
|
490
|
-
Returns false if creation failed, or the created object(s) if it succeeded.
|
491
|
-
|
492
|
-
[^](#contents_create_rejectors)
|
493
|
-
|
494
|
-
<a name="get_rejectors"> </a>
|
495
|
-
#### rejectors
|
496
|
-
|
497
|
-
Return data for one, some or all notification rejectors.
|
498
|
-
|
499
|
-
```ruby
|
500
|
-
rejector = Flapjack::Diner.rejectors(REJECTOR_ID)
|
501
|
-
some_rejectors = Flapjack::Diner.rejectors(REJECTOR_ID, REJECTOR_ID, ...)
|
502
|
-
first_page_of_rejectors = Flapjack::Diner.rejectors
|
503
|
-
```
|
504
|
-
|
505
|
-
[^](#contents_rejectors)
|
506
|
-
|
507
|
-
<a name="update_rejectors"> </a>
|
508
|
-
#### update_rejectors
|
509
|
-
|
510
|
-
Update data for one or more notification rejectors.
|
511
|
-
|
512
|
-
```ruby
|
513
|
-
# update values for one rejector
|
514
|
-
Flapjack::Diner.update_rejectors(:id => REJECTOR_ID, KEY => VALUE, ...)
|
515
|
-
|
516
|
-
# update values for multiple rejectors
|
517
|
-
Flapjack::Diner.update_rejectors({:id => REJECTOR_ID, KEY => VALUE, ...}, {:id => REJECTOR_ID, KEY => VALUE, ...})
|
518
|
-
```
|
519
|
-
|
520
|
-
Acceptable update field keys are
|
521
|
-
|
522
|
-
`:conditions_list`, `:is_blackhole`, `:media` and `:tags`
|
523
|
-
|
524
|
-
Returns true if updating succeeded or false if updating failed.
|
525
|
-
|
526
|
-
[^](#contents_update_rejectors)
|
527
|
-
|
528
|
-
<a name="delete_rejectors"> </a>
|
529
|
-
#### delete_rejectors
|
530
|
-
|
531
|
-
Delete one or more notification rejectors.
|
532
|
-
|
533
|
-
```ruby
|
534
|
-
# delete one rejector
|
535
|
-
Flapjack::Diner.delete_rejectors(REJECTOR_ID)
|
536
|
-
|
537
|
-
# delete multiple rejectors
|
538
|
-
Flapjack::Diner.delete_rejectors(REJECTOR_ID, REJECTOR_ID, ...)
|
539
|
-
```
|
540
|
-
|
541
|
-
Returns true if deletion succeeded or false if deletion failed.
|
542
|
-
|
543
|
-
[^](#contents_delete_rejectors)
|
452
|
+
[^](#contents_delete_rules)
|
544
453
|
|
545
454
|
---
|
546
455
|
|
@@ -559,11 +468,11 @@ Flapjack::Diner.create_tags(TAG, ...)
|
|
559
468
|
```ruby
|
560
469
|
# TAG
|
561
470
|
{
|
471
|
+
:id => UUID_STRING,
|
562
472
|
:name => STRING, # required
|
563
|
-
:checks => [
|
564
|
-
:
|
565
|
-
:
|
566
|
-
}
|
473
|
+
:checks => [UUID_STRING, ...],
|
474
|
+
:contacts => [UUID_STRING, ...],
|
475
|
+
:rules => [UUID_STRING, ...]
|
567
476
|
```
|
568
477
|
|
569
478
|
Returns false if creation failed, or the created object(s) if it succeeded.
|
@@ -576,8 +485,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
576
485
|
Return data for one, some or all tags.
|
577
486
|
|
578
487
|
```ruby
|
579
|
-
tag = Flapjack::Diner.tags(
|
580
|
-
some_tags = Flapjack::Diner.tags(
|
488
|
+
tag = Flapjack::Diner.tags(UUID_STRING)
|
489
|
+
some_tags = Flapjack::Diner.tags(UUID_STRING, UUID_STRING, ...)
|
581
490
|
first_page_of_tags = Flapjack::Diner.tags
|
582
491
|
```
|
583
492
|
|
@@ -590,15 +499,15 @@ Update data for one or more tags.
|
|
590
499
|
|
591
500
|
```ruby
|
592
501
|
# update values for one tag
|
593
|
-
Flapjack::Diner.update_tags(:id =>
|
502
|
+
Flapjack::Diner.update_tags(:id => UUID_STRING, KEY => VALUE, ...)
|
594
503
|
|
595
504
|
# update values for multiple tags
|
596
|
-
Flapjack::Diner.update_tags({:id =>
|
505
|
+
Flapjack::Diner.update_tags({:id => UUID_STRING, KEY => VALUE, ...}, {:id => UUID_STRING, KEY => VALUE, ...})
|
597
506
|
```
|
598
507
|
|
599
508
|
Acceptable update field keys are
|
600
509
|
|
601
|
-
`:checks`, `:
|
510
|
+
`:checks`, `:contacts` and `:rules`
|
602
511
|
|
603
512
|
Returns true if updating succeeded or false if updating failed.
|
604
513
|
|
@@ -611,10 +520,10 @@ Delete one or more tags.
|
|
611
520
|
|
612
521
|
```ruby
|
613
522
|
# delete one tag
|
614
|
-
Flapjack::Diner.delete_tags(
|
523
|
+
Flapjack::Diner.delete_tags(UUID_STRING)
|
615
524
|
|
616
525
|
# delete multiple tags
|
617
|
-
Flapjack::Diner.delete_tags(
|
526
|
+
Flapjack::Diner.delete_tags(UUID_STRING, UUID_STRING, ...)
|
618
527
|
```
|
619
528
|
|
620
529
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -638,12 +547,12 @@ Flapjack::Diner.create_scheduled_maintenances(SCHEDULED_MAINTENANCE, ...)
|
|
638
547
|
```ruby
|
639
548
|
SCHEDULED_MAINTENANCE
|
640
549
|
{
|
641
|
-
:id =>
|
550
|
+
:id => UUID_STRING,
|
642
551
|
:start_time => DATETIME, # required
|
643
552
|
:end_time => DATETIME, # required
|
644
553
|
:summary => STRING,
|
645
|
-
:check =>
|
646
|
-
:tag =>
|
554
|
+
:check => UUID_STRING, # one (and only one) of :check or :tag must be provided
|
555
|
+
:tag => UUID_STRING # :tag will create scheduled maintenance periods for all checks that this tag is associated with
|
647
556
|
}
|
648
557
|
```
|
649
558
|
|
@@ -657,8 +566,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
657
566
|
Return data for one, some or all scheduled maintenance periods.
|
658
567
|
|
659
568
|
```ruby
|
660
|
-
scheduled_maintenance = Flapjack::Diner.scheduled_maintenances(
|
661
|
-
some_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances(
|
569
|
+
scheduled_maintenance = Flapjack::Diner.scheduled_maintenances(UUID_STRING)
|
570
|
+
some_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances(UUID_STRING, UUID_STRING, ...)
|
662
571
|
first_page_of_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances
|
663
572
|
```
|
664
573
|
|
@@ -671,10 +580,10 @@ Update data for one or more scheduled maintenance periods.
|
|
671
580
|
|
672
581
|
```ruby
|
673
582
|
# update values for one scheduled maintenance period
|
674
|
-
Flapjack::Diner.update_scheduled_maintenances(:id =>
|
583
|
+
Flapjack::Diner.update_scheduled_maintenances(:id => UUID_STRING, KEY => VALUE, ...)
|
675
584
|
|
676
585
|
# update values for multiple scheduled maintenance periods
|
677
|
-
Flapjack::Diner.update_scheduled_maintenances({:id =>
|
586
|
+
Flapjack::Diner.update_scheduled_maintenances({:id => UUID_STRING, KEY => VALUE, ...}, {:id => UUID_STRING, KEY => VALUE, ...})
|
678
587
|
```
|
679
588
|
|
680
589
|
Acceptable update field keys are
|
@@ -693,8 +602,8 @@ Returns true if updating succeeded or false if updating failed.
|
|
693
602
|
Delete one or more scheduled maintenance periods.
|
694
603
|
|
695
604
|
```ruby
|
696
|
-
Flapjack::Diner.delete_scheduled_maintenances(
|
697
|
-
Flapjack::Diner.delete_scheduled_maintenances(
|
605
|
+
Flapjack::Diner.delete_scheduled_maintenances(UUID_STRING)
|
606
|
+
Flapjack::Diner.delete_scheduled_maintenances(UUID_STRING, UUID_STRING, ...)
|
698
607
|
```
|
699
608
|
|
700
609
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -709,8 +618,8 @@ Returns true if deletion succeeded or false if deletion failed.
|
|
709
618
|
Return data for one, some or all unscheduled maintenance periods.
|
710
619
|
|
711
620
|
```ruby
|
712
|
-
unscheduled_maintenance = Flapjack::Diner.unscheduled_maintenances(
|
713
|
-
some_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances(
|
621
|
+
unscheduled_maintenance = Flapjack::Diner.unscheduled_maintenances(UUID_STRING)
|
622
|
+
some_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances(UUID_STRING, UUID_STRING, ...)
|
714
623
|
first_page_of_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances
|
715
624
|
```
|
716
625
|
|
@@ -722,10 +631,10 @@ first_page_of_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenance
|
|
722
631
|
Update data for one or more unscheduled maintenance periods.
|
723
632
|
|
724
633
|
```ruby
|
725
|
-
Flapjack::Diner.update_unscheduled_maintenances(:id =>
|
634
|
+
Flapjack::Diner.update_unscheduled_maintenances(:id => UUID_STRING, KEY => VALUE)
|
726
635
|
|
727
|
-
Flapjack::Diner.update_unscheduled_maintenances({:id =>
|
728
|
-
{:id =>
|
636
|
+
Flapjack::Diner.update_unscheduled_maintenances({:id => UUID_STRING, KEY => VALUE},
|
637
|
+
{:id => UUID_STRING, KEY => VALUE}, ...)
|
729
638
|
```
|
730
639
|
|
731
640
|
Acceptable update field keys are
|
@@ -744,8 +653,8 @@ Returns true if updating succeeded or false if updating failed.
|
|
744
653
|
Delete one or more unscheduled maintenance periods.
|
745
654
|
|
746
655
|
```ruby
|
747
|
-
Flapjack::Diner.delete_unscheduled_maintenances(
|
748
|
-
Flapjack::Diner.delete_unscheduled_maintenances(
|
656
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UUID_STRING)
|
657
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UUID_STRING, UUID_STRING, ...)
|
749
658
|
```
|
750
659
|
|
751
660
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -773,8 +682,8 @@ Flapjack::Diner.create_acknowledgements(ACKNOWLEDGEMENT, ...)
|
|
773
682
|
{
|
774
683
|
:summary => STRING,
|
775
684
|
:duration => INTEGER,
|
776
|
-
:check =>
|
777
|
-
:tag =>
|
685
|
+
:check => UUID_STRING, # one (and only one) of :check or :tag must be provided
|
686
|
+
:tag => UUID_STRING # :tag will acknowledge all failing checks that this tag is associated with
|
778
687
|
}
|
779
688
|
```
|
780
689
|
|
@@ -795,8 +704,9 @@ Flapjack::Diner.create_test_notifications(TEST_NOTIFICATION, ...)
|
|
795
704
|
# TEST_NOTIFICATION
|
796
705
|
{
|
797
706
|
:summary => STRING,
|
798
|
-
:
|
799
|
-
:
|
707
|
+
:condition => STRING,
|
708
|
+
:check => UUID_STRING, # one (and only one) of :check or :tag must be provided
|
709
|
+
:tag => UUID_STRING # :tag will send test notifications for all checks that this tag is associated with
|
800
710
|
}
|
801
711
|
```
|
802
712
|
|
@@ -815,8 +725,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
815
725
|
Return data for one, some or all check states.
|
816
726
|
|
817
727
|
```ruby
|
818
|
-
states = Flapjack::Diner.states(
|
819
|
-
some_states = Flapjack::Diner.states(
|
728
|
+
states = Flapjack::Diner.states(UUID_STRING)
|
729
|
+
some_states = Flapjack::Diner.states(UUID_STRING, UUID_STRING, ...)
|
820
730
|
first_page_of_states = Flapjack::Diner.states
|
821
731
|
```
|
822
732
|
|
@@ -839,8 +749,8 @@ metrics = Flapjack::Diner.metrics
|
|
839
749
|
Return data for one, some or all flapjack processor instances.
|
840
750
|
|
841
751
|
```ruby
|
842
|
-
statistics = Flapjack::Diner.statistics(
|
843
|
-
some_statistics = Flapjack::Diner.statistics(
|
752
|
+
statistics = Flapjack::Diner.statistics(UUID_STRING)
|
753
|
+
some_statistics = Flapjack::Diner.statistics(UUID_STRING, UUID_STRING, ...)
|
844
754
|
first_page_of_statistics = Flapjack::Diner.statistics
|
845
755
|
```
|
846
756
|
|
@@ -873,25 +783,21 @@ first_page_of_statistics = Flapjack::Diner.statistics
|
|
873
783
|
| `.checks` | 'current_unscheduled_maintenance' | 'unscheduled_maintenance' |
|
874
784
|
| `.checks` | 'latest_notifications' | ['state', ...] |
|
875
785
|
| `.checks` | 'tags' | ['tag', ...] |
|
876
|
-
| `.contacts` | 'acceptors' | ['acceptor', ...] |
|
877
786
|
| `.contacts` | 'checks' | ['check', ...] |
|
878
787
|
| `.contacts` | 'media' | ['medium', ...] |
|
879
|
-
| `.contacts` | '
|
880
|
-
| `.
|
788
|
+
| `.contacts` | 'rules' | ['rule', ...] |
|
789
|
+
| `.contacts` | 'tags' | ['tag', ...] |
|
881
790
|
| `.media` | 'alerting_checks' | ['check', ...] |
|
882
791
|
| `.media` | 'contact' | 'contact' |
|
883
|
-
| `.media` | '
|
884
|
-
| `.
|
885
|
-
| `.
|
886
|
-
| `.
|
887
|
-
| `.rejectors` | 'contact' | 'contact' |
|
888
|
-
| `.rejectors` | 'media' | ['medium', ...] |
|
889
|
-
| `.rejectors` | 'tags' | ['tag', ...] |
|
792
|
+
| `.media` | 'rules' | ['rule', ...] |
|
793
|
+
| `.rules` | 'contact' | 'contact' |
|
794
|
+
| `.rules` | 'media' | ['medium', ...] |
|
795
|
+
| `.rules` | 'tags' | ['tag', ...] |
|
890
796
|
| `.scheduled_maintenances` | 'check' | 'check' |
|
891
797
|
| `.states` | 'check' | 'check' |
|
892
|
-
| `.tags` | 'acceptors' | ['acceptor', ...] |
|
893
798
|
| `.tags` | 'checks' | ['check', ...] |
|
894
|
-
| `.tags` | '
|
799
|
+
| `.tags` | 'contacts' | ['contact', ...] |
|
800
|
+
| `.tags` | 'rules' | ['rule', ...] |
|
895
801
|
| `.unscheduled_maintenances` | 'check' | 'check' |
|
896
802
|
|
897
803
|
NB: these may be chained, as long as they follow the allowed paths above; e.g.
|
@@ -933,32 +839,27 @@ check_link_states(check_id, opts = {})
|
|
933
839
|
check_link_tags(check_id, opts = {})
|
934
840
|
check_link_unscheduled_maintenances(check_id, opts = {})
|
935
841
|
|
936
|
-
contact_link_acceptors(contact_id, opts = {})
|
937
842
|
contact_link_checks(contact_id, opts = {})
|
938
843
|
contact_link_media(contact_id, opts = {})
|
939
|
-
|
844
|
+
contact_link_rules(contact_id, opts = {})
|
845
|
+
contact_link_tags(contact_id, opts = {})
|
940
846
|
|
941
|
-
medium_link_acceptors(medium_id, opts = {})
|
942
847
|
medium_link_alerting_checks(medium_id, opts = {})
|
943
848
|
medium_link_contact(medium_id, opts = {})
|
944
|
-
|
849
|
+
medium_link_rules(medium_id, opts = {})
|
945
850
|
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
rejector_link_contact(rejector_id, opts = {})
|
951
|
-
rejector_link_media(rejector_id, opts = {})
|
952
|
-
rejector_link_tags(rejector_id, opts = {})
|
851
|
+
rule_link_contact(rule_id, opts = {})
|
852
|
+
rule_link_media(rule_id, opts = {})
|
853
|
+
rule_link_tags(rule_id, opts = {})
|
953
854
|
|
954
855
|
state_link_check(state_id, opts = {})
|
955
856
|
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
tag_link_scheduled_maintenances(
|
960
|
-
tag_link_states(
|
961
|
-
tag_link_unscheduled_maintenances(
|
857
|
+
tag_link_checks(tag_id, opts = {})
|
858
|
+
tag_link_contacts(tag_id, opts = {})
|
859
|
+
tag_link_rules(tag_id, opts = {})
|
860
|
+
tag_link_scheduled_maintenances(tag_id, opts = {})
|
861
|
+
tag_link_states(tag_id, opts = {})
|
862
|
+
tag_link_unscheduled_maintenances(tag_id, opts = {})
|
962
863
|
```
|
963
864
|
|
964
865
|
All returned results are paginated, and the [common options for GET requests](#common_options_get) apply here too.
|
@@ -966,48 +867,40 @@ All returned results are paginated, and the [common options for GET requests](#c
|
|
966
867
|
<a name="object_relationships_write"> </a>
|
967
868
|
### Manipulating object relationships
|
968
869
|
|
969
|
-
The following operations are supported; please note that some associations (e.g. associating an
|
870
|
+
The following operations are supported; please note that some associations (e.g. associating an rule with a contact) must be made on object creation, via the secondary resource's create method, and cannot be altered later.
|
970
871
|
|
971
872
|
```
|
972
|
-
create_check_link_tags(check_id, *
|
973
|
-
update_check_link_tags(check_id, *
|
974
|
-
delete_check_link_tags(check_id, *
|
975
|
-
|
976
|
-
create_medium_link_acceptors(medium_id, *acceptors_ids)
|
977
|
-
update_medium_link_acceptors(medium_id, *acceptors_ids)
|
978
|
-
delete_medium_link_acceptors(medium_id, *acceptors_ids)
|
979
|
-
|
980
|
-
create_medium_link_rejectors(medium_id, *rejectors_ids)
|
981
|
-
update_medium_link_rejectors(medium_id, *rejectors_ids)
|
982
|
-
delete_medium_link_rejectors(medium_id, *rejectors_ids)
|
873
|
+
create_check_link_tags(check_id, *tags_ids)
|
874
|
+
update_check_link_tags(check_id, *tags_ids)
|
875
|
+
delete_check_link_tags(check_id, *tags_ids)
|
983
876
|
|
984
|
-
|
985
|
-
|
986
|
-
|
877
|
+
create_contact_link_tags(contact_id, *tags_ids)
|
878
|
+
update_contact_link_tags(contact_id, *tags_ids)
|
879
|
+
delete_contact_link_tags(contact_id, *tags_ids)
|
987
880
|
|
988
|
-
|
989
|
-
|
990
|
-
|
881
|
+
create_medium_link_rules(medium_id, *rules_ids)
|
882
|
+
update_medium_link_rules(medium_id, *rules_ids)
|
883
|
+
delete_medium_link_rules(medium_id, *rules_ids)
|
991
884
|
|
992
|
-
|
993
|
-
|
994
|
-
|
885
|
+
create_rule_link_media(rule_id, *media_ids)
|
886
|
+
update_rule_link_media(rule_id, *media_ids)
|
887
|
+
delete_rule_link_media(rule_id, *media_ids)
|
995
888
|
|
996
|
-
|
997
|
-
|
998
|
-
|
889
|
+
create_rule_link_tags(rule_id, *tags_ids)
|
890
|
+
update_rule_link_tags(rule_id, *tags_ids)
|
891
|
+
delete_rule_link_tags(rule_id, *tags_ids)
|
999
892
|
|
1000
|
-
create_tag_link_checks(
|
1001
|
-
update_tag_link_checks(
|
1002
|
-
delete_tag_link_checks(
|
893
|
+
create_tag_link_checks(tag_id, *checks_ids)
|
894
|
+
update_tag_link_checks(tag_id, *checks_ids)
|
895
|
+
delete_tag_link_checks(tag_id, *checks_ids)
|
1003
896
|
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
897
|
+
create_tag_link_contacts(tag_id, *contacts_ids)
|
898
|
+
update_tag_link_contacts(tag_id, *contacts_ids)
|
899
|
+
delete_tag_link_contacts(tag_id, *contacts_ids)
|
1007
900
|
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
901
|
+
create_tag_link_rules(tag_id, *rules_ids)
|
902
|
+
update_tag_link_rules(tag_id, *rules_ids)
|
903
|
+
delete_tag_link_rules(tag_id, *rules_ids)
|
1011
904
|
```
|
1012
905
|
|
1013
906
|
<a name="object_relationships_write_create"> </a>
|