flapjack-diner 2.0.0.a4 → 2.0.0b1
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 +5 -10
- data/README.md +162 -282
- data/lib/flapjack-diner/configuration.rb +17 -9
- data/lib/flapjack-diner/version.rb +1 -1
- data/spec/support/fixture_data.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ce62bf38cc938f3b7f88f30ba160950e3e5cd1c
|
4
|
+
data.tar.gz: 0490002709d57e4d15b6d3ca7e71c13381177c40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48f6e46083c60efbd5f0b644270123aecd49d384ea73bc04200e081c906532774f6de9635fb58a5992ee6bb8eb93716e91603a5ae6a50368fd3bc3376e2e21be
|
7
|
+
data.tar.gz: 40a15fc6103dd47ec15aac237d983b44f8ec0ce38e4f8a184acd8de0930fa7b146b0a84c1ca20b49708ce95689600e82517516e98974df1e847aa99a34d6c490
|
data/.travis.yml
CHANGED
@@ -5,17 +5,12 @@ rvm:
|
|
5
5
|
- '2.1'
|
6
6
|
- '2.2'
|
7
7
|
cache: bundler
|
8
|
-
script:
|
8
|
+
script: bundle exec rspec
|
9
9
|
notifications:
|
10
10
|
irc:
|
11
11
|
channels:
|
12
|
-
|
12
|
+
- irc.freenode.net#flapjack
|
13
13
|
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=
|
14
|
+
- "%{message} %{repository}#%{build_number} (%{branch} - %{commit} : %{author})"
|
15
|
+
slack:
|
16
|
+
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,12 +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
|
-
:contacts => [
|
565
|
-
:
|
566
|
-
:rejectors => [REJECTOR_ID, ...]
|
567
|
-
}
|
473
|
+
:checks => [UUID_STRING, ...],
|
474
|
+
:contacts => [UUID_STRING, ...],
|
475
|
+
:rules => [UUID_STRING, ...]
|
568
476
|
```
|
569
477
|
|
570
478
|
Returns false if creation failed, or the created object(s) if it succeeded.
|
@@ -577,8 +485,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
577
485
|
Return data for one, some or all tags.
|
578
486
|
|
579
487
|
```ruby
|
580
|
-
tag = Flapjack::Diner.tags(
|
581
|
-
some_tags = Flapjack::Diner.tags(
|
488
|
+
tag = Flapjack::Diner.tags(UUID_STRING)
|
489
|
+
some_tags = Flapjack::Diner.tags(UUID_STRING, UUID_STRING, ...)
|
582
490
|
first_page_of_tags = Flapjack::Diner.tags
|
583
491
|
```
|
584
492
|
|
@@ -591,15 +499,15 @@ Update data for one or more tags.
|
|
591
499
|
|
592
500
|
```ruby
|
593
501
|
# update values for one tag
|
594
|
-
Flapjack::Diner.update_tags(:id =>
|
502
|
+
Flapjack::Diner.update_tags(:id => UUID_STRING, KEY => VALUE, ...)
|
595
503
|
|
596
504
|
# update values for multiple tags
|
597
|
-
Flapjack::Diner.update_tags({:id =>
|
505
|
+
Flapjack::Diner.update_tags({:id => UUID_STRING, KEY => VALUE, ...}, {:id => UUID_STRING, KEY => VALUE, ...})
|
598
506
|
```
|
599
507
|
|
600
508
|
Acceptable update field keys are
|
601
509
|
|
602
|
-
`:checks`, `:contacts
|
510
|
+
`:checks`, `:contacts` and `:rules`
|
603
511
|
|
604
512
|
Returns true if updating succeeded or false if updating failed.
|
605
513
|
|
@@ -612,10 +520,10 @@ Delete one or more tags.
|
|
612
520
|
|
613
521
|
```ruby
|
614
522
|
# delete one tag
|
615
|
-
Flapjack::Diner.delete_tags(
|
523
|
+
Flapjack::Diner.delete_tags(UUID_STRING)
|
616
524
|
|
617
525
|
# delete multiple tags
|
618
|
-
Flapjack::Diner.delete_tags(
|
526
|
+
Flapjack::Diner.delete_tags(UUID_STRING, UUID_STRING, ...)
|
619
527
|
```
|
620
528
|
|
621
529
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -639,12 +547,12 @@ Flapjack::Diner.create_scheduled_maintenances(SCHEDULED_MAINTENANCE, ...)
|
|
639
547
|
```ruby
|
640
548
|
SCHEDULED_MAINTENANCE
|
641
549
|
{
|
642
|
-
:id =>
|
550
|
+
:id => UUID_STRING,
|
643
551
|
:start_time => DATETIME, # required
|
644
552
|
:end_time => DATETIME, # required
|
645
553
|
:summary => STRING,
|
646
|
-
:check =>
|
647
|
-
: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
|
648
556
|
}
|
649
557
|
```
|
650
558
|
|
@@ -658,8 +566,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
658
566
|
Return data for one, some or all scheduled maintenance periods.
|
659
567
|
|
660
568
|
```ruby
|
661
|
-
scheduled_maintenance = Flapjack::Diner.scheduled_maintenances(
|
662
|
-
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, ...)
|
663
571
|
first_page_of_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances
|
664
572
|
```
|
665
573
|
|
@@ -672,10 +580,10 @@ Update data for one or more scheduled maintenance periods.
|
|
672
580
|
|
673
581
|
```ruby
|
674
582
|
# update values for one scheduled maintenance period
|
675
|
-
Flapjack::Diner.update_scheduled_maintenances(:id =>
|
583
|
+
Flapjack::Diner.update_scheduled_maintenances(:id => UUID_STRING, KEY => VALUE, ...)
|
676
584
|
|
677
585
|
# update values for multiple scheduled maintenance periods
|
678
|
-
Flapjack::Diner.update_scheduled_maintenances({:id =>
|
586
|
+
Flapjack::Diner.update_scheduled_maintenances({:id => UUID_STRING, KEY => VALUE, ...}, {:id => UUID_STRING, KEY => VALUE, ...})
|
679
587
|
```
|
680
588
|
|
681
589
|
Acceptable update field keys are
|
@@ -694,8 +602,8 @@ Returns true if updating succeeded or false if updating failed.
|
|
694
602
|
Delete one or more scheduled maintenance periods.
|
695
603
|
|
696
604
|
```ruby
|
697
|
-
Flapjack::Diner.delete_scheduled_maintenances(
|
698
|
-
Flapjack::Diner.delete_scheduled_maintenances(
|
605
|
+
Flapjack::Diner.delete_scheduled_maintenances(UUID_STRING)
|
606
|
+
Flapjack::Diner.delete_scheduled_maintenances(UUID_STRING, UUID_STRING, ...)
|
699
607
|
```
|
700
608
|
|
701
609
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -710,8 +618,8 @@ Returns true if deletion succeeded or false if deletion failed.
|
|
710
618
|
Return data for one, some or all unscheduled maintenance periods.
|
711
619
|
|
712
620
|
```ruby
|
713
|
-
unscheduled_maintenance = Flapjack::Diner.unscheduled_maintenances(
|
714
|
-
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, ...)
|
715
623
|
first_page_of_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances
|
716
624
|
```
|
717
625
|
|
@@ -723,10 +631,10 @@ first_page_of_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenance
|
|
723
631
|
Update data for one or more unscheduled maintenance periods.
|
724
632
|
|
725
633
|
```ruby
|
726
|
-
Flapjack::Diner.update_unscheduled_maintenances(:id =>
|
634
|
+
Flapjack::Diner.update_unscheduled_maintenances(:id => UUID_STRING, KEY => VALUE)
|
727
635
|
|
728
|
-
Flapjack::Diner.update_unscheduled_maintenances({:id =>
|
729
|
-
{:id =>
|
636
|
+
Flapjack::Diner.update_unscheduled_maintenances({:id => UUID_STRING, KEY => VALUE},
|
637
|
+
{:id => UUID_STRING, KEY => VALUE}, ...)
|
730
638
|
```
|
731
639
|
|
732
640
|
Acceptable update field keys are
|
@@ -745,8 +653,8 @@ Returns true if updating succeeded or false if updating failed.
|
|
745
653
|
Delete one or more unscheduled maintenance periods.
|
746
654
|
|
747
655
|
```ruby
|
748
|
-
Flapjack::Diner.delete_unscheduled_maintenances(
|
749
|
-
Flapjack::Diner.delete_unscheduled_maintenances(
|
656
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UUID_STRING)
|
657
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UUID_STRING, UUID_STRING, ...)
|
750
658
|
```
|
751
659
|
|
752
660
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -774,8 +682,8 @@ Flapjack::Diner.create_acknowledgements(ACKNOWLEDGEMENT, ...)
|
|
774
682
|
{
|
775
683
|
:summary => STRING,
|
776
684
|
:duration => INTEGER,
|
777
|
-
:check =>
|
778
|
-
: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
|
779
687
|
}
|
780
688
|
```
|
781
689
|
|
@@ -796,8 +704,9 @@ Flapjack::Diner.create_test_notifications(TEST_NOTIFICATION, ...)
|
|
796
704
|
# TEST_NOTIFICATION
|
797
705
|
{
|
798
706
|
:summary => STRING,
|
799
|
-
:
|
800
|
-
:
|
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
|
801
710
|
}
|
802
711
|
```
|
803
712
|
|
@@ -816,8 +725,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
816
725
|
Return data for one, some or all check states.
|
817
726
|
|
818
727
|
```ruby
|
819
|
-
states = Flapjack::Diner.states(
|
820
|
-
some_states = Flapjack::Diner.states(
|
728
|
+
states = Flapjack::Diner.states(UUID_STRING)
|
729
|
+
some_states = Flapjack::Diner.states(UUID_STRING, UUID_STRING, ...)
|
821
730
|
first_page_of_states = Flapjack::Diner.states
|
822
731
|
```
|
823
732
|
|
@@ -840,8 +749,8 @@ metrics = Flapjack::Diner.metrics
|
|
840
749
|
Return data for one, some or all flapjack processor instances.
|
841
750
|
|
842
751
|
```ruby
|
843
|
-
statistics = Flapjack::Diner.statistics(
|
844
|
-
some_statistics = Flapjack::Diner.statistics(
|
752
|
+
statistics = Flapjack::Diner.statistics(UUID_STRING)
|
753
|
+
some_statistics = Flapjack::Diner.statistics(UUID_STRING, UUID_STRING, ...)
|
845
754
|
first_page_of_statistics = Flapjack::Diner.statistics
|
846
755
|
```
|
847
756
|
|
@@ -874,27 +783,21 @@ first_page_of_statistics = Flapjack::Diner.statistics
|
|
874
783
|
| `.checks` | 'current_unscheduled_maintenance' | 'unscheduled_maintenance' |
|
875
784
|
| `.checks` | 'latest_notifications' | ['state', ...] |
|
876
785
|
| `.checks` | 'tags' | ['tag', ...] |
|
877
|
-
| `.contacts` | 'acceptors' | ['acceptor', ...] |
|
878
786
|
| `.contacts` | 'checks' | ['check', ...] |
|
879
787
|
| `.contacts` | 'media' | ['medium', ...] |
|
880
|
-
| `.contacts` | '
|
788
|
+
| `.contacts` | 'rules' | ['rule', ...] |
|
881
789
|
| `.contacts` | 'tags' | ['tag', ...] |
|
882
|
-
| `.media` | 'acceptors' | ['acceptor', ...] |
|
883
790
|
| `.media` | 'alerting_checks' | ['check', ...] |
|
884
791
|
| `.media` | 'contact' | 'contact' |
|
885
|
-
| `.media` | '
|
886
|
-
| `.
|
887
|
-
| `.
|
888
|
-
| `.
|
889
|
-
| `.rejectors` | 'contact' | 'contact' |
|
890
|
-
| `.rejectors` | 'media' | ['medium', ...] |
|
891
|
-
| `.rejectors` | 'tags' | ['tag', ...] |
|
792
|
+
| `.media` | 'rules' | ['rule', ...] |
|
793
|
+
| `.rules` | 'contact' | 'contact' |
|
794
|
+
| `.rules` | 'media' | ['medium', ...] |
|
795
|
+
| `.rules` | 'tags' | ['tag', ...] |
|
892
796
|
| `.scheduled_maintenances` | 'check' | 'check' |
|
893
797
|
| `.states` | 'check' | 'check' |
|
894
|
-
| `.tags` | 'acceptors' | ['acceptor', ...] |
|
895
798
|
| `.tags` | 'checks' | ['check', ...] |
|
896
799
|
| `.tags` | 'contacts' | ['contact', ...] |
|
897
|
-
| `.tags` | '
|
800
|
+
| `.tags` | 'rules' | ['rule', ...] |
|
898
801
|
| `.unscheduled_maintenances` | 'check' | 'check' |
|
899
802
|
|
900
803
|
NB: these may be chained, as long as they follow the allowed paths above; e.g.
|
@@ -936,34 +839,27 @@ check_link_states(check_id, opts = {})
|
|
936
839
|
check_link_tags(check_id, opts = {})
|
937
840
|
check_link_unscheduled_maintenances(check_id, opts = {})
|
938
841
|
|
939
|
-
contact_link_acceptors(contact_id, opts = {})
|
940
842
|
contact_link_checks(contact_id, opts = {})
|
941
843
|
contact_link_media(contact_id, opts = {})
|
942
|
-
|
844
|
+
contact_link_rules(contact_id, opts = {})
|
943
845
|
contact_link_tags(contact_id, opts = {})
|
944
846
|
|
945
|
-
medium_link_acceptors(medium_id, opts = {})
|
946
847
|
medium_link_alerting_checks(medium_id, opts = {})
|
947
848
|
medium_link_contact(medium_id, opts = {})
|
948
|
-
|
949
|
-
|
950
|
-
acceptor_link_contact(acceptor_id, opts = {})
|
951
|
-
acceptor_link_media(acceptor_id, opts = {})
|
952
|
-
acceptor_link_tags(acceptor_id, opts = {})
|
849
|
+
medium_link_rules(medium_id, opts = {})
|
953
850
|
|
954
|
-
|
955
|
-
|
956
|
-
|
851
|
+
rule_link_contact(rule_id, opts = {})
|
852
|
+
rule_link_media(rule_id, opts = {})
|
853
|
+
rule_link_tags(rule_id, opts = {})
|
957
854
|
|
958
855
|
state_link_check(state_id, opts = {})
|
959
856
|
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
tag_link_unscheduled_maintenances(tag_name, opts = {})
|
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 = {})
|
967
863
|
```
|
968
864
|
|
969
865
|
All returned results are paginated, and the [common options for GET requests](#common_options_get) apply here too.
|
@@ -971,56 +867,40 @@ All returned results are paginated, and the [common options for GET requests](#c
|
|
971
867
|
<a name="object_relationships_write"> </a>
|
972
868
|
### Manipulating object relationships
|
973
869
|
|
974
|
-
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.
|
975
871
|
|
976
872
|
```
|
977
|
-
create_check_link_tags(check_id, *
|
978
|
-
update_check_link_tags(check_id, *
|
979
|
-
delete_check_link_tags(check_id, *
|
980
|
-
|
981
|
-
create_contact_link_tags(contact_id, *tags_names)
|
982
|
-
update_contact_link_tags(contact_id, *tags_names)
|
983
|
-
delete_contact_link_tags(contact_id, *tags_names)
|
984
|
-
|
985
|
-
create_medium_link_acceptors(medium_id, *acceptors_ids)
|
986
|
-
update_medium_link_acceptors(medium_id, *acceptors_ids)
|
987
|
-
delete_medium_link_acceptors(medium_id, *acceptors_ids)
|
988
|
-
|
989
|
-
create_medium_link_rejectors(medium_id, *rejectors_ids)
|
990
|
-
update_medium_link_rejectors(medium_id, *rejectors_ids)
|
991
|
-
delete_medium_link_rejectors(medium_id, *rejectors_ids)
|
992
|
-
|
993
|
-
create_acceptor_link_media(acceptor_id, *media_ids)
|
994
|
-
update_acceptor_link_media(acceptor_id, *media_ids)
|
995
|
-
delete_acceptor_link_media(acceptor_id, *media_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)
|
996
876
|
|
997
|
-
|
998
|
-
|
999
|
-
|
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)
|
1000
880
|
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
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)
|
1004
884
|
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
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)
|
1008
888
|
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
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)
|
1012
892
|
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
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)
|
1016
896
|
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
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)
|
1020
900
|
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
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)
|
1024
904
|
```
|
1025
905
|
|
1026
906
|
<a name="object_relationships_write_create"> </a>
|
@@ -49,17 +49,23 @@ module Flapjack
|
|
49
49
|
:resource => 'check',
|
50
50
|
:requests => {
|
51
51
|
:post => {
|
52
|
-
:id
|
53
|
-
:name
|
54
|
-
:enabled
|
55
|
-
:
|
52
|
+
:id => :uuid,
|
53
|
+
:name => [:required, :non_empty_string],
|
54
|
+
:enabled => :boolean,
|
55
|
+
:initial_failure_delay => :positive_integer,
|
56
|
+
:repeat_failure_delay => :positive_integer,
|
57
|
+
# :initial_recovery_delay => :positive_integer,
|
58
|
+
:tags => :multiple_link_uuid
|
56
59
|
},
|
57
60
|
:get => RESOURCES_GET,
|
58
61
|
:patch => {
|
59
|
-
:id
|
60
|
-
:name
|
61
|
-
:enabled
|
62
|
-
:
|
62
|
+
:id => [:required, :uuid],
|
63
|
+
:name => :non_empty_string,
|
64
|
+
:enabled => :boolean,
|
65
|
+
:initial_failure_delay => :positive_integer,
|
66
|
+
:repeat_failure_delay => :positive_integer,
|
67
|
+
# :initial_recovery_delay => :positive_integer,
|
68
|
+
:tags => :multiple_link_uuid
|
63
69
|
},
|
64
70
|
:delete => {}
|
65
71
|
},
|
@@ -129,7 +135,8 @@ module Flapjack
|
|
129
135
|
:get => RESOURCES_GET,
|
130
136
|
:patch => {
|
131
137
|
:id => [:required, :uuid],
|
132
|
-
[:name, :timezone] => :non_empty_string
|
138
|
+
[:name, :timezone] => :non_empty_string,
|
139
|
+
:tags => :multiple_link_uuid
|
133
140
|
},
|
134
141
|
:delete => {}
|
135
142
|
},
|
@@ -365,6 +372,7 @@ module Flapjack
|
|
365
372
|
:requests => {
|
366
373
|
:post => {
|
367
374
|
:summary => :non_empty_string,
|
375
|
+
:condition => :non_empty_string,
|
368
376
|
[:check, :tag] => :singular_link_uuid
|
369
377
|
}
|
370
378
|
},
|
@@ -44,7 +44,9 @@ module FixtureData
|
|
44
44
|
@check_data ||= {
|
45
45
|
:id => '1ed80833-6d28-4aba-8603-d81c249b8c23',
|
46
46
|
:name => 'www.example.com:SSH',
|
47
|
-
:enabled => true
|
47
|
+
:enabled => true,
|
48
|
+
:initial_failure_delay => nil,
|
49
|
+
:repeat_failure_delay => nil
|
48
50
|
}
|
49
51
|
end
|
50
52
|
|
@@ -52,7 +54,9 @@ module FixtureData
|
|
52
54
|
@check_2_data ||= {
|
53
55
|
:id => '29e913cf-29ea-4ae5-94f6-7069cf4a1514',
|
54
56
|
:name => 'www2.example.com:PING',
|
55
|
-
:enabled => true
|
57
|
+
:enabled => true,
|
58
|
+
:initial_failure_delay => nil,
|
59
|
+
:repeat_failure_delay => nil
|
56
60
|
}
|
57
61
|
end
|
58
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flapjack-diner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.0b1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Graham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|