flapjack-diner 0.15 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3ddc9c0739401a0d4921a4ea116fa31f2da5076
4
+ data.tar.gz: 81598f05516e999be2dbb4b0617e04e72f6d77f2
5
+ SHA512:
6
+ metadata.gz: 6ff59adc22d994f71fb78b1b7e4632d5699801f9c65456de550b82bcf6e30066de614a122ac9c6847435a06017b3c85001419ae9d1ddbc2cbbcae9f8aad13538
7
+ data.tar.gz: 1edc4fe8320350c7ec36b82d5abb6d3686e85c23a2454c54943e5fd823fb219b689513d5bb792f4e3504fd90b2372bd1ab4f868c0cc4d8c77a1c1a14d094883f
data/README.md CHANGED
@@ -33,1016 +33,703 @@ Flapjack::Diner.logger = Logger.new('logs/flapjack_diner.log')
33
33
 
34
34
  ## Functions
35
35
 
36
- * [entities](#entities)
37
- * [checks](#checks)
38
- * status ([single check](#status_check) / [all checks](#status) / [bulk](#status_bulk))
39
- * scheduled maintentance periods ([single check](#scheduled_maintenance_check) / [all checks](#scheduled_maintenance) / [bulk](#scheduled_maintenance_bulk))
40
- * unscheduled maintentance periods ([single check](#unscheduled_maintenance_check) / [all checks](#unscheduled_maintenance) / [bulk](#unscheduled_maintenance_bulk))
41
- * outages ([single check](#outages_check) / [all checks](#outages) / [bulk](#outages_bulk))
42
- * downtimes ([single check](#downtimes_check) / [all checks](#downtimes) / [bulk](#downtimes_bulk))
43
- * create scheduled maintenance period ([single check](#create_scheduled_maintenance) / [bulk](#create_scheduled_maintenance_bulk))
44
- * delete scheduled maintenance period ([single check](#delete_scheduled_maintenance) / [bulk](#delete_scheduled_maintenance_bulk))
45
- * acknowledge ([single check](#acknowledge) / [bulk](#acknowledge_bulk))
46
- * delete unscheduled maintenance period ([single check](#delete_unscheduled_maintenance) / [bulk](#delete_unscheduled_maintenance_bulk))
47
- * test notifications ([single check](#test_notifications) / [bulk](#test_notifications_bulk))
48
- * [get entity tags](#get_entity_tags)
49
- * [add entity tags](#add_entity_tags)
50
- * [delete entity tags](#delete_entity_tags)
51
- * [get contact tags](#get_contact_tags)
52
- * [add contact tags](#add_contact_tags)
53
- * [delete contact tags](#delete_contact_tags)
54
- * [get tags for contact's linked entities](#get_contact_entitytags)
55
- * [add tags to contact's linked entities](#add_contact_entitytags)
56
- * [delete tags from contact's linked entities](#delete_contact_entitytags)
57
- * [contacts](#contacts)
58
- * [contact](#contact)
59
- * [notification rules](#notification_rules)
60
- * [notification rule](#notification_rule)
61
- * [create notification rule](#create_notification_rule)
62
- * [update notification rule](#update_notification_rule)
63
- * [delete notification rule](#delete_notification_rule)
64
- * [notification media](#notification_media)
65
- * [notification medium](#notification_medium)
66
- * [update notification medium](#update_notification_medium)
67
- * [delete notification medium](#delete_notification_medium)
68
- * [contact timezone](#contact_timezone)
69
- * [update contact timezone](#update_contact_timezone)
70
- * [delete contact timezone](#delete_contact_timezone)
36
+ Parameters for all of **flapjack-diner**'s functions are organised into three categories:
71
37
 
72
- ---
38
+ * Ids -- One or more String or Integer values
39
+ * Query parameters -- Top-level hash values
40
+ * Payload data -- Arrays of Hashes
73
41
 
74
- <a name="entities">&nbsp;</a>
75
- Return an array of monitored entities, and their statuses for all associated checks:
42
+ While these can be passed in in any order, the convention is that they will be ordered as listed above.
76
43
 
77
- ```ruby
78
- Flapjack::Diner.entities
79
- ```
44
+ If any operation fails, `Flapjack::Diner.last_error` will contain an error message regarding the failure.
80
45
 
81
- The data is returned as an array where each element is a hash representing an entity.
46
+ ### Contacts
82
47
 
83
- ```
84
- // ID is an integer, to hold e.g. database id from an external system
85
- // NAME is a string
86
- // STATUS is a hash with the format returned from Flapjack::Diner.status(entity, check)
87
- [{'id' => ID,
88
- 'name' => NAME,
89
- 'checks' => [STATUS, STATUS, ...]},
90
- {},
91
- ...]
92
- ```
48
+ * [create_contacts](#create_contacts)
49
+ * [contacts](#contacts)
50
+ * [update_contacts](#update_contacts)
51
+ * [delete_contacts](#delete_contacts)
93
52
 
94
- ---
53
+ ### Media
95
54
 
96
- <a name="checks">&nbsp;</a>
97
- Return an array of checks for an entity:
55
+ * [create_contact_media](#create_contact_media)
56
+ * [media](#media)
57
+ * [update_media](#update_media)
58
+ * [delete_media](#delete_media)
98
59
 
99
- ```ruby
100
- Flapjack::Diner.checks('example.com')
101
- ```
60
+ ### Pagerduty credentials
102
61
 
103
- The data is returned as an array of strings, where each element is a check name for the provided entity.
62
+ * [create_contact_pagerduty_credentials](#create_contact_pagerduty_credentials)
63
+ * [pagerduty_credentials](#pagerduty_credentials)
64
+ * [update_pagerduty_credentials](#update_pagerduty_credentials)
65
+ * [delete_pagerduty_credentials](#delete_pagerduty_credentials)
104
66
 
105
- ```
106
- // CHECK is a string, e.g. 'ssh', 'ping'
107
- [CHECK, CHECK, ...]
108
- ```
67
+ ### Notification rules
109
68
 
110
- ---
111
- <a name="status_check">&nbsp;</a>
112
- Return the status for a check on an entity
69
+ * [create_contact_notification_rules](#create_contact_notification_rules)
70
+ * [notification_rules](#notification_rules)
71
+ * [update_notification_rules](#update_notification_rules)
72
+ * [delete_notification_rules](#delete_notification_rules)
113
73
 
114
- ```ruby
115
- Flapjack::Diner.status('example.com', :check => 'ping')
116
- ```
74
+ ### Entities
117
75
 
118
- The data is returned as a hash:
76
+ * [create_entities](#create_entities)
77
+ * [entities](#entities)
78
+ * [update_entities](#update_entities)
119
79
 
120
- ```
121
- // CHECK is a string, e.g. 'ssh', 'ping'
122
- // STATE is a string, one of 'critical', 'warning', 'ok', 'unknown'
123
- // the TIMESTAMPs are integers representing UTC times for the named events
124
- {'name' => CHECK,
125
- 'state' => STATE,
126
- 'in_unscheduled_maintenance' => BOOLEAN,
127
- 'in_scheduled_maintenance' => BOOLEAN,
128
- 'last_update' => TIMESTAMP,
129
- 'last_problem_notification' => TIMESTAMP,
130
- 'last_recovery_notification' => TIMESTAMP,
131
- 'last_acknowledgement_notification' => TIMESTAMP}
132
- ```
80
+ * [create_scheduled_maintenances_entities](#create_scheduled_maintenances_entities)
81
+ * [delete_scheduled_maintenances_entities](#delete_scheduled_maintenances_entities)
133
82
 
134
- ---
135
- <a name="status">&nbsp;</a>
136
- Return the statuses for all checks on an entity
83
+ * [create_unscheduled_maintenances_entities](#create_unscheduled_maintenances_entities)
84
+ * [update_unscheduled_maintenances_entities](#update_unscheduled_maintenances_entities)
137
85
 
138
- ```ruby
139
- Flapjack::Diner.status('example.com')
140
- ```
86
+ * [create_test_notifications_entities](#create_test_notifications_entities)
141
87
 
142
- The data is returned as an array of checks, where each element is a hash with the format returned from Flapjack::Diner.status(entity, check)
88
+ ### Checks
143
89
 
144
- ```
145
- // STATUS is a hash with the format returned from Flapjack::Diner.status(entity, check)
146
- [STATUS, STATUS, ...]
147
- ```
90
+ * [create_scheduled_maintenances_checks](#create_scheduled_maintenances_checks)
91
+ * [delete_scheduled_maintenances_checks](#delete_scheduled_maintenances_checks)
148
92
 
149
- ---
150
- <a name="status_bulk">&nbsp;</a>
151
- Return the statuses for all checks on some entities and specified checks on others.
93
+ * [create_unscheduled_maintenances_checks](#create_unscheduled_maintenances_checks)
94
+ * [update_unscheduled_maintenances_checks](#update_unscheduled_maintenances_checks)
152
95
 
153
- ```ruby
154
- # :entity - optional, may be a String or an Array of Strings (entity names)
155
- # :check - optional, Hash, keys are Strings (entity names), values are Strings or Arrays of Strings (check names)
156
- # At least one of the :entity or :check arguments must be provided
157
- Flapjack::Diner.bulk_status(:entity => 'example.com',
158
- :check => {'example2.com' => ['PING', 'SSH'],
159
- 'example3.com' => 'PING'})
160
- ```
96
+ * [create_test_notifications_checks](#create_test_notifications_checks)
161
97
 
162
- The data is returned as an array, where each element is a hash with the format
98
+ ### Reports
163
99
 
164
- ```
165
- // ENTITY is a string, one of the entity names provided in the entity or check arguments.
166
- // CHECK is a string, e.g. 'ssh', 'ping'
167
- // STATUS is a hash with the format returned from Flapjack::Diner.status(entity, check)
168
- {'entity' => ENTITY
169
- 'check' => CHECK,
170
- 'status' => STATUS}
171
- ```
100
+ * [status_report_entities](#status_report_entities)
101
+ * [scheduled_maintenance_report_entities](#scheduled_maintenance_report_entities)
102
+ * [unscheduled_maintenance_report_entities](#unscheduled_maintenance_report_entities)
103
+ * [downtime_report_entities](#downtime_report_entities)
104
+ * [outage_report_entities](#outage_report_entities)
105
+
106
+ * [status_report_checks](#status_report_checks)
107
+ * [scheduled_maintenance_report_checks](#scheduled_maintenance_report_checks)
108
+ * [unscheduled_maintenance_report_checks](#unscheduled_maintenance_report_checks)
109
+ * [downtime_report_checks](#downtime_report_checks)
110
+ * [outage_report_checks](#outage_report_checks)
172
111
 
173
112
  ---
174
- <a name="scheduled_maintenance_check">&nbsp;</a>
175
- Return an array of scheduled maintenance periods for a check on an entity:
176
113
 
177
- ```ruby
178
- # start time (Time object, optional)
179
- # end time (Time object, optional)
180
- Flapjack::Diner.scheduled_maintenances('example.com', :check => 'ping',
181
- :start_time => Time.local(2012, 08, 01),
182
- :end_time => Time.local(2012, 09, 01))
183
- ```
114
+ <a name="create_contacts">&nbsp;</a>
115
+ #### create_contacts
184
116
 
185
- The data is returned as an array of scheduled maintenance periods, with each element of the array being a hash containing data about that maintenance period.
186
-
187
- ```
188
- // the TIMESTAMPs are integers representing UTC times for the named events
189
- // DURATION is an integer representing the length of the period in seconds
190
- // SUMMARY is a string providing a description of the period, may be empty
191
- [{'start_time' => TIMESTAMP,
192
- 'duration' => DURATION,
193
- 'summary' => SUMMARY,
194
- 'end_time' => TIMESTAMP},
195
- {...},
196
- ...]
197
- ```
198
-
199
- ---
200
- <a name="scheduled_maintenance">&nbsp;</a>
201
- Return lists of scheduled maintenance periods for all checks on an entity:
117
+ Create one or more contacts.
202
118
 
203
119
  ```ruby
204
- # start time (Time object, optional)
205
- # end time (Time object, optional)
206
- Flapjack::Diner.scheduled_maintenances('example.com',
207
- :start_time => Time.local(2012, 08, 01),
208
- :end_time => Time.local(2012, 09, 01))
120
+ Flapjack::Diner.create_contacts([CONTACT, ...])
209
121
  ```
210
122
 
211
- The data is returned as an array of hashes, where each hash represents the scheduled maintenance periods for a check under the entity :
212
-
213
123
  ```
214
- // CHECK is a string, e.g. 'ssh', 'ping'
215
- // SCHED_MAINT is a hash with the same format as an individual element of
216
- // the array returned from Flapjack::Diner.scheduled_maintenances(entity, check)
217
- [{'check' => CHECK,
218
- 'scheduled_maintenance' => [SCHED_MAINT, ...]
219
- },
220
- {'check' => CHECK,
221
- 'scheduled_maintenance' => [SCHED_MAINT, ...]
222
- }]
124
+ CONTACT
125
+ {
126
+ :id => STRING,
127
+ :first_name => STRING,
128
+ :last_name => STRING,
129
+ :email => STRING,
130
+ :tags => [STRING, ...]
131
+ }
223
132
  ```
224
133
 
225
- ---
226
- <a name="scheduled_maintenance_bulk">&nbsp;</a>
227
- Return lists of scheduled maintenance periods for all checks on some entities and specified checks on others.
134
+ Returns true if creation succeeded or false if creation failed.
228
135
 
229
- ```ruby
230
- # :entity - optional, may be a String or an Array of Strings (entity names)
231
- # :check - optional, Hash, keys are Strings (entity names), values are Strings
232
- # or Arrays of Strings (check names)
233
- # At least one of the :entity or :check arguments must be provided
234
- Flapjack::Diner.bulk_scheduled_maintenances(:entity => 'example.com',
235
- :check => {'example2.com' => ['PING', 'SSH'],
236
- 'example3.com' => 'PING'})
237
- ```
136
+ <a name="contacts">&nbsp;</a>
137
+ #### contacts
238
138
 
239
- The data is returned as an array, where each element is a hash with the format
139
+ Return data for one, some or all contacts.
240
140
 
241
- ```
242
- // ENTITY is a string, one of the entity names provided in the entity or check arguments
243
- // CHECK is a string, e.g. 'ssh', 'ping'
244
- // SCHED_MAINT is a hash with the same format as an individual element of the array returned from Flapjack::Diner.scheduled_maintenances(entity, check)
245
- {'entity' => ENTITY
246
- 'check' => CHECK,
247
- 'scheduled_maintenances' => [SCHED_MAINT, ...]}
141
+ ```ruby
142
+ contact = Flapjack::Diner.contacts(ID)
143
+ some_contacts = Flapjack::Diner.contacts(ID1, ID2, ...)
144
+ all_contacts = Flapjack::Diner.contacts
248
145
  ```
249
146
 
250
- Please note the plural for the 'scheduled_maintenances' hash key, which is different to
251
- the other methods.
147
+ <a name="update_contacts">&nbsp;</a>
148
+ #### update_contacts
252
149
 
253
- ---
254
- <a name="unscheduled_maintenance_check">&nbsp;</a>
255
- Return an array of unscheduled maintenance periods for a check on an entity:
150
+ Update data for one or more contacts.
256
151
 
257
152
  ```ruby
258
- # start time (Time object, optional)
259
- # end time (Time object, optional)
260
- Flapjack::Diner.unscheduled_maintenances('example.com', :check => 'ping',
261
- :start_time => Time.local(2012, 08, 01),
262
- :end_time => Time.local(2012, 09, 01))
153
+ # update values for one contact
154
+ Flapjack::Diner.update_contacts(ID, :key => value, ...)
155
+
156
+ # update values for multiple contacts
157
+ Flapjack::Diner.update_contacts(ID1, ID2, ..., :key => value, ...)
263
158
  ```
264
159
 
265
- The data is returned as an array of unscheduled maintenance periods, with each element of the array being a hash containing data about that maintenance period.
160
+ Acceptable update field keys are
266
161
 
267
- ```
268
- // the TIMESTAMPs are integers representing UTC times for the named events
269
- // DURATION is an integer representing the length of the period in seconds
270
- // SUMMARY is a string providing a description of the period, may be empty
271
- [{'start_time' => TIMESTAMP,
272
- 'duration' => DURATION,
273
- 'summary' => SUMMARY,
274
- 'end_time' => TIMESTAMP},
275
- {...},
276
- ...]
277
- ```
162
+ `:first_name`, `:last_name`, `:email`, and `:tags`
278
163
 
279
- ---
280
- <a name="unscheduled_maintenance">&nbsp;</a>
281
- Return lists of unscheduled maintenance periods for all checks on an entity:
164
+ as well as the linkage operations
282
165
 
283
- ```ruby
284
- # start time (Time object, optional)
285
- # end time (Time object, optional)
286
- Flapjack::Diner.unscheduled_maintenances('example.com',
287
- :start_time => Time.local(2012, 08, 01),
288
- :end_time => Time.local(2012, 09, 01))
289
- ```
166
+ `:add_entity`, `:remove_entity`
167
+ `:add_notification_rule`, `:remove_notification_rule`
290
168
 
291
- The data is returned as an array of hashes, where each hash represents the unscheduled maintenance periods for a check under the entity:
169
+ which take the id of the relevant resource as the value.
292
170
 
293
- ```
294
- // CHECK is a string, e.g. 'ssh', 'ping'
295
- // UNSCHED_MAINT is a hash with the same format as an individual element of
296
- // the array returned from Flapjack::Diner.unscheduled_maintenances(entity, check)
297
- [{'check' => CHECK,
298
- 'unscheduled_maintenance' => [UNSCHED_MAINT, ...]
299
- },
300
- {'check' => CHECK,
301
- 'unscheduled_maintenance' => [UNSCHED_MAINT, ...]
302
- }]
303
- ```
171
+ (NB: `:add_medium` and `:remove_medium` are not supported in Flapjack v1.0 but should be in future versions.)
304
172
 
305
- ---
306
- <a name="unscheduled_maintenance_bulk">&nbsp;</a>
307
- Return lists of unscheduled maintenance periods for all checks on some entities and specified checks on others.
173
+ Returns true if updating succeeded or false if updating failed.
308
174
 
309
- ```ruby
310
- # :entity - optional, may be a String or an Array of Strings (entity names)
311
- # :check - optional, Hash, keys are Strings (entity names), values are Strings
312
- # or Arrays of Strings (check names)
313
- # At least one of the :entity or :check arguments must be provided
314
- Flapjack::Diner.bulk_unscheduled_maintenances(:entity => 'example.com',
315
- :check => {'example2.com' => ['PING', 'SSH'],
316
- 'example3.com' => 'PING'})
317
- ```
175
+ <a name="delete_contacts">&nbsp;</a>
176
+ #### delete_contacts
318
177
 
319
- The data is returned as an array, where each element is a hash with the format
178
+ Delete one or more contacts.
320
179
 
321
- ```
322
- // ENTITY is a string, one of the entity names provided in the entity or check arguments
323
- // CHECK is a string, e.g. 'ssh', 'ping'
324
- // UNSCHED_MAINT is a hash with the same format as an individual element of the
325
- // array returned from Flapjack::Diner.unscheduled_maintenances(entity, check)
326
- {'entity' => ENTITY
327
- 'check' => CHECK,
328
- 'unscheduled_maintenances' => [UNSCHED_MAINT, ...]
329
- }
180
+ ```ruby
181
+ # delete one contact
182
+ Flapjack::Diner.delete_contacts(ID)
183
+
184
+ # delete multiple contacts
185
+ Flapjack::Diner.delete_contacts(ID1, ID2, ...)
330
186
  ```
331
187
 
332
- Please note the plural for the 'unscheduled_maintenances' hash key, which is different to
333
- the other methods.
188
+ Returns true if deletion succeeded or false if deletion failed.
334
189
 
335
190
  ---
336
- <a name="outages_check">&nbsp;</a>
337
- Return an array of outages for a check on an entity (all times for which the check was failing):
191
+
192
+ <a name="create_contact_media">&nbsp;</a>
193
+ #### create_contact_media
194
+
195
+ Create one or more notification media.
338
196
 
339
197
  ```ruby
340
- # start time (Time object, optional)
341
- # end time (Time object, optional)
342
- Flapjack::Diner.outages('example.com', :check => 'ping',
343
- :start_time => Time.local(2012, 08, 01),
344
- :end_time => Time.local(2012, 09, 01))
198
+ Flapjack::Diner.create_contact_media(CONTACT_ID, [MEDIUM, ...])
345
199
  ```
346
200
 
347
- The data is returned as an array of outage periods, with each element of the array being a hash containing data about that outage period.
348
-
349
201
  ```
350
- // STATE is a string, one of 'critical', 'warning', 'ok', 'unknown'
351
- // the TIMESTAMPs are integers representing UTC times for the named events
352
- // SUMMARY is a string providing a description of the period, may be empty
353
- [{'state' => STATE,
354
- 'start_time' => TIMESTAMP,
355
- 'end_time' => TIMESTAMP,
356
- 'summary' => SUMMARY},
357
- {...},
358
- ...]
202
+ MEDIUM
203
+ {
204
+ :type => STRING,
205
+ :address => STRING,
206
+ :interval => INTEGER,
207
+ :rollup_threshold => INTEGER
208
+ }
359
209
  ```
360
210
 
361
- ---
362
- <a name="outages">&nbsp;</a>
363
- Return lists of outages for all checks on an entity (all times for which said checks were failing):
211
+ Returns true if creation succeeded or false if creation failed.
364
212
 
365
- ```ruby
366
- # start time (Time object, optional)
367
- # end time (Time object, optional)
368
- Flapjack::Diner.outages('example.com', :start_time => Time.local(2012, 08, 01),
369
- :end_time => Time.local(2012, 09, 01))
370
- ```
213
+ <a name="media">&nbsp;</a>
214
+ #### media
371
215
 
372
- The data is returned as an array of hashes, where each hash represents the outages for a check under the entity:
216
+ Return data for one, some or all notification media. Notification media ids are formed by compounding their linked contact's ID and their type in a string (e.g. '23_sms')
373
217
 
374
- ```
375
- // CHECK is a string, e.g. 'ssh', 'ping'
376
- // OUTAGE is a hash with the same format as an individual element of the array returned from Flapjack::Diner.outages(entity, check)
377
- [{'check' => CHECK,
378
- 'outages' => [OUTAGE, ...]
379
- },
380
- {'check' => CHECK,
381
- 'outages' => [OUTAGE, ...]
382
- }]
218
+ ```ruby
219
+ medium = Flapjack::Diner.media(ID)
220
+ some_media = Flapjack::Diner.media(ID1, ID2, ...)
221
+ all_media = Flapjack::Diner.media
383
222
  ```
384
223
 
385
- ---
386
- <a name="outages_bulk">&nbsp;</a>
387
- Return lists of outages for all checks on some entities and specified checks on others.
224
+ <a name="update_media">&nbsp;</a>
225
+ #### update_media
388
226
 
389
- ```ruby
390
- # :entity - optional, may be a String or an Array of Strings (entity names)
391
- # :check - optional, Hash, keys are Strings (entity names), values are Strings
392
- # or Arrays of Strings (check names)
393
- # At least one of the :entity or :check arguments must be provided
394
- Flapjack::Diner.bulk_outages(:entity => 'example.com',
395
- :check => {'example2.com' => ['PING', 'SSH'],
396
- 'example3.com' => 'PING'})
397
- ```
227
+ Update data for one or more notification media.
398
228
 
399
- The data is returned as an array, where each element is a hash with the format
229
+ ```ruby
230
+ # update values for one medium
231
+ Flapjack::Diner.update_media(ID, :key => value, ...)
400
232
 
401
- ```
402
- // ENTITY is a string, one of the entity names provided in the entity or check arguments
403
- // CHECK is a string, e.g. 'ssh', 'ping'
404
- // OUTAGE is a hash with the same format as an individual element of the array
405
- // returned from Flapjack::Diner.outages(entity, check)
406
- {'entity' => ENTITY
407
- 'check' => CHECK,
408
- 'outages' => [OUTAGE, ...]
409
- }
233
+ # update values for multiple media
234
+ Flapjack::Diner.update_media(ID1, ID2, ..., :key => value, ...)
410
235
  ```
411
236
 
412
- ---
413
- <a name="downtimes_check">&nbsp;</a>
414
- Return an array of downtimes for a check on an entity (outages outside of scheduled maintenance periods):
237
+ Acceptable update field keys are
415
238
 
416
- ```ruby
417
- # start time (Time object, optional)
418
- # end time (Time object, optional)
419
- Flapjack::Diner.downtime('example.com', :check => 'ping',
420
- :start_time => Time.local(2012, 08, 01),
421
- :end_time => Time.local(2012, 09, 01))
422
- ```
239
+ `:address`, `:interval`, `:rollup_threshold`
423
240
 
424
- Returns a hash with some statistics about the downtimes, including an array of the downtimes themselves. This may not be the same as would be returned from the 'outages' call for the same time period, as if scheduled maintenance periods overlap any of those times then they will be reduced, split or discarded to fit.
241
+ Returns true if updating succeeded or false if updating failed.
425
242
 
426
- ```
427
- // TOTAL SECONDS gives the sum of the time spent in that state for each check state.
428
- // PERCENTAGES represents the proportion of the total time that the check was
429
- // in each state. Will be null if either start or end time were not provided
430
- // in the request.
431
- // OUTAGE is a hash with the same format as an individual element of the array
432
- // returned from Flapjack::Diner.outages(entity, check).
433
- {'total_seconds' => {STATE => INTEGER, ...},
434
- 'percentages' => {STATE => INTEGER, ...},
435
- 'downtime' => [OUTAGE, ...]
436
- }
437
- ```
243
+ <a name="delete_media">&nbsp;</a>
244
+ #### delete_media
438
245
 
439
- ---
440
- <a name="downtimes">&nbsp;</a>
441
- Return an array of downtimes for all checks on an entity (outages outside of scheduled maintenance periods):
246
+ Delete one or more notification media.
442
247
 
443
248
  ```ruby
444
- # start time (Time object, optional)
445
- # end time (Time object, optional)
446
- Flapjack::Diner.downtime('example.com', :start_time => Time.local(2012, 08, 01),
447
- :end_time => Time.local(2012, 09, 01))
448
- ```
249
+ # delete one medium
250
+ Flapjack::Diner.delete_media(ID)
449
251
 
450
- The data is returned as an array of hashes, where each hash represents a downtime report for a check under the entity:
451
-
452
- ```
453
- // CHECK is a string, e.g. 'ssh', 'ping'
454
- // DOWNTIME is a hash with the same format those returned from
455
- // Flapjack::Diner.downtime(entity, check)
456
- [{'check' => CHECK,
457
- 'downtime' => [DOWNTIME, ...]
458
- },
459
- {'check' => CHECK,
460
- 'downtime' => [DOWNTIME, ...]
461
- }]
252
+ # delete multiple media
253
+ Flapjack::Diner.delete_media(ID1, ID2, ...)
462
254
  ```
463
255
 
256
+ Returns true if deletion succeeded or false if deletion failed.
257
+
464
258
  ---
465
- <a name="downtimes_bulk">&nbsp;</a>
466
259
 
467
- Return lists of downtimes for all checks on some entities and specified checks on others.
260
+ <a name="create_contact_pagerduty_credentials">&nbsp;</a>
261
+ #### create_contact_media
262
+
263
+ Create pagerduty credentials for a contact.
468
264
 
469
265
  ```ruby
470
- # :entity - optional, may be a String or an Array of Strings (entity names)
471
- # :check - optional, Hash, keys are Strings (entity names), values are Strings
472
- # or Arrays of Strings (check names)
473
- # At least one of the :entity or :check arguments must be provided
474
- Flapjack::Diner.bulk_downtime(:entity => ['example.com', 'example4.com'],
475
- :check => {'example2.com' => ['PING', 'SSH'],
476
- 'example3.com' => 'PING'})
266
+ Flapjack::Diner.create_contact_pagerduty_credentials(CONTACT_ID, PAGERDUTY_CREDENTIALS)
477
267
  ```
478
268
 
479
- The data is returned as an array, where each element is a hash with the format
480
-
481
269
  ```
482
- // ENTITY is a string, one of the entity names provided in the entity or check arguments
483
- // CHECK is a string, e.g. 'ssh', 'ping'
484
- // DOWNTIME is a hash with the same format as an individual element of the array
485
- // returned from Flapjack::Diner.downtime(entity, check)
486
- {'entity' => ENTITY
487
- 'check' => CHECK,
488
- 'downtime' => [DOWNTIME, ...]
270
+ PAGERDUTY_CREDENTIALS
271
+ {
272
+ :service_key => STRING,
273
+ :subdomain => STRING,
274
+ :username => STRING,
275
+ :password => STRING
489
276
  }
490
277
  ```
491
278
 
492
- ---
493
- <a name="create_scheduled_maintenance">&nbsp;</a>
494
- Create a scheduled maintenance period for a check on an entity:
279
+ Returns true if creation succeeded or false if creation failed.
495
280
 
496
- ```ruby
497
- # start_time (Time object, required)
498
- # duration (Integer, required) is measured in seconds
499
- # summary (String, optional)
500
- Flapjack::Diner.create_scheduled_maintenance!('example.com', 'ping',
501
- :start_time => Time.local(2012, 12, 01), :duration => (60 * 60),
502
- :summary => 'changing stuff')
503
- ```
281
+ <a name="pagerduty_credentials">&nbsp;</a>
282
+ #### pagerduty_credentials
504
283
 
505
- Returns a boolean value representing the success or otherwise of the creation of the scheduled maintenance period by the server.
506
-
507
- ---
508
- <a name="create_scheduled_maintenance_bulk">&nbsp;</a>
509
- Create scheduled maintenance periods for all checks on some entities and specified checks on others.
284
+ Return pagerduty credentials for a contact.
510
285
 
511
286
  ```ruby
512
- # start_time (Time object, required)
513
- # duration (Integer, required) is measured in seconds
514
- # summary (String, optional)
515
- Flapjack::Diner.bulk_create_scheduled_maintenance!(:entity => ['example.com', 'example2.com'],
516
- :check => {'example3.com' => 'ping'}, :start_time => Time.local(2012, 12, 01),
517
- :duration => (60 * 60), :summary => 'changing stuff')
287
+ pagerduty_credentials = Flapjack::Diner.pagerduty_credentials(CONTACT_ID)
288
+ some_pagerduty_credentials = Flapjack::Diner.pagerduty_credentials(CONTACT_ID1, CONTACT_ID2, ...)
289
+ all_pagerduty_credentials = Flapjack::Diner.pagerduty_credentials
518
290
  ```
519
291
 
520
- Returns a boolean value representing the success or otherwise of the creation of the scheduled maintenance periods by the server.
292
+ <a name="update_pagerduty_credentials">&nbsp;</a>
293
+ #### update_pagerduty_credentials
521
294
 
522
- ---
523
- <a name="delete_scheduled_maintenance">&nbsp;</a>
524
- Delete a scheduled maintenance period for a check on an entity:
295
+ Update pagerduty credentials for one or more contacts.
525
296
 
526
297
  ```ruby
527
- # start_time (Time object, required)
528
- Flapjack::Diner.delete_scheduled_maintenance!('example.com', 'ping',
529
- :start_time => Time.local(2012, 12, 01))
298
+ # update pagerduty_credentials for one contact
299
+ Flapjack::Diner.update_pagerduty_credentials(CONTACT_ID, :key => value, ...)
300
+
301
+ # update pagerduty_credentials for multiple contacts
302
+ Flapjack::Diner.update_pagerduty_credentials(CONTACT_ID1, CONTACT_ID2, ..., :key => value, ...)
530
303
  ```
531
304
 
532
- Returns a boolean value representing the success or otherwise of the deletion of the scheduled maintenance periods by the server.
305
+ Acceptable update field keys are
533
306
 
534
- ---
535
- <a name="delete_scheduled_maintenance_bulk">&nbsp;</a>
536
- Delete a scheduled maintenance period for all checks on some entities and specified checks on others.
307
+ `:service_key`, `:subdomain`, `:username`, `:password`
537
308
 
538
- ```ruby
539
- # start_time (Time object, required)
540
- Flapjack::Diner.bulk_delete_scheduled_maintenance!(:check => {'example.com' => ['ping', 'ssh']},
541
- :start_time => Time.local(2012, 12, 01))
542
- ```
309
+ Returns true if updating succeeded or false if updating failed.
543
310
 
544
- Returns a boolean value representing the success or otherwise of the deletion of the scheduled maintenance periods by the server.
311
+ <a name="delete_pagerduty_credentials">&nbsp;</a>
312
+ #### delete_pagerduty_credentials
545
313
 
546
- ---
547
- <a name="acknowledge">&nbsp;</a>
548
- Acknowledge the current state for a check on an entity:
314
+ Delete pagerduty credentials for one or more contacts
549
315
 
550
316
  ```ruby
551
- # summary (String, optional)
552
- Flapjack::Diner.acknowledge!('example.com', 'ping', :summary => 'ack')
317
+ # delete pagerduty_credentials for one contact
318
+ Flapjack::Diner.delete_pagerduty_credentials(CONTACT_ID)
319
+
320
+ # delete pagerduty_credentials for multiple contacts
321
+ Flapjack::Diner.delete_pagerduty_credentials(CONTACT_ID1, CONTACT_ID2, ...)
553
322
  ```
554
323
 
555
- Returns a boolean value representing the success or otherwise of the creation of the acknowledgement by the server.
324
+ Returns true if deletion succeeded or false if deletion failed.
556
325
 
557
326
  ---
558
- <a name="acknowledge_bulk">&nbsp;</a>
559
- Acknowledge the current state for all checks on some entities and specified checks on others.
560
-
561
- ```ruby
562
- # summary (String, optional)
563
- Flapjack::Diner.bulk_acknowledge!(:entity => 'example.com',
564
- :check => {'example2.com' => 'ping'}, :summary => 'ack')
565
- ```
566
327
 
567
- Returns a boolean value representing the success or otherwise of the creation of the acknowledgements by the server.
328
+ <a name="create_contact_notification_rules">&nbsp;</a>
329
+ #### create_contact_notification_rules
568
330
 
569
- ---
570
- <a name="delete_unscheduled_maintenance">&nbsp;</a>
571
- Delete an unscheduled maintenance period for a check on an entity:
331
+ Create one or more notification rules.
572
332
 
573
333
  ```ruby
574
- # end_time (Time object, optional)
575
- Flapjack::Diner.delete_unscheduled_maintenance!('example.com', 'ping',
576
- :end_time => Time.local(2012, 12, 01))
334
+ Flapjack::Diner.create_contact_notification_rules(CONTACT_ID, [NOTIFICATION_RULE, ...])
335
+ ```
336
+
337
+ ```
338
+ NOTIFICATION_RULE
339
+ {
340
+ :id => STRING,
341
+ :entities => [STRING, ...],
342
+ :regex_entities => [STRING, ...],
343
+ :tags => [STRING, ...],
344
+ :regex_tags => [STRING, ...],
345
+ :time_restrictions => TODO,
346
+ :unknown_media => [STRING, ...],
347
+ :warning_media => [STRING, ...],
348
+ :critical_media => [STRING, ...],
349
+ :unknown_blackhole => BOOLEAN,
350
+ :warning_blackhole => BOOLEAN,
351
+ :critical_blackhole => BOOLEAN
352
+ }
577
353
  ```
578
354
 
579
- Returns a boolean value representing the success or otherwise of the deletion of the scheduled maintenance periods by the server.
355
+ Returns true if creation succeeded or false if creation failed.
580
356
 
581
- ---
582
- <a name="delete_unscheduled_maintenance_bulk">&nbsp;</a>
583
- Delete unscheduled maintenance periods for all checks on some entities and specified checks on others.
357
+ <a name="notification_rules">&nbsp;</a>
358
+ #### notification_rules
359
+
360
+ Return data for one, some or all notification rules.
584
361
 
585
362
  ```ruby
586
- # end_time (Time object, optional)
587
- Flapjack::Diner.bulk_delete_unscheduled_maintenance!(:check => {'example.com' => ['ping', 'ssh']},
588
- :end_time => Time.local(2012, 12, 01))
363
+ notification_rule = Flapjack::Diner.notification_rules(ID)
364
+ some_notification_rules = Flapjack::Diner.notification_rules(ID1, ID2, ...)
365
+ all_notification_rules = Flapjack::Diner.notification_rules
589
366
  ```
590
367
 
591
- Returns a boolean value representing the success or otherwise of the deletion of the scheduled maintenance periods by the server.
368
+ <a name="update_notification_rules">&nbsp;</a>
369
+ #### update_notification_rules
592
370
 
593
- ---
594
- <a name="test_notifications">&nbsp;</a>
595
- Generate test notifications for a check on an entity:
371
+ Update data for one or more notification rules.
596
372
 
597
373
  ```ruby
598
- # summary (String, optional)
599
- Flapjack::Diner.test_notifications!('example.com', 'HOST',
600
- :summary => 'Testing notifications to all contacts interested in the HOST check on example.com')
374
+ # update values for one notification rule
375
+ Flapjack::Diner.update_notification_rules(ID, :key => value, ...)
376
+
377
+ # update values for multiple notification rules
378
+ Flapjack::Diner.update_notification_rules(ID1, ID2, ..., :key => value, ...)
601
379
  ```
602
380
 
603
- Returns a boolean value representing the success or otherwise of the creation of the notifications by the server.
381
+ Acceptable update field keys are
604
382
 
605
- ---
606
- <a name="test_notifications_bulk">&nbsp;</a>
607
- Generate test notifications for all checks on some entities and specified checks on others.
383
+ `:entities`, `:regex_entities`, `:tags`, `:regex_tags`, `:time_restrictions`, `:unknown_media`, `:warning_media`, `:critical_media`, `:unknown_blackhole`, `:warning_blackhole`, and `:critical_blackhole`
608
384
 
609
- ```ruby
610
- # summary (String, optional)
611
- Flapjack::Diner.bulk_test_notifications!(:entity => 'example.com',
612
- :check => {'example2.com' => 'ping'}, :summary => 'Testing notifications')
613
- ```
385
+ Returns true if updating succeeded or false if updating failed.
614
386
 
615
- Returns a boolean value representing the success or otherwise of the creation of the notifications by the server.
387
+ <a name="delete_notification_rules">&nbsp;</a>
388
+ #### delete_contacts
616
389
 
617
- ---
618
- <a name="get_entity_tags">&nbsp;</a>
619
- Get all tags for an entity.
390
+ Delete one or more notification rules.
620
391
 
621
392
  ```ruby
622
- # entity name (String, required)
623
- Flapjack::Diner.entity_tags('example.com')
393
+ # delete one medium
394
+ Flapjack::Diner.delete_notification_rules(ID)
395
+
396
+ # delete multiple contacts
397
+ Flapjack::Diner.delete_notification_rules(ID1, ID2, ...)
624
398
  ```
625
399
 
626
- The data is returned as an array of strings; each string is a named tag set on the entity. The array may be empty.
400
+ Returns true if deletion succeeded or false if deletion failed.
627
401
 
628
402
  ---
629
- <a name="add_entity_tags">&nbsp;</a>
630
- Add one or more tags to an entity.
403
+
404
+ <a name="create_entities">&nbsp;</a>
405
+ ### create_entities
406
+
407
+ Create one or more entities.
631
408
 
632
409
  ```ruby
633
- # entity name (String, required)
634
- # *tags (at least one String)
635
- Flapjack::Diner.add_entity_tags!('example.com', 'tag1', 'tag2')
410
+ Flapjack::Diner.create_entities([ENTITY, ...])
636
411
  ```
637
412
 
638
- The data is returned as an array of strings; each string is a named tag set on the entity. The array will, at a minimum, contain the tag(s) added by the request.
413
+ ```
414
+ ENTITY
415
+ {
416
+ :id => STRING,
417
+ :name => STRING,
418
+ :tags => [STRING, ...]
419
+ }
420
+ ```
639
421
 
640
- ---
641
- <a name="delete_entity tags">&nbsp;</a>
642
- Delete one or more tags from an entity.
422
+ Returns true if creation succeeded or false if creation failed.
423
+
424
+ <a name="entities">&nbsp;</a>
425
+ ### entities
426
+
427
+ Return data for one, some or all entities.
643
428
 
644
429
  ```ruby
645
- # entity name (String, required)
646
- # *tags (at least one String)
647
- Flapjack::Diner.delete_entity_tags!('example.com', 'tag1')
430
+ entity = Flapjack::Diner.entities(ID)
431
+ some_entities = Flapjack::Diner.entities(ID1, ID2, ...)
432
+ all_entities = Flapjack::Diner.entities
648
433
  ```
649
434
 
650
- Returns a boolean representing the success (or otherwise) of the tag deletion.
435
+ <a name="update_entities">&nbsp;</a>
436
+ ### update_entities
651
437
 
652
- ---
653
- <a name="get_contact_tags">&nbsp;</a>
654
- Get all tags for a contact.
438
+ Update data for one or more entities.
655
439
 
656
440
  ```ruby
657
- # contact ID (String, required)
658
- Flapjack::Diner.contact_tags('21')
441
+ # update values for one entity
442
+ Flapjack::Diner.update_entities(ID, :key => value, ...)
443
+
444
+ # update values for multiple entities
445
+ Flapjack::Diner.update_entities(ID1, ID2, ..., :key => value, ...)
659
446
  ```
660
447
 
661
- The data is returned as an array of strings; each string is a named tag set on the contact. The array may be empty.
448
+ Acceptable update field keys are
662
449
 
663
- ---
664
- <a name="add_contact_tags">&nbsp;</a>
665
- Add one or more tags to a contact.
450
+ `:name` and `:tags`
666
451
 
667
- ```ruby
668
- # contact ID (String, required)
669
- # *tags (at least one String)
670
- Flapjack::Diner.add_contact_tags!('21', 'tag1', 'tag2')
671
- ```
452
+ as well as the linkage operations
672
453
 
673
- The data is returned as an array of strings; each string is a named tag set on the contact. The array will, at a minimum, contain the tag(s) added by the request.
454
+ `:add_contact` and `:remove_contact`
674
455
 
675
- ---
676
- <a name="delete_contact_tags">&nbsp;</a>
677
- Delete one or more tags from a contact.
456
+ which take the id of the relevant contact as the value.
678
457
 
679
- ```ruby
680
- # contact ID (String, required)
681
- # *tags (at least one String)
682
- Flapjack::Diner.delete_contact_tags!('21', 'tag1')
683
- ```
458
+ Returns true if updating succeeded or false if updating failed.
684
459
 
685
- Returns a boolean representing the success (or otherwise) of the tag deletion.
686
460
 
687
- ---
688
- <a name="get_contact_entitytags">&nbsp;</a>
689
- Get all tags for entities linked to a contact.
461
+ <a name="create_scheduled_maintenances_entities">&nbsp;</a>
462
+ ### create_scheduled_maintenances_entities
463
+
464
+ Create one or more scheduled maintenance periods (`duration` seconds in length) on all checks for the provided entities.
690
465
 
691
466
  ```ruby
692
- # contact ID (String, required)
693
- Flapjack::Diner.contact_entitytags('21')
467
+ Flapjack::Diner.create_scheduled_maintenances_entities(ENTITY_ID(S), [SCHEDULED_MAINTENANCE, ...])
694
468
  ```
695
469
 
696
- The data is returned as a Hash, with String keys representing entity names, and Arrays of String values representing the tags for each named entity.
697
-
698
470
  ```
471
+ SCHEDULED_MAINTENANCE
699
472
  {
700
- ENTITY => [TAG, ...],
701
- ENTITY => [TAG, ...],
702
- ...
473
+ :start_time => DATETIME,
474
+ :duration => INTEGER,
475
+ :summary => STRING
703
476
  }
704
477
  ```
705
478
 
706
- ---
707
- <a name="add_contact_entitytags">&nbsp;</a>
708
- Add one or more tags to entities linked to a contact.
709
-
710
- ```ruby
711
- # contact ID (String, required)
712
- # entity_tags (Hash, required - similar format as returned by 'contact_entitytags')
713
- Flapjack::Diner.add_contact_entitytags!('21', {'entity1' => ['web'], 'entity2' => ['app']})
714
- ```
479
+ Returns true if creation succeeded or false if creation failed.
715
480
 
716
- The data is returned as a Hash, reflecting the current tags for the contact's linked entities. This is in the same format as the ```contact_entitytags``` call returns.
481
+ <a name="delete_scheduled_maintenances_entities">&nbsp;</a>
482
+ ### delete_scheduled_maintenances_entities
717
483
 
718
- ---
719
- <a name="delete_contact_entitytags">&nbsp;</a>
720
- Delete one or more tags from entities linked to a contact.
484
+ Delete scheduled maintenance periods starting at a specific time for checks across one or more entities.
721
485
 
722
486
  ```ruby
723
- # contact ID (String, required)
724
- # entity_tags (Hash, required - similar format as returned by 'contact_entitytags')
725
- Flapjack::Diner.add_contact_entitytags!('21', {'entity1' => ['web'], 'entity2' => ['app']})
487
+ Flapjack::Diner.delete_scheduled_maintenances_entities(ENTITY_ID(S), :start_time => DATETIME)
726
488
  ```
727
489
 
728
- Returns a boolean representing the success (or otherwise) of the tag deletion.
490
+ Returns true if deletion succeeded or false if deletion failed. Raises an exception if the `:start_time` parameter is not supplied.
729
491
 
730
- ---
731
- <a name="contacts">&nbsp;</a>
732
- Gets all contact records.
492
+ <a name="create_unscheduled_maintenances_entities">&nbsp;</a>
493
+ ### create_unscheduled_maintenances_entities
733
494
 
734
- ```ruby
735
- Flapjack::Diner.contacts
736
- ```
737
-
738
- The data is returned as an array of hashes, where each hash represents a contact. The tags array will be empty if the associated contact has no tags.
495
+ Acknowledges any failing checks on the passed entities and sets up unscheduled maintenance (`duration` seconds long) on them.
739
496
 
740
497
  ```ruby
741
- [
742
- {
743
- 'id' => STRING,
744
- 'first_name' => STRING,
745
- 'last_name' => STRING,
746
- 'email' => STRING,
747
- 'tags' => [STRING, ...]
748
- },
749
- ...
750
- ]
498
+ Flapjack::Diner.create_unscheduled_maintenances_entities(ENTITY_ID(S), [SCHEDULED_MAINTENANCE, ...])
751
499
  ```
752
500
 
753
- ---
754
- <a name="contact">&nbsp;</a>
755
- Get a single contact record.
756
-
757
- ```ruby
758
- # contact_id (String, required)
759
- Flapjack::Diner.contact('contact23')
760
501
  ```
761
-
762
- The contact record is returned as a hash (a singular instance of what is returned in the full contact list). The tags array will be empty if the contact has no tags
763
-
764
- ```ruby
502
+ UNSCHEDULED_MAINTENANCE
765
503
  {
766
- 'id' => STRING,
767
- 'first_name' => STRING,
768
- 'last_name' => STRING,
769
- 'email' => STRING,
770
- 'tags' => [STRING, ...]
504
+ :duration => INTEGER,
505
+ :summary => STRING
771
506
  }
772
507
  ```
773
508
 
774
- ---
775
- <a name="notification_rules">&nbsp;</a>
776
- Gets the notification rules belonging to a contact.
509
+ Returns true if creation succeeded or false if creation failed.
777
510
 
778
- ```ruby
779
- # contact_id (String, required)
780
- Flapjack::Diner.notification_rules('contact23')
781
- ```
511
+ <a name="update_unscheduled_maintenances_entities">&nbsp;</a>
512
+ ### update_unscheduled_maintenances_entities
782
513
 
783
- Returns an array of hashes, where a single hash represents a notification rule record. NB 'time_restrictions' have not yet been implemented, but we're noting the use of the field name here as it will be meaningful in the future.
514
+ Finalises currently existing unscheduled maintenance periods for all acknowledged checks in the provided entities. The periods end at the time provided in the `:end_time` parameter.
784
515
 
785
516
  ```ruby
786
- # contact_id (String, as provided in the request)
787
- # rule_id (String, allocated on creation, immutable)
788
- [
789
- {
790
- 'id' => RULE_ID,
791
- 'contact_id' => CONTACT_ID,
792
- 'entity_tags' => [STRING, ...]
793
- 'entities' => [STRING, ...],
794
- 'time_restrictions' => [],
795
- 'warning_media' => [STRING, ...],
796
- 'critical_media' => [STRING, ...],
797
- 'warning_blackhole' => BOOLEAN,
798
- 'critical_blackhole' => BOOLEAN
799
- },
800
- ...
801
- ]
517
+ Flapjack::Diner.update_unscheduled_maintenances_entities(ENTITY_ID(S), :end_time => DATETIME)
802
518
  ```
803
519
 
804
- ---
805
- <a name="notification_rule">&nbsp;</a>
806
- Gets a single notification rule belonging to a contact.
520
+ Returns true if the finalisation succeeded or false if deletion failed.
807
521
 
808
- ```ruby
809
- # rule_id (String, required)
810
- Flapjack::Diner.notification_rule('08f607c7-618d-460a-b3fe-868464eb6045')
811
- ```
522
+ <a name="create_test_notifications_entities">&nbsp;</a>
523
+ ### create_test_notifications_entities
812
524
 
813
- Returns a hash representing a notification rule record (a singular instance of what is returned in a list of a contact's notification rules). NB 'time_restrictions' have not yet been implemented, but we're noting the use of the field name here as it will be meaningful in the future.
525
+ Instructs Flapjack to issue test notifications on all checks for the passed entities. These notifications will be sent to contacts configured to receive notifications for those checks.
814
526
 
815
527
  ```ruby
816
- # RULE_ID (String, as provided in the request)
817
- # CONTACT_ID (String)
528
+ Flapjack::Diner.create_test_notifications_entities(ENTITY_ID(S), [TEST_NOTIFICATION, ...])
529
+ ```
530
+
531
+ ```
532
+ TEST_NOTIFICATION
818
533
  {
819
- 'id' => RULE_ID,
820
- 'contact_id' => CONTACT_ID,
821
- 'entity_tags' => [STRING, ...]
822
- 'entities' => [STRING, ...],
823
- 'time_restrictions' => [],
824
- 'warning_media' => [STRING, ...],
825
- 'critical_media' => [STRING, ...],
826
- 'warning_blackhole' => BOOLEAN,
827
- 'critical_blackhole' => BOOLEAN
534
+ :summary => STRING
828
535
  }
829
536
  ```
830
537
 
538
+ Returns true if creation succeeded or false if creation failed.
539
+
831
540
  ---
832
- <a name="create_notification_rule">&nbsp;</a>
833
- Creates a notification rule for a contact.
834
541
 
835
- ```ruby
836
- # rule_data (Hash, will be converted via to_json)
837
- # contact_id (String, required)
838
- # entity_tags (Array of Strings, may be empty; either this or 'entities' must have some content)
839
- # entities (Array of Strings, may be empty; either this or 'entity_tags' must have some content)
840
- # time_restrictions (TBD)
841
- # warning_media (Array of Strings, may be empty; each represents a media type)
842
- # critical_media (Array of Strings, may be empty; each represents a media type)
843
- # warning_blackhole (Boolean, required)
844
- # critical_blackhole (Boolean, required)
845
- Flapjack::Diner.create_notification_rule!({
846
- 'contact_id' => 'contact23',
847
- 'entity_tags' => ['database'],
848
- 'entities' => ['app-1.example.com']
849
- 'time_restrictions' => [],
850
- 'warning_media' => ['email'],
851
- 'critical_media' => ['email', 'sms'],
852
- 'warning_blackhole' => false,
853
- 'critical_blackhole' => false
854
- }
855
- })
856
- ```
542
+ <a name="create_scheduled_maintenances_checks">&nbsp;</a>
543
+ ### create_scheduled_maintenances_checks
857
544
 
858
- Returns a hash represeting the created notification rule. This is the same data you would receive from ```Flapjack::Diner.notification_rule(rule_id)```.
545
+ Create one or more scheduled maintenance periods (`duration` seconds in length) on one or more checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
859
546
 
860
547
  ```ruby
861
- # RULE_ID (String, as provided in the request)
862
- # CONTACT_ID (String)
548
+ Flapjack::Diner.create_scheduled_maintenances_checks(CHECK_ID(S), [SCHEDULED_MAINTENANCE, ...])
549
+ ```
550
+
551
+ ```
552
+ SCHEDULED_MAINTENANCE
863
553
  {
864
- 'id' => RULE_ID,
865
- 'contact_id' => CONTACT_ID,
866
- 'entity_tags' => [STRING, ...]
867
- 'entities' => [STRING, ...],
868
- 'time_restrictions' => [],
869
- 'warning_media' => [STRING, ...],
870
- 'critical_media' => [STRING, ...],
871
- 'warning_blackhole' => BOOLEAN,
872
- 'critical_blackhole' => BOOLEAN
554
+ :start_time => DATETIME,
555
+ :duration => INTEGER,
556
+ :summary => STRING
873
557
  }
874
558
  ```
875
559
 
876
- ---
877
- <a name="update_notification_rule">&nbsp;</a>
878
- Updates a notification rule for a contact.
560
+ Returns true if creation succeeded or false if creation failed.
561
+
562
+ <a name="delete_scheduled_maintenances_checks">&nbsp;</a>
563
+ ### delete_scheduled_maintenances_checks
564
+
565
+ Delete scheduled maintenance periods starting at a specific time for one or more checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
879
566
 
880
567
  ```ruby
881
- # rule_id (String, required)
882
- # rule_data (Hash, will be converted via to_json)
883
- # contact_id (String, required)
884
- # entity_tags (Array of Strings, may be empty; either this or 'entities' must have some content)
885
- # entities (Array of Strings, may be empty; either this or 'entity_tags' must have some content)
886
- # time_restrictions (TBD)
887
- # warning_media (Array of Strings, may be empty; each represents a media type)
888
- # critical_media (Array of Strings, may be empty; each represents a media type)
889
- # warning_blackhole (Boolean, required)
890
- # critical_blackhole (Boolean, required)
891
- Flapjack::Diner.update_notification_rule!('08f607c7-618d-460a-b3fe-868464eb6045', {
892
- 'contact_id' => 'contact23',
893
- 'entity_tags' => ['database'],
894
- 'entities' => ['app-1.example.com']
895
- 'time_restrictions' => [],
896
- 'warning_media' => ['email'],
897
- 'critical_media' => ['email', 'sms'],
898
- 'warning_blackhole' => false,
899
- 'critical_blackhole' => false
900
- })
568
+ Flapjack::Diner.delete_scheduled_maintenances_checks(CHECK_ID(S), :start_time => DATETIME)
901
569
  ```
902
570
 
903
- Returns a hash represeting the updated notification rule. This is the same data you would receive from ```Flapjack::Diner.notification_rule(rule_id)```.
571
+ Returns true if deletion succeeded or false if deletion failed. Raises an exception if the `:start_time` parameter is not supplied.
572
+
573
+ <a name="create_unscheduled_maintenances_checks">&nbsp;</a>
574
+ ### create_unscheduled_maintenances_checks
575
+
576
+ Acknowledges any failing checks from those passed and sets up unscheduled maintenance (`duration` seconds long) on them. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
904
577
 
905
578
  ```ruby
906
- # RULE_ID (String, as provided in the request)
907
- # CONTACT_ID (String)
579
+ Flapjack::Diner.create_unscheduled_maintenances_checks(CHECK_ID(S), [SCHEDULED_MAINTENANCE, ...])
580
+ ```
581
+
582
+ ```
583
+ UNSCHEDULED_MAINTENANCE
908
584
  {
909
- 'id' => RULE_ID,
910
- 'contact_id' => CONTACT_ID,
911
- 'entity_tags' => [STRING, ...]
912
- 'entities' => [STRING, ...],
913
- 'time_restrictions' => [],
914
- 'warning_media' => [STRING, ...],
915
- 'critical_media' => [STRING, ...],
916
- 'warning_blackhole' => BOOLEAN,
917
- 'critical_blackhole' => BOOLEAN
585
+ :duration => INTEGER,
586
+ :summary => STRING
918
587
  }
919
588
  ```
920
589
 
921
- ---
922
- <a name="delete_notification_rule">&nbsp;</a>
923
- Deletes a notification rule from a contact.
590
+ Returns true if creation succeeded or false if creation failed.
591
+
592
+ <a name="update_unscheduled_maintenances_checks">&nbsp;</a>
593
+ ### update_unscheduled_maintenances_checks
594
+
595
+ Finalises currently existing unscheduled maintenance periods for acknowledged checks. The periods end at the time provided in the `:end_time` parameter. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
924
596
 
925
597
  ```ruby
926
- # rule_id (String, required)
927
- Flapjack::Diner.delete_notification_rule!('08f607c7-618d-460a-b3fe-868464eb6045')
598
+ Flapjack::Diner.update_unscheduled_maintenances_checks(CHECK_ID(S), :end_time => DATETIME)
928
599
  ```
929
600
 
930
- Returns a boolean value representing the success or otherwise of the deletion of the notification rule.
601
+ Returns true if the finalisation succeeded or false if deletion failed.
931
602
 
932
- ---
933
- <a name="notification_media">&nbsp;</a>
934
- Return a list of a contact's notification media values.
603
+ <a name="create_test_notifications_checks">&nbsp;</a>
604
+ ### create_test_notifications_checks
605
+
606
+ Instructs Flapjack to issue test notifications on the passed checks. These notifications will be sent to contacts configured to receive notifications for those checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
935
607
 
936
608
  ```ruby
937
- # contact_id (String, required)
938
- Flapjack::Diner.contact_media('contact23')
609
+ Flapjack::Diner.create_test_notifications_checks(CHECK_ID(S), [TEST_NOTIFICATION, ...])
939
610
  ```
940
611
 
941
- Returns a hash of hashes, where the first layer of keys are the media types (e.g. 'email', 'sms') and the
942
- hashes for each of those media type keys contain address and notification interval values.
943
-
944
- ```ruby
945
- # interval (Integer, in seconds - notifications will not be sent more often than this through this medium)
612
+ ```
613
+ TEST_NOTIFICATION
946
614
  {
947
- MEDIA_TYPE => { 'address' => STRING,
948
- 'interval' => INTEGER },
949
- ...
615
+ :summary => STRING
950
616
  }
951
617
  ```
952
618
 
619
+ Returns true if creation succeeded or false if creation failed.
620
+
953
621
  ---
954
- <a name="notification_medium">&nbsp;</a>
955
- Get the values for a contact's notification medium.
622
+
623
+ <a name="status_report_entities">&nbsp;</a>
624
+ ### status_report_entities
625
+
626
+ Return a report on status data for checks in one, some or all entities.
956
627
 
957
628
  ```ruby
958
- # contact_id (String, required)
959
- # media_type (String, required)
960
- Flapjack::Diner.contact_medium('contact23', 'sms')
629
+ report = Flapjack::Diner.status_report_entities(ENTITY_ID)
630
+ report_some = Flapjack::Diner.status_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
631
+ report_all = Flapjack::Diner.status_report_entities
961
632
  ```
962
633
 
963
- Returns a hash corresponding to a single hash of medium values from those returned by ```Flapjack::Diner.contact_media()```.
634
+ <a name="scheduled_maintenance_report_entities">&nbsp;</a>
635
+ ### scheduled_maintenance_report_entities
636
+
637
+ Return a report on scheduled maintenance periods for checks in one, some or all entities.
964
638
 
965
639
  ```ruby
966
- # interval (Integer, in seconds - notifications will not be sent more often than this through this medium)
967
- { 'address' => STRING,
968
- 'interval' => INTEGER },
640
+ report = Flapjack::Diner.scheduled_maintenance_report_entities(ENTITY_ID)
641
+ report_some = Flapjack::Diner.scheduled_maintenance_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
642
+ report_all = Flapjack::Diner.scheduled_maintenance_report_entities
969
643
  ```
970
644
 
971
- ---
972
- <a name="update_notification_medium">&nbsp;</a>
973
- Update the values for a contact's notification medium.
645
+ <a name="unscheduled_maintenance_report_entities">&nbsp;</a>
646
+ ### unscheduled_maintenance_report_entities
647
+
648
+ Return a report on unscheduled maintenance periods for checks in one, some or all entities.
974
649
 
975
650
  ```ruby
976
- # contact_id (String, required)
977
- # media_type (String, required)
978
- Flapjack::Diner.update_contact_medium!('contact23', 'email', {
979
- 'address' => 'example@example.com',
980
- 'interval' => 300
981
- })
651
+ report = Flapjack::Diner.unscheduled_maintenance_report_entities(ENTITY_ID)
652
+ report_some = Flapjack::Diner.unscheduled_maintenance_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
653
+ report_all = Flapjack::Diner.unscheduled_maintenance_report_entities
982
654
  ```
983
655
 
984
- Returns the hash that was submitted.
656
+ <a name="downtime_report_entities">&nbsp;</a>
657
+ ### downtime_report_entities
658
+
659
+ Return a report on downtime data for checks in one, some or all entities.
985
660
 
986
661
  ```ruby
987
- # interval (Integer, in seconds - notifications will not be sent more often than this through this medium)
988
- { 'address' => STRING,
989
- 'interval' => INTEGER },
662
+ report = Flapjack::Diner.downtime_report_entities(ENTITY_ID)
663
+ report_some = Flapjack::Diner.downtime_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
664
+ report_all = Flapjack::Diner.downtime_report_entities
990
665
  ```
991
666
 
992
- ---
993
- <a name="delete_notification_medium">&nbsp;</a>
994
- Delete a contact's notification medium.
667
+ <a name="outage_report_entities">&nbsp;</a>
668
+ ### outage_report_entities
669
+
670
+ Return a report on outage data for checks in one, some or all entities.
995
671
 
996
672
  ```ruby
997
- # contact_id (String, required)
998
- # media_type (String, required)
999
- Flapjack::Diner.delete_contact_medium!('contact23', 'sms')
673
+ report = Flapjack::Diner.outage_report_entities(ENTITY_ID)
674
+ report_some = Flapjack::Diner.outage_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
675
+ report_all = Flapjack::Diner.outage_report_entities
1000
676
  ```
1001
677
 
1002
- Returns a boolean value representing the success or otherwise of the deletion of the notification medium values.
678
+ <a name="status_report_checks">&nbsp;</a>
679
+ ### status_report_checks
1003
680
 
1004
- ---
1005
- <a name="contact_timezone">&nbsp;</a>
1006
- Get a contact's timezone.
681
+ Return a report on status data for one, some or all checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
1007
682
 
1008
683
  ```ruby
1009
- # contact_id (String, required)
1010
- Flapjack::Diner.contact_timezone('contact23')
684
+ report = Flapjack::Diner.status_report_checks(CHECK_ID)
685
+ report_some = Flapjack::Diner.status_report_checks(CHECK_ID1, CHECK_ID2, ...)
686
+ report_all = Flapjack::Diner.status_report_checks
1011
687
  ```
1012
688
 
1013
- Returns a timezone string, as defined in the [timezone database](http://www.twinsun.com/tz/tz-link.htm).
689
+ <a name="scheduled_maintenance_report_checks">&nbsp;</a>
690
+ ### scheduled_maintenance_report_checks
691
+
692
+ Return a report on scheduled maintenance periods for one, some or all checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
1014
693
 
1015
694
  ```ruby
1016
- 'Australia/Perth'
695
+ report = Flapjack::Diner.scheduled_maintenance_report_checks(CHECK_ID)
696
+ report_some = Flapjack::Diner.scheduled_maintenance_report_checks(CHECK_ID1, CHECK_ID2, ...)
697
+ report_all = Flapjack::Diner.scheduled_maintenance_report_checks
1017
698
  ```
1018
699
 
1019
- ---
1020
- <a name="update_contact_timezone">&nbsp;</a>
1021
- Update a contact's timezone.
700
+ <a name="unscheduled_maintenance_report_checks">&nbsp;</a>
701
+ ### unscheduled_maintenance_report_checks
702
+
703
+ Return a report on unscheduled maintenance periods for one, some or all checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
1022
704
 
1023
705
  ```ruby
1024
- # contact_id (String, required)
1025
- # timezone (String, required)
1026
- Flapjack::Diner.update_contact_timezone!('contact23', 'Australia/Sydney')
706
+ report = Flapjack::Diner.unscheduled_maintenance_report_checks(CHECK_ID)
707
+ report_some = Flapjack::Diner.unscheduled_maintenance_report_checks(CHECK_ID1, CHECK_ID2, ...)
708
+ report_all = Flapjack::Diner.unscheduled_maintenance_report_checks
1027
709
  ```
1028
710
 
1029
- Returns the timezone string provided as a parameter.
711
+ <a name="downtime_report_checks">&nbsp;</a>
712
+ ### downtime_report_checks
713
+
714
+ Return a report on downtim data for one, some or all checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
1030
715
 
1031
716
  ```ruby
1032
- 'Australia/Sydney'
717
+ report = Flapjack::Diner.downtime_report_checks(CHECK_ID)
718
+ report_some = Flapjack::Diner.downtime_report_checks(CHECK_ID1, CHECK_ID2, ...)
719
+ report_all = Flapjack::Diner.downtime_report_checks
1033
720
  ```
1034
721
 
1035
- ---
1036
- <a name="delete_contact_timezone">&nbsp;</a>
1037
- Delete a contact's timezone. (If a contact's timezone is unknown they will be assumed to share the Flapjack server's timezone.)
722
+ <a name="outage_report_checks">&nbsp;</a>
723
+ ### outage_report_checks
724
+
725
+ Return a report on outage data for one, some or all checks. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
1038
726
 
1039
727
  ```ruby
1040
- # contact_id (String, required)
1041
- Flapjack::Diner.delete_contact_timezone!('contact_23')
728
+ report = Flapjack::Diner.outage_report_checks(CHECK_ID)
729
+ report_some = Flapjack::Diner.outage_report_checks(CHECK_ID1, CHECK_ID2, ...)
730
+ report_all = Flapjack::Diner.outage_report_checks
1042
731
  ```
1043
732
 
1044
- Returns a boolean value representing the success or otherwise of the deletion of the contact's timezone.
1045
-
1046
733
  ---
1047
734
 
1048
735
  ## Contributing