flapjack-diner 2.0.0.pre.alpha.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -10
  3. data/README.md +165 -272
  4. data/flapjack-diner.gemspec +1 -1
  5. data/lib/flapjack-diner.rb +54 -25
  6. data/lib/flapjack-diner/argument_validator.rb +0 -17
  7. data/lib/flapjack-diner/configuration.rb +417 -0
  8. data/lib/flapjack-diner/log_formatter.rb +22 -0
  9. data/lib/flapjack-diner/query.rb +114 -0
  10. data/lib/flapjack-diner/relationships.rb +180 -0
  11. data/lib/flapjack-diner/request.rb +280 -0
  12. data/lib/flapjack-diner/resources.rb +64 -0
  13. data/lib/flapjack-diner/response.rb +91 -0
  14. data/lib/flapjack-diner/tools.rb +46 -456
  15. data/lib/flapjack-diner/utility.rb +16 -0
  16. data/lib/flapjack-diner/version.rb +1 -1
  17. data/spec/flapjack-diner_spec.rb +9 -18
  18. data/spec/{resources/relationships_spec.rb → relationships_spec.rb} +75 -29
  19. data/spec/resources/checks_spec.rb +7 -7
  20. data/spec/resources/contacts_spec.rb +21 -19
  21. data/spec/resources/events_spec.rb +13 -13
  22. data/spec/resources/maintenance_periods_spec.rb +3 -3
  23. data/spec/resources/media_spec.rb +3 -3
  24. data/spec/resources/metrics_spec.rb +1 -1
  25. data/spec/resources/rules_spec.rb +278 -0
  26. data/spec/resources/states_spec.rb +1 -1
  27. data/spec/resources/statistics_spec.rb +1 -1
  28. data/spec/resources/tags_spec.rb +75 -19
  29. data/spec/support/fixture_data.rb +57 -98
  30. metadata +21 -29
  31. data/.rubocop.yml +0 -21
  32. data/.rubocop_todo.yml +0 -135
  33. data/lib/flapjack-diner/resources/acceptors.rb +0 -77
  34. data/lib/flapjack-diner/resources/checks.rb +0 -52
  35. data/lib/flapjack-diner/resources/contacts.rb +0 -54
  36. data/lib/flapjack-diner/resources/events.rb +0 -54
  37. data/lib/flapjack-diner/resources/maintenance_periods.rb +0 -76
  38. data/lib/flapjack-diner/resources/media.rb +0 -75
  39. data/lib/flapjack-diner/resources/metrics.rb +0 -23
  40. data/lib/flapjack-diner/resources/rejectors.rb +0 -77
  41. data/lib/flapjack-diner/resources/relationships.rb +0 -314
  42. data/lib/flapjack-diner/resources/states.rb +0 -24
  43. data/lib/flapjack-diner/resources/statistics.rb +0 -24
  44. data/lib/flapjack-diner/resources/tags.rb +0 -47
  45. data/spec/resources/acceptors_spec.rb +0 -278
  46. data/spec/resources/rejectors_spec.rb +0 -278
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 599102638a3e2c603d40621b1a2ce0dfc90617e2
4
- data.tar.gz: 34d37da6991efd2358a854edb134c32e780abd08
3
+ metadata.gz: 72b89f956e1bc8d1eb623e24da91f1de80828ad6
4
+ data.tar.gz: 2418fe5e016a69ffb8355352351698a6a1289d72
5
5
  SHA512:
6
- metadata.gz: 75f53d41a4a2a7535e3462b5a1ae679337fe983fb2e15423ad64e9d041f94b7c2fd2b83f2a90bd09bc6e898a584468977757c72e92be15d87416569b28586c5f
7
- data.tar.gz: d53cd21dfbec4da23832197bc0b8f1bc5b7a20df927a7c5f9dc524b9486929ee178cfb9882fe474617349aba0fb227204a0cef053ab2bb9aefd017cdd208a709
6
+ metadata.gz: eb421813c0a6cd5be784e6007cd6e87914b169014fc0199ab00a6c1778e302e3e15948bdad5998af586110ba72fbe101d84a6a4f53e7c470d4f3347ab97801ae
7
+ data.tar.gz: b51e0afbeb9625e3e464b245683322022a7a7b9c2e2715677f7bd77fae885ccedf5565816957d9658468a2ace6fc03cb73a7a37ae59669109a3e577d64c63531
@@ -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: "bundle exec rspec"
9
+ script: bundle exec rspec
9
10
  notifications:
10
11
  irc:
11
12
  channels:
12
- - 'irc.freenode.net#flapjack'
13
+ - irc.freenode.net#flapjack
13
14
  template:
14
- - '%{message} %{repository}#%{build_number} (%{branch} - %{commit} : %{author})'
15
- hipchat:
16
- template:
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.0-alpha.3` 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).
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 wrt returning hashes with keys as strings (they're now symbols by default) then:
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 &emdash; One or more String or Integer values; or
59
- * Parameters &emdash; One or more Hashes
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">&nbsp;</a>[update_media](#update_media)
85
85
  * <a name="contents_delete_media">&nbsp;</a>[delete_media](#delete_media)
86
86
 
87
- ### <a name="contents_section_acceptors">&nbsp;</a>[Acceptors](#section_acceptors)
87
+ ### <a name="contents_section_rules">&nbsp;</a>[Rules](#section_rules)
88
88
 
89
- * <a name="contents_create_acceptors">&nbsp;</a>[create_acceptors](#create_acceptors)
90
- * <a name="contents_acceptors">&nbsp;</a>[acceptors](#get_acceptors)
91
- * <a name="contents_update_acceptors">&nbsp;</a>[update_acceptors](#update_acceptors)
92
- * <a name="contents_delete_acceptors">&nbsp;</a>[delete_acceptors](#delete_acceptors)
93
-
94
- ### <a name="contents_section_rejectors">&nbsp;</a>[Rejectors](#section_rejectors)
95
-
96
- * <a name="contents_create_rejectors">&nbsp;</a>[create_rejectors](#create_rejectors)
97
- * <a name="contents_rejectors">&nbsp;</a>[rejectors](#get_rejectors)
98
- * <a name="contents_update_rejectors">&nbsp;</a>[update_rejectors](#update_rejectors)
99
- * <a name="contents_delete_rejectors">&nbsp;</a>[delete_rejectors](#delete_rejectors)
89
+ * <a name="contents_create_rules">&nbsp;</a>[create_rules](#create_rules)
90
+ * <a name="contents_rules">&nbsp;</a>[rules](#get_rules)
91
+ * <a name="contents_update_rules">&nbsp;</a>[update_rules](#update_rules)
92
+ * <a name="contents_delete_rules">&nbsp;</a>[delete_rules](#delete_rules)
100
93
 
101
94
  ### <a name="contents_section_tags">&nbsp;</a>[Tags](#section_tags)
102
95
 
@@ -143,10 +136,12 @@ Flapjack::Diner.create_checks(CHECK, ...)
143
136
  ```
144
137
  CHECK
145
138
  {
146
- :id => STRING,
139
+ :id => UUID_STRING,
147
140
  :name => STRING,
148
141
  :enabled => BOOLEAN,
149
- :tags => [TAG_NAME, ...]
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(CHECK_ID)
164
- some_checks = Flapjack::Diner.checks(CHECK_ID, CHECK_ID, ...)
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(CHECK_ID, KEY => VALUE, ...)
172
+ Flapjack::Diner.update_checks(UUID_STRING, KEY => VALUE, ...)
178
173
 
179
174
  # update values for multiple checks
180
- Flapjack::Diner.update_checks({CHECK_ID, KEY => VALUE, ...}, {CHECK_ID, KEY => VALUE, ...})
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(CHECK_ID)
193
+ Flapjack::Diner.delete_checks(UUID_STRING)
199
194
 
200
195
  # delete multiple check
201
- Flapjack::Diner.delete_checks(CHECK_ID, CHECK_ID, ...)
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 => STRING,
220
+ :id => UUID_STRING,
226
221
  :name => STRING,
227
222
  :timezone => STRING,
228
- :tags => [TAG_NAME, ...]
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(CONTACT_ID)
243
- some_contacts = Flapjack::Diner.contacts(CONTACT_ID, CONTACT_ID, ...)
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(CONTACT_ID, KEY => VALUE, ...)
251
+ Flapjack::Diner.update_contacts(UUID_STRING, KEY => VALUE, ...)
257
252
 
258
253
  # update values for multiple contacts
259
- Flapjack::Diner.update_contacts({CONTACT_ID, KEY => VALUE, ...}, {CONTACT_ID, KEY => VALUE, ...})
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(CONTACT_ID)
272
+ Flapjack::Diner.delete_contacts(UUID_STRING)
278
273
 
279
274
  # delete multiple contacts
280
- Flapjack::Diner.delete_contacts(CONTACT_ID, CONTACT_ID, ...)
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 => UUID,
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 => CONTACT_ID, # required
313
- :acceptors => [ACCEPTOR_ID, ACCEPTOR_ID, ...],
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(MEDIUM_ID)
329
- some_media = Flapjack::Diner.media(MEDIUM_ID, MEDIUM_ID, ...)
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(MEDIUM_ID, KEY => VALUE, ...)
336
+ Flapjack::Diner.update_media(UUID_STRING, KEY => VALUE, ...)
343
337
 
344
338
  # update values for multiple media
345
- Flapjack::Diner.update_media({MEDIUM_ID, KEY => VALUE, ...}, {MEDIUM_ID, KEY => VALUE, ...})
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`, `:acceptors` and `:rejectors`
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(MEDIUM_ID)
357
+ Flapjack::Diner.delete_media(UUID_STRING)
364
358
 
365
359
  # delete multiple media
366
- Flapjack::Diner.delete_media(MEDIUM_ID, MEDIUM_ID, ...)
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="section_acceptors">&nbsp;</a>
376
- ### Acceptors [^](#contents_section_acceptors)
369
+ <a name="section_rules">&nbsp;</a>
370
+ ### Rules [^](#contents_section_rules)
377
371
 
378
- <a name="create_acceptors">&nbsp;</a>
379
- #### create_acceptors
372
+ <a name="create_rules">&nbsp;</a>
373
+ #### create_rules
380
374
 
381
- Create one or more notification acceptors.
375
+ Create one or more notification rules.
382
376
 
383
377
  ```ruby
384
- Flapjack::Diner.create_acceptors(ACCEPTOR, ...)
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
- # ACCEPTOR
382
+ # RULE
391
383
  {
392
- :id => UUID_STRING,
393
- :name => STRING,
394
- :all => BOOLEAN, # apply to all checks, ignore tag linkages
395
- :conditions_list => STRING, # which conditions the acceptor will match;
396
- # all if empty, or comma-separated subset
397
- # of 'critical,warning,unknown'
398
- :contact => CONTACT_ID, # required
399
- :media => [MEDIUM_ID, ...]
400
- :tags => [TAG_NAME, ...]
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
- [^](#contents_create_acceptors)
401
+ [^](#contents_create_rules)
407
402
 
408
- <a name="get_acceptors">&nbsp;</a>
409
- #### acceptors
403
+ <a name="get_rules">&nbsp;</a>
404
+ #### rules
410
405
 
411
- Return data for one, some or all notification acceptors.
406
+ Return data for one, some or all notification rules.
412
407
 
413
408
  ```ruby
414
- acceptor = Flapjack::Diner.acceptors(ACCEPTOR_ID)
415
- some_acceptors = Flapjack::Diner.acceptors(ACCEPTOR_ID, ACCEPTOR_ID, ...)
416
- first_page_of_acceptors = Flapjack::Diner.acceptors
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
- [^](#contents_acceptors)
414
+ [^](#contents_rules)
420
415
 
421
- <a name="update_acceptors">&nbsp;</a>
422
- #### update_acceptors
416
+ <a name="update_rules">&nbsp;</a>
417
+ #### update_rules
423
418
 
424
- Update data for one or more notification acceptors.
419
+ Update data for one or more notification rules.
425
420
 
426
421
  ```ruby
427
- # update values for one acceptor
428
- Flapjack::Diner.update_acceptors(:id => ACCEPTOR_ID, KEY => VALUE, ...)
422
+ # update values for one rule
423
+ Flapjack::Diner.update_rules(:id => UUID_STRING, KEY => VALUE, ...)
429
424
 
430
- # update values for multiple acceptors
431
- Flapjack::Diner.update_acceptors({:id => ACCEPTOR_ID, KEY => VALUE, ...}, {:id => ACCEPTOR_ID, KEY => VALUE, ...})
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`, `:is_blackhole`, `:media` and `:tags`
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
- [^](#contents_update_acceptors)
435
+ [^](#contents_update_rules)
441
436
 
442
- <a name="delete_acceptors">&nbsp;</a>
443
- #### delete_acceptors
437
+ <a name="delete_rules">&nbsp;</a>
438
+ #### delete_rules
444
439
 
445
- Delete one or more notification acceptors.
440
+ Delete one or more notification rules.
446
441
 
447
442
  ```ruby
448
- # delete one acceptor
449
- Flapjack::Diner.delete_acceptors(ACCEPTOR_ID)
443
+ # delete one rule
444
+ Flapjack::Diner.delete_rules(UUID_STRING)
450
445
 
451
- # delete multiple acceptors
452
- Flapjack::Diner.delete_acceptors(ACCEPTOR_ID, ACCEPTOR_ID, ...)
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
- [^](#contents_delete_acceptors)
458
-
459
- ---
460
-
461
- <a name="section_rejectors">&nbsp;</a>
462
- ### Rules [^](#contents_section_rejectors)
463
-
464
- <a name="create_rejectors">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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 => [CHECK_ID, ...],
564
- :acceptors => [ACCEPTOR_ID, ...],
565
- :rejectors => [REJECTOR_ID, ...]
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(TAG_NAME)
580
- some_tags = Flapjack::Diner.tags(TAG_NAME, TAG_NAME, ...)
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 => TAG_NAME, KEY => VALUE, ...)
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 => TAG_NAME, KEY => VALUE, ...}, {:id => TAG_NAME, KEY => VALUE, ...})
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`, `:acceptors` and `:rejectors`
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(TAG_NAME)
523
+ Flapjack::Diner.delete_tags(UUID_STRING)
615
524
 
616
525
  # delete multiple tags
617
- Flapjack::Diner.delete_tags(TAG_NAME, TAG_NAME, ...)
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 => UUID,
550
+ :id => UUID_STRING,
642
551
  :start_time => DATETIME, # required
643
552
  :end_time => DATETIME, # required
644
553
  :summary => STRING,
645
- :check => CHECK_ID, # one (and only one) of :check or :tag must be provided
646
- :tag => TAG_NAME # :tag will create scheduled maintenance periods for all checks that this tag is associated with
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(SCHEDULED_MAINTENANCE_ID)
661
- some_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances(SCHEDULED_MAINTENANCE_ID, SCHEDULED_MAINTENANCE_ID, ...)
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 => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...)
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 => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...}, {:id => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...})
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(SCHEDULED_MAINTENANCE_ID)
697
- Flapjack::Diner.delete_scheduled_maintenances(SCHEDULED_MAINTENANCE_ID, SCHEDULED_MAINTENANCE_ID, ...)
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(UNSCHEDULED_MAINTENANCE_ID)
713
- some_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID, UNSCHEDULED_MAINTENANCE_ID, ...)
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 => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE)
634
+ Flapjack::Diner.update_unscheduled_maintenances(:id => UUID_STRING, KEY => VALUE)
726
635
 
727
- Flapjack::Diner.update_unscheduled_maintenances({:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE},
728
- {:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE}, ...)
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(UNSCHEDULED_MAINTENANCE_ID)
748
- Flapjack::Diner.delete_unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID, UNSCHEDULED_MAINTENANCE_ID, ...)
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 => CHECK_ID, # one (and only one) of :check or :tag must be provided
777
- :tag => TAG_NAME # :tag will acknowledge all failing checks that this tag is associated with
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
- :check => CHECK_ID, # one (and only one) of :check or :tag must be provided
799
- :tag => TAG_NAME # :tag will send test notifications for all checks that this tag is associated with
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(STATE_ID)
819
- some_states = Flapjack::Diner.states(STATE_ID, STATE_ID, ...)
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(STATISTICS_ID)
843
- some_statistics = Flapjack::Diner.statistics(STATISTICS_ID, STATISTICS_ID, ...)
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` | 'rejectors' | ['rejector', ...] |
880
- | `.media` | 'acceptors' | ['acceptor', ...] |
788
+ | `.contacts` | 'rules' | ['rule', ...] |
789
+ | `.contacts` | 'tags' | ['tag', ...] |
881
790
  | `.media` | 'alerting_checks' | ['check', ...] |
882
791
  | `.media` | 'contact' | 'contact' |
883
- | `.media` | 'rejectors' | ['rejector', ...] |
884
- | `.acceptors` | 'contact' | 'contact' |
885
- | `.acceptors` | 'media' | ['medium', ...] |
886
- | `.acceptors` | 'tags' | ['tag', ...] |
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` | 'rejectors' | ['acceptor', ...] |
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
- contact_link_rejectors(contact_id, opts = {})
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
- medium_link_rejectors(medium_id, opts = {})
849
+ medium_link_rules(medium_id, opts = {})
945
850
 
946
- acceptor_link_contact(acceptor_id, opts = {})
947
- acceptor_link_media(acceptor_id, opts = {})
948
- acceptor_link_tags(acceptor_id, opts = {})
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
- tag_link_acceptors(tag_name, opts = {})
957
- tag_link_checks(tag_name, opts = {})
958
- tag_link_rejectors(tag_name, opts = {})
959
- tag_link_scheduled_maintenances(tag_name, opts = {})
960
- tag_link_states(tag_name, opts = {})
961
- 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 = {})
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">&nbsp;</a>
967
868
  ### Manipulating object relationships
968
869
 
969
- The following operations are supported; please note that some associations (e.g. associating an acceptor with a contact) must be made on object creation, via the secondary resource's create method, and cannot be altered later.
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, *tags_names)
973
- update_check_link_tags(check_id, *tags_names)
974
- delete_check_link_tags(check_id, *tags_names)
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
- create_acceptor_link_media(acceptor_id, *media_ids)
985
- update_acceptor_link_media(acceptor_id, *media_ids)
986
- delete_acceptor_link_media(acceptor_id, *media_ids)
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
- create_acceptor_link_tags(acceptor_id, *tags_names)
989
- update_acceptor_link_tags(acceptor_id, *tags_names)
990
- delete_acceptor_link_tags(acceptor_id, *tags_names)
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
- create_rejector_link_media(rejector_id, *media_ids)
993
- update_rejector_link_media(rejector_id, *media_ids)
994
- delete_rejector_link_media(rejector_id, *media_ids)
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
- create_rejector_link_tags(rejector_id, *tags_names)
997
- update_rejector_link_tags(rejector_id, *tags_names)
998
- delete_rejector_link_tags(rejector_id, *tags_names)
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(tag_name, *checks_ids)
1001
- update_tag_link_checks(tag_name, *checks_ids)
1002
- delete_tag_link_checks(tag_name, *checks_ids)
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
- create_tag_link_acceptors(tag_name, *acceptors_ids)
1005
- update_tag_link_acceptors(tag_name, *acceptors_ids)
1006
- delete_tag_link_acceptors(tag_name, *acceptors_ids)
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
- create_tag_link_rejectors(tag_name, *rejectors_ids)
1009
- update_tag_link_rejectors(tag_name, *rejectors_ids)
1010
- delete_tag_link_rejectors(tag_name, *rejectors_ids)
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">&nbsp;</a>