flapjack 1.1.0 → 1.2.0rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +12 -7
  5. data/CHANGELOG.md +12 -0
  6. data/Gemfile +6 -2
  7. data/Gemfile-ruby1.9 +29 -0
  8. data/Gemfile-ruby1.9.lock +251 -0
  9. data/README.md +2 -2
  10. data/Rakefile +1 -0
  11. data/etc/flapjack_config.yaml.example +2 -2
  12. data/features/steps/events_steps.rb +2 -2
  13. data/features/steps/flapjack-netsaint-parser_steps.rb +1 -1
  14. data/features/support/env.rb +1 -6
  15. data/lib/flapjack/cli/import.rb +2 -5
  16. data/lib/flapjack/cli/purge.rb +4 -4
  17. data/lib/flapjack/cli/receiver.rb +122 -54
  18. data/lib/flapjack/cli/server.rb +0 -5
  19. data/lib/flapjack/coordinator.rb +6 -0
  20. data/lib/flapjack/data/contact.rb +10 -62
  21. data/lib/flapjack/data/entity.rb +36 -52
  22. data/lib/flapjack/data/entity_check.rb +90 -21
  23. data/lib/flapjack/data/event.rb +4 -5
  24. data/lib/flapjack/data/notification.rb +8 -10
  25. data/lib/flapjack/data/notification_rule.rb +32 -35
  26. data/lib/flapjack/data/tagged.rb +48 -0
  27. data/lib/flapjack/gateways/jabber.rb +4 -5
  28. data/lib/flapjack/gateways/jsonapi/check_methods.rb +45 -7
  29. data/lib/flapjack/gateways/jsonapi/check_presenter.rb +1 -1
  30. data/lib/flapjack/gateways/jsonapi/contact_methods.rb +8 -2
  31. data/lib/flapjack/gateways/jsonapi/entity_methods.rb +26 -8
  32. data/lib/flapjack/gateways/jsonapi/medium_methods.rb +13 -9
  33. data/lib/flapjack/gateways/jsonapi/metrics_methods.rb +2 -2
  34. data/lib/flapjack/gateways/jsonapi/notification_rule_methods.rb +1 -1
  35. data/lib/flapjack/gateways/jsonapi/pagerduty_credential_methods.rb +24 -17
  36. data/lib/flapjack/gateways/jsonapi/rack/json_params_parser.rb +1 -1
  37. data/lib/flapjack/gateways/jsonapi/report_methods.rb +4 -4
  38. data/lib/flapjack/gateways/jsonapi.rb +52 -31
  39. data/lib/flapjack/gateways/oobetet.rb +2 -3
  40. data/lib/flapjack/gateways/pagerduty.rb +9 -8
  41. data/lib/flapjack/gateways/web/public/js/backbone.jsonapi.js +19 -0
  42. data/lib/flapjack/gateways/web/public/js/flapjack.js +6 -2
  43. data/lib/flapjack/gateways/web/public/js/modules/contact.js +9 -14
  44. data/lib/flapjack/gateways/web/public/js/modules/medium.js +1 -0
  45. data/lib/flapjack/gateways/web/public/js/self_stats.js +1 -1
  46. data/lib/flapjack/gateways/web/views/edit_contacts.html.erb +3 -3
  47. data/lib/flapjack/gateways/web.rb +8 -7
  48. data/lib/flapjack/notifier.rb +2 -4
  49. data/lib/flapjack/processor.rb +2 -2
  50. data/lib/flapjack/version.rb +1 -1
  51. data/lib/flapjack.rb +10 -0
  52. data/spec/lib/flapjack/coordinator_spec.rb +18 -0
  53. data/spec/lib/flapjack/data/contact_spec.rb +4 -12
  54. data/spec/lib/flapjack/data/entity_check_spec.rb +56 -3
  55. data/spec/lib/flapjack/data/entity_spec.rb +79 -67
  56. data/spec/lib/flapjack/data/event_spec.rb +78 -78
  57. data/spec/lib/flapjack/data/notification_rule_spec.rb +4 -2
  58. data/spec/lib/flapjack/gateways/jsonapi/check_methods_spec.rb +94 -11
  59. data/spec/lib/flapjack/gateways/jsonapi/entity_methods_spec.rb +84 -0
  60. data/spec/lib/flapjack/gateways/pagerduty_spec.rb +5 -3
  61. data/spec/lib/flapjack/gateways/web_spec.rb +3 -3
  62. data/spec/service_consumers/pact_helper.rb +74 -0
  63. data/spec/service_consumers/pacts/flapjack-diner_v1.0.json +4522 -0
  64. data/spec/service_consumers/provider_states_for_flapjack-diner.rb +356 -0
  65. data/spec/spec_helper.rb +0 -8
  66. data/spec/support/jsonapi_helper.rb +1 -1
  67. data/tasks/benchmarks.rake +6 -3
  68. data/tasks/profile.rake +1 -1
  69. data/tmp/acknowledge.rb +0 -3
  70. data/tmp/create_event_ok.rb +0 -3
  71. data/tmp/create_event_unknown.rb +0 -3
  72. data/tmp/create_events_failure.rb +0 -3
  73. data/tmp/create_events_ok.rb +0 -3
  74. data/tmp/create_events_ok_fail_ack_ok.rb +0 -3
  75. data/tmp/create_events_ok_failure.rb +2 -5
  76. data/tmp/create_events_ok_failure_ack.rb +0 -3
  77. data/tmp/test_json_post.rb +4 -3
  78. data/tmp/test_notification_rules_api.rb +2 -3
  79. metadata +13 -8
  80. data/lib/flapjack/data/tag.rb +0 -61
  81. data/lib/flapjack/data/tag_set.rb +0 -16
  82. data/spec/lib/flapjack/data/tag_spec.rb +0 -36
@@ -0,0 +1,4522 @@
1
+ {
2
+ "provider": {
3
+ "name": "flapjack"
4
+ },
5
+ "consumer": {
6
+ "name": "flapjack-diner"
7
+ },
8
+ "interactions": [
9
+ {
10
+ "description": "a GET request for a downtime report on all checks",
11
+ "provider_state": "a check 'www.example.com:SSH' exists",
12
+ "request": {
13
+ "method": "get",
14
+ "path": "/downtime_report/checks"
15
+ },
16
+ "response": {
17
+ "status": 200,
18
+ "headers": {
19
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
20
+ },
21
+ "body": {
22
+ "downtime_reports": [
23
+ {
24
+ }
25
+ ]
26
+ }
27
+ }
28
+ },
29
+ {
30
+ "description": "a GET request for a outage report on one entity",
31
+ "provider_state": "a check 'www.example.com:SSH' exists",
32
+ "request": {
33
+ "method": "get",
34
+ "path": "/outage_report/entities/1234"
35
+ },
36
+ "response": {
37
+ "status": 200,
38
+ "headers": {
39
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
40
+ },
41
+ "body": {
42
+ "outage_reports": [
43
+ {
44
+ "outages": [
45
+
46
+ ],
47
+ "links": {
48
+ "entity": [
49
+ "1234"
50
+ ],
51
+ "check": [
52
+ "www.example.com:SSH"
53
+ ]
54
+ }
55
+ }
56
+ ]
57
+ }
58
+ }
59
+ },
60
+ {
61
+ "description": "a time limited GET request for a downtime report on all entities",
62
+ "provider_state": "a check 'www.example.com:SSH' exists",
63
+ "request": {
64
+ "method": "get",
65
+ "path": "/downtime_report/entities",
66
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
67
+ },
68
+ "response": {
69
+ "status": 200,
70
+ "headers": {
71
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
72
+ },
73
+ "body": {
74
+ "downtime_reports": [
75
+ {
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ },
81
+ {
82
+ "description": "a GET request for a scheduled_maintenance report on two entities",
83
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
84
+ "request": {
85
+ "method": "get",
86
+ "path": "/scheduled_maintenance_report/entities/1234,5678"
87
+ },
88
+ "response": {
89
+ "status": 200,
90
+ "headers": {
91
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
92
+ },
93
+ "body": {
94
+ "scheduled_maintenance_reports": [
95
+ {
96
+ "scheduled_maintenances": [
97
+
98
+ ],
99
+ "links": {
100
+ "entity": [
101
+ "1234"
102
+ ],
103
+ "check": [
104
+ "www.example.com:SSH"
105
+ ]
106
+ }
107
+ },
108
+ {
109
+ "scheduled_maintenances": [
110
+
111
+ ],
112
+ "links": {
113
+ "entity": [
114
+ "5678"
115
+ ],
116
+ "check": [
117
+ "www2.example.com:PING"
118
+ ]
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ },
125
+ {
126
+ "description": "a time limited GET request for a downtime report on all checks",
127
+ "provider_state": "a check 'www.example.com:SSH' exists",
128
+ "request": {
129
+ "method": "get",
130
+ "path": "/downtime_report/checks",
131
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
132
+ },
133
+ "response": {
134
+ "status": 200,
135
+ "headers": {
136
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
137
+ },
138
+ "body": {
139
+ "downtime_reports": [
140
+ {
141
+ }
142
+ ]
143
+ }
144
+ }
145
+ },
146
+ {
147
+ "description": "a time limited GET request for a scheduled_maintenance report on a single check",
148
+ "provider_state": "a check 'www.example.com:SSH' exists",
149
+ "request": {
150
+ "method": "get",
151
+ "path": "/scheduled_maintenance_report/checks/www.example.com:SSH",
152
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
153
+ },
154
+ "response": {
155
+ "status": 200,
156
+ "headers": {
157
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
158
+ },
159
+ "body": {
160
+ "scheduled_maintenance_reports": [
161
+ {
162
+ "scheduled_maintenances": [
163
+
164
+ ],
165
+ "links": {
166
+ "entity": [
167
+ "1234"
168
+ ],
169
+ "check": [
170
+ "www.example.com:SSH"
171
+ ]
172
+ }
173
+ }
174
+ ]
175
+ }
176
+ }
177
+ },
178
+ {
179
+ "description": "a GET request for a unscheduled_maintenance report on one entity",
180
+ "provider_state": "a check 'www.example.com:SSH' exists",
181
+ "request": {
182
+ "method": "get",
183
+ "path": "/unscheduled_maintenance_report/entities/1234"
184
+ },
185
+ "response": {
186
+ "status": 200,
187
+ "headers": {
188
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
189
+ },
190
+ "body": {
191
+ "unscheduled_maintenance_reports": [
192
+ {
193
+ "unscheduled_maintenances": [
194
+
195
+ ],
196
+ "links": {
197
+ "entity": [
198
+ "1234"
199
+ ],
200
+ "check": [
201
+ "www.example.com:SSH"
202
+ ]
203
+ }
204
+ }
205
+ ]
206
+ }
207
+ }
208
+ },
209
+ {
210
+ "description": "a time limited GET request for a outage report on all checks",
211
+ "provider_state": "a check 'www.example.com:SSH' exists",
212
+ "request": {
213
+ "method": "get",
214
+ "path": "/outage_report/checks",
215
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
216
+ },
217
+ "response": {
218
+ "status": 200,
219
+ "headers": {
220
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
221
+ },
222
+ "body": {
223
+ "outage_reports": [
224
+ {
225
+ "outages": [
226
+
227
+ ],
228
+ "links": {
229
+ "entity": [
230
+ "1234"
231
+ ],
232
+ "check": [
233
+ "www.example.com:SSH"
234
+ ]
235
+ }
236
+ }
237
+ ]
238
+ }
239
+ }
240
+ },
241
+ {
242
+ "description": "a time limited GET request for a unscheduled_maintenance report on two entities",
243
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
244
+ "request": {
245
+ "method": "get",
246
+ "path": "/unscheduled_maintenance_report/entities/1234,5678",
247
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
248
+ },
249
+ "response": {
250
+ "status": 200,
251
+ "headers": {
252
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
253
+ },
254
+ "body": {
255
+ "unscheduled_maintenance_reports": [
256
+ {
257
+ "unscheduled_maintenances": [
258
+
259
+ ],
260
+ "links": {
261
+ "entity": [
262
+ "1234"
263
+ ],
264
+ "check": [
265
+ "www.example.com:SSH"
266
+ ]
267
+ }
268
+ },
269
+ {
270
+ "unscheduled_maintenances": [
271
+
272
+ ],
273
+ "links": {
274
+ "entity": [
275
+ "5678"
276
+ ],
277
+ "check": [
278
+ "www2.example.com:PING"
279
+ ]
280
+ }
281
+ }
282
+ ]
283
+ }
284
+ }
285
+ },
286
+ {
287
+ "description": "a GET request for a scheduled_maintenance report on two checks",
288
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
289
+ "request": {
290
+ "method": "get",
291
+ "path": "/scheduled_maintenance_report/checks/www.example.com:SSH,www2.example.com:PING"
292
+ },
293
+ "response": {
294
+ "status": 200,
295
+ "headers": {
296
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
297
+ },
298
+ "body": {
299
+ "scheduled_maintenance_reports": [
300
+ {
301
+ "scheduled_maintenances": [
302
+
303
+ ],
304
+ "links": {
305
+ "entity": [
306
+ "1234"
307
+ ],
308
+ "check": [
309
+ "www.example.com:SSH"
310
+ ]
311
+ }
312
+ },
313
+ {
314
+ "scheduled_maintenances": [
315
+
316
+ ],
317
+ "links": {
318
+ "entity": [
319
+ "5678"
320
+ ],
321
+ "check": [
322
+ "www2.example.com:PING"
323
+ ]
324
+ }
325
+ }
326
+ ]
327
+ }
328
+ }
329
+ },
330
+ {
331
+ "description": "a time-limited GET request for a unscheduled_maintenance report on two checks",
332
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
333
+ "request": {
334
+ "method": "get",
335
+ "path": "/unscheduled_maintenance_report/checks/www.example.com:SSH,www2.example.com:PING",
336
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
337
+ },
338
+ "response": {
339
+ "status": 200,
340
+ "headers": {
341
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
342
+ },
343
+ "body": {
344
+ "unscheduled_maintenance_reports": [
345
+ {
346
+ "unscheduled_maintenances": [
347
+
348
+ ],
349
+ "links": {
350
+ "entity": [
351
+ "1234"
352
+ ],
353
+ "check": [
354
+ "www.example.com:SSH"
355
+ ]
356
+ }
357
+ },
358
+ {
359
+ "unscheduled_maintenances": [
360
+
361
+ ],
362
+ "links": {
363
+ "entity": [
364
+ "5678"
365
+ ],
366
+ "check": [
367
+ "www2.example.com:PING"
368
+ ]
369
+ }
370
+ }
371
+ ]
372
+ }
373
+ }
374
+ },
375
+ {
376
+ "description": "a time limited GET request for a unscheduled_maintenance report on one entity",
377
+ "provider_state": "a check 'www.example.com:SSH' exists",
378
+ "request": {
379
+ "method": "get",
380
+ "path": "/unscheduled_maintenance_report/entities/1234",
381
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
382
+ },
383
+ "response": {
384
+ "status": 200,
385
+ "headers": {
386
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
387
+ },
388
+ "body": {
389
+ "unscheduled_maintenance_reports": [
390
+ {
391
+ "unscheduled_maintenances": [
392
+
393
+ ],
394
+ "links": {
395
+ "entity": [
396
+ "1234"
397
+ ],
398
+ "check": [
399
+ "www.example.com:SSH"
400
+ ]
401
+ }
402
+ }
403
+ ]
404
+ }
405
+ }
406
+ },
407
+ {
408
+ "description": "a time limited GET request for a outage report on one entity",
409
+ "provider_state": "a check 'www.example.com:SSH' exists",
410
+ "request": {
411
+ "method": "get",
412
+ "path": "/outage_report/entities/1234",
413
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
414
+ },
415
+ "response": {
416
+ "status": 200,
417
+ "headers": {
418
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
419
+ },
420
+ "body": {
421
+ "outage_reports": [
422
+ {
423
+ "outages": [
424
+
425
+ ],
426
+ "links": {
427
+ "entity": [
428
+ "1234"
429
+ ],
430
+ "check": [
431
+ "www.example.com:SSH"
432
+ ]
433
+ }
434
+ }
435
+ ]
436
+ }
437
+ }
438
+ },
439
+ {
440
+ "description": "a GET request for a status report on all checks",
441
+ "provider_state": "a check 'www.example.com:SSH' exists",
442
+ "request": {
443
+ "method": "get",
444
+ "path": "/status_report/checks"
445
+ },
446
+ "response": {
447
+ "status": 200,
448
+ "headers": {
449
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
450
+ },
451
+ "body": {
452
+ "status_reports": [
453
+ {
454
+ }
455
+ ]
456
+ }
457
+ }
458
+ },
459
+ {
460
+ "description": "a GET request for a downtime report on a single check",
461
+ "provider_state": "a check 'www.example.com:SSH' exists",
462
+ "request": {
463
+ "method": "get",
464
+ "path": "/downtime_report/checks/www.example.com:SSH"
465
+ },
466
+ "response": {
467
+ "status": 200,
468
+ "headers": {
469
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
470
+ },
471
+ "body": {
472
+ "downtime_reports": [
473
+ {
474
+ }
475
+ ]
476
+ }
477
+ }
478
+ },
479
+ {
480
+ "description": "a GET request for a status report on two checks",
481
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
482
+ "request": {
483
+ "method": "get",
484
+ "path": "/status_report/checks/www.example.com:SSH,www2.example.com:PING"
485
+ },
486
+ "response": {
487
+ "status": 200,
488
+ "headers": {
489
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
490
+ },
491
+ "body": {
492
+ "status_reports": [
493
+ {
494
+ },
495
+ {
496
+ }
497
+ ]
498
+ }
499
+ }
500
+ },
501
+ {
502
+ "description": "a GET request for a scheduled_maintenance report on one entity",
503
+ "provider_state": "a check 'www.example.com:SSH' exists",
504
+ "request": {
505
+ "method": "get",
506
+ "path": "/scheduled_maintenance_report/entities/1234"
507
+ },
508
+ "response": {
509
+ "status": 200,
510
+ "headers": {
511
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
512
+ },
513
+ "body": {
514
+ "scheduled_maintenance_reports": [
515
+ {
516
+ "scheduled_maintenances": [
517
+
518
+ ],
519
+ "links": {
520
+ "entity": [
521
+ "1234"
522
+ ],
523
+ "check": [
524
+ "www.example.com:SSH"
525
+ ]
526
+ }
527
+ }
528
+ ]
529
+ }
530
+ }
531
+ },
532
+ {
533
+ "description": "a time limited GET request for a scheduled_maintenance report on all checks",
534
+ "provider_state": "a check 'www.example.com:SSH' exists",
535
+ "request": {
536
+ "method": "get",
537
+ "path": "/scheduled_maintenance_report/checks",
538
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
539
+ },
540
+ "response": {
541
+ "status": 200,
542
+ "headers": {
543
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
544
+ },
545
+ "body": {
546
+ "scheduled_maintenance_reports": [
547
+ {
548
+ "scheduled_maintenances": [
549
+
550
+ ],
551
+ "links": {
552
+ "entity": [
553
+ "1234"
554
+ ],
555
+ "check": [
556
+ "www.example.com:SSH"
557
+ ]
558
+ }
559
+ }
560
+ ]
561
+ }
562
+ }
563
+ },
564
+ {
565
+ "description": "a time limited GET request for a scheduled_maintenance report on two entities",
566
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
567
+ "request": {
568
+ "method": "get",
569
+ "path": "/scheduled_maintenance_report/entities/1234,5678",
570
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
571
+ },
572
+ "response": {
573
+ "status": 200,
574
+ "headers": {
575
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
576
+ },
577
+ "body": {
578
+ "scheduled_maintenance_reports": [
579
+ {
580
+ "scheduled_maintenances": [
581
+
582
+ ],
583
+ "links": {
584
+ "entity": [
585
+ "1234"
586
+ ],
587
+ "check": [
588
+ "www.example.com:SSH"
589
+ ]
590
+ }
591
+ },
592
+ {
593
+ "scheduled_maintenances": [
594
+
595
+ ],
596
+ "links": {
597
+ "entity": [
598
+ "5678"
599
+ ],
600
+ "check": [
601
+ "www2.example.com:PING"
602
+ ]
603
+ }
604
+ }
605
+ ]
606
+ }
607
+ }
608
+ },
609
+ {
610
+ "description": "a GET request for a downtime report on two entities",
611
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
612
+ "request": {
613
+ "method": "get",
614
+ "path": "/downtime_report/entities/1234,5678"
615
+ },
616
+ "response": {
617
+ "status": 200,
618
+ "headers": {
619
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
620
+ },
621
+ "body": {
622
+ "downtime_reports": [
623
+ {
624
+ },
625
+ {
626
+ }
627
+ ]
628
+ }
629
+ }
630
+ },
631
+ {
632
+ "description": "a GET request for a unscheduled_maintenance report on all checks",
633
+ "provider_state": "a check 'www.example.com:SSH' exists",
634
+ "request": {
635
+ "method": "get",
636
+ "path": "/unscheduled_maintenance_report/checks"
637
+ },
638
+ "response": {
639
+ "status": 200,
640
+ "headers": {
641
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
642
+ },
643
+ "body": {
644
+ "unscheduled_maintenance_reports": [
645
+ {
646
+ "unscheduled_maintenances": [
647
+
648
+ ],
649
+ "links": {
650
+ "entity": [
651
+ "1234"
652
+ ],
653
+ "check": [
654
+ "www.example.com:SSH"
655
+ ]
656
+ }
657
+ }
658
+ ]
659
+ }
660
+ }
661
+ },
662
+ {
663
+ "description": "a time limited GET request for a outage report on a single check",
664
+ "provider_state": "a check 'www.example.com:SSH' exists",
665
+ "request": {
666
+ "method": "get",
667
+ "path": "/outage_report/checks/www.example.com:SSH",
668
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
669
+ },
670
+ "response": {
671
+ "status": 200,
672
+ "headers": {
673
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
674
+ },
675
+ "body": {
676
+ "outage_reports": [
677
+ {
678
+ "outages": [
679
+
680
+ ],
681
+ "links": {
682
+ "entity": [
683
+ "1234"
684
+ ],
685
+ "check": [
686
+ "www.example.com:SSH"
687
+ ]
688
+ }
689
+ }
690
+ ]
691
+ }
692
+ }
693
+ },
694
+ {
695
+ "description": "a GET request for a scheduled_maintenance report on all entities",
696
+ "provider_state": "a check 'www.example.com:SSH' exists",
697
+ "request": {
698
+ "method": "get",
699
+ "path": "/scheduled_maintenance_report/entities"
700
+ },
701
+ "response": {
702
+ "status": 200,
703
+ "headers": {
704
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
705
+ },
706
+ "body": {
707
+ "scheduled_maintenance_reports": [
708
+ {
709
+ "scheduled_maintenances": [
710
+
711
+ ],
712
+ "links": {
713
+ "entity": [
714
+ "1234"
715
+ ],
716
+ "check": [
717
+ "www.example.com:SSH"
718
+ ]
719
+ }
720
+ }
721
+ ]
722
+ }
723
+ }
724
+ },
725
+ {
726
+ "description": "a GET request for a unscheduled_maintenance report on a single check",
727
+ "provider_state": "a check 'www.example.com:SSH' exists",
728
+ "request": {
729
+ "method": "get",
730
+ "path": "/unscheduled_maintenance_report/checks/www.example.com:SSH"
731
+ },
732
+ "response": {
733
+ "status": 200,
734
+ "headers": {
735
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
736
+ },
737
+ "body": {
738
+ "unscheduled_maintenance_reports": [
739
+ {
740
+ "unscheduled_maintenances": [
741
+
742
+ ],
743
+ "links": {
744
+ "entity": [
745
+ "1234"
746
+ ],
747
+ "check": [
748
+ "www.example.com:SSH"
749
+ ]
750
+ }
751
+ }
752
+ ]
753
+ }
754
+ }
755
+ },
756
+ {
757
+ "description": "a time limited GET request for a downtime report on two entities",
758
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
759
+ "request": {
760
+ "method": "get",
761
+ "path": "/downtime_report/entities/1234,5678",
762
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
763
+ },
764
+ "response": {
765
+ "status": 200,
766
+ "headers": {
767
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
768
+ },
769
+ "body": {
770
+ "downtime_reports": [
771
+ {
772
+ },
773
+ {
774
+ }
775
+ ]
776
+ }
777
+ }
778
+ },
779
+ {
780
+ "description": "a GET request for a scheduled_maintenance report on a single check",
781
+ "provider_state": "a check 'www.example.com:SSH' exists",
782
+ "request": {
783
+ "method": "get",
784
+ "path": "/scheduled_maintenance_report/checks/www.example.com:SSH"
785
+ },
786
+ "response": {
787
+ "status": 200,
788
+ "headers": {
789
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
790
+ },
791
+ "body": {
792
+ "scheduled_maintenance_reports": [
793
+ {
794
+ "scheduled_maintenances": [
795
+
796
+ ],
797
+ "links": {
798
+ "entity": [
799
+ "1234"
800
+ ],
801
+ "check": [
802
+ "www.example.com:SSH"
803
+ ]
804
+ }
805
+ }
806
+ ]
807
+ }
808
+ }
809
+ },
810
+ {
811
+ "description": "a time limited GET request for a downtime report on one entity",
812
+ "provider_state": "a check 'www.example.com:SSH' exists",
813
+ "request": {
814
+ "method": "get",
815
+ "path": "/downtime_report/entities/1234",
816
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
817
+ },
818
+ "response": {
819
+ "status": 200,
820
+ "headers": {
821
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
822
+ },
823
+ "body": {
824
+ "downtime_reports": [
825
+ {
826
+ }
827
+ ]
828
+ }
829
+ }
830
+ },
831
+ {
832
+ "description": "a GET request for a status report on all entities",
833
+ "provider_state": "a check 'www.example.com:SSH' exists",
834
+ "request": {
835
+ "method": "get",
836
+ "path": "/status_report/entities"
837
+ },
838
+ "response": {
839
+ "status": 200,
840
+ "headers": {
841
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
842
+ },
843
+ "body": {
844
+ "status_reports": [
845
+ {
846
+ }
847
+ ]
848
+ }
849
+ }
850
+ },
851
+ {
852
+ "description": "a GET request for a scheduled_maintenance report on all checks",
853
+ "provider_state": "a check 'www.example.com:SSH' exists",
854
+ "request": {
855
+ "method": "get",
856
+ "path": "/scheduled_maintenance_report/checks"
857
+ },
858
+ "response": {
859
+ "status": 200,
860
+ "headers": {
861
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
862
+ },
863
+ "body": {
864
+ "scheduled_maintenance_reports": [
865
+ {
866
+ "scheduled_maintenances": [
867
+
868
+ ],
869
+ "links": {
870
+ "entity": [
871
+ "1234"
872
+ ],
873
+ "check": [
874
+ "www.example.com:SSH"
875
+ ]
876
+ }
877
+ }
878
+ ]
879
+ }
880
+ }
881
+ },
882
+ {
883
+ "description": "a GET request for a outage report on two checks",
884
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
885
+ "request": {
886
+ "method": "get",
887
+ "path": "/outage_report/checks/www.example.com:SSH,www2.example.com:PING"
888
+ },
889
+ "response": {
890
+ "status": 200,
891
+ "headers": {
892
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
893
+ },
894
+ "body": {
895
+ "outage_reports": [
896
+ {
897
+ "outages": [
898
+
899
+ ],
900
+ "links": {
901
+ "entity": [
902
+ "1234"
903
+ ],
904
+ "check": [
905
+ "www.example.com:SSH"
906
+ ]
907
+ }
908
+ },
909
+ {
910
+ "outages": [
911
+
912
+ ],
913
+ "links": {
914
+ "entity": [
915
+ "5678"
916
+ ],
917
+ "check": [
918
+ "www2.example.com:PING"
919
+ ]
920
+ }
921
+ }
922
+ ]
923
+ }
924
+ }
925
+ },
926
+ {
927
+ "description": "a time limited GET request for a unscheduled_maintenance report on all checks",
928
+ "provider_state": "a check 'www.example.com:SSH' exists",
929
+ "request": {
930
+ "method": "get",
931
+ "path": "/unscheduled_maintenance_report/checks",
932
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
933
+ },
934
+ "response": {
935
+ "status": 200,
936
+ "headers": {
937
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
938
+ },
939
+ "body": {
940
+ "unscheduled_maintenance_reports": [
941
+ {
942
+ "unscheduled_maintenances": [
943
+
944
+ ],
945
+ "links": {
946
+ "entity": [
947
+ "1234"
948
+ ],
949
+ "check": [
950
+ "www.example.com:SSH"
951
+ ]
952
+ }
953
+ }
954
+ ]
955
+ }
956
+ }
957
+ },
958
+ {
959
+ "description": "a GET request for a status report on two entities",
960
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
961
+ "request": {
962
+ "method": "get",
963
+ "path": "/status_report/entities/1234,5678"
964
+ },
965
+ "response": {
966
+ "status": 200,
967
+ "headers": {
968
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
969
+ },
970
+ "body": {
971
+ "status_reports": [
972
+ {
973
+ },
974
+ {
975
+ }
976
+ ]
977
+ }
978
+ }
979
+ },
980
+ {
981
+ "description": "a time-limited GET request for a outage report on two checks",
982
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
983
+ "request": {
984
+ "method": "get",
985
+ "path": "/outage_report/checks/www.example.com:SSH,www2.example.com:PING",
986
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
987
+ },
988
+ "response": {
989
+ "status": 200,
990
+ "headers": {
991
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
992
+ },
993
+ "body": {
994
+ "outage_reports": [
995
+ {
996
+ "outages": [
997
+
998
+ ],
999
+ "links": {
1000
+ "entity": [
1001
+ "1234"
1002
+ ],
1003
+ "check": [
1004
+ "www.example.com:SSH"
1005
+ ]
1006
+ }
1007
+ },
1008
+ {
1009
+ "outages": [
1010
+
1011
+ ],
1012
+ "links": {
1013
+ "entity": [
1014
+ "5678"
1015
+ ],
1016
+ "check": [
1017
+ "www2.example.com:PING"
1018
+ ]
1019
+ }
1020
+ }
1021
+ ]
1022
+ }
1023
+ }
1024
+ },
1025
+ {
1026
+ "description": "a time limited GET request for a scheduled_maintenance report on all entities",
1027
+ "provider_state": "a check 'www.example.com:SSH' exists",
1028
+ "request": {
1029
+ "method": "get",
1030
+ "path": "/scheduled_maintenance_report/entities",
1031
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
1032
+ },
1033
+ "response": {
1034
+ "status": 200,
1035
+ "headers": {
1036
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1037
+ },
1038
+ "body": {
1039
+ "scheduled_maintenance_reports": [
1040
+ {
1041
+ "scheduled_maintenances": [
1042
+
1043
+ ],
1044
+ "links": {
1045
+ "entity": [
1046
+ "1234"
1047
+ ],
1048
+ "check": [
1049
+ "www.example.com:SSH"
1050
+ ]
1051
+ }
1052
+ }
1053
+ ]
1054
+ }
1055
+ }
1056
+ },
1057
+ {
1058
+ "description": "a GET request for a unscheduled_maintenance report on two entities",
1059
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1060
+ "request": {
1061
+ "method": "get",
1062
+ "path": "/unscheduled_maintenance_report/entities/1234,5678"
1063
+ },
1064
+ "response": {
1065
+ "status": 200,
1066
+ "headers": {
1067
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1068
+ },
1069
+ "body": {
1070
+ "unscheduled_maintenance_reports": [
1071
+ {
1072
+ "unscheduled_maintenances": [
1073
+
1074
+ ],
1075
+ "links": {
1076
+ "entity": [
1077
+ "1234"
1078
+ ],
1079
+ "check": [
1080
+ "www.example.com:SSH"
1081
+ ]
1082
+ }
1083
+ },
1084
+ {
1085
+ "unscheduled_maintenances": [
1086
+
1087
+ ],
1088
+ "links": {
1089
+ "entity": [
1090
+ "5678"
1091
+ ],
1092
+ "check": [
1093
+ "www2.example.com:PING"
1094
+ ]
1095
+ }
1096
+ }
1097
+ ]
1098
+ }
1099
+ }
1100
+ },
1101
+ {
1102
+ "description": "a GET request for a downtime report on one entity",
1103
+ "provider_state": "a check 'www.example.com:SSH' exists",
1104
+ "request": {
1105
+ "method": "get",
1106
+ "path": "/downtime_report/entities/1234"
1107
+ },
1108
+ "response": {
1109
+ "status": 200,
1110
+ "headers": {
1111
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1112
+ },
1113
+ "body": {
1114
+ "downtime_reports": [
1115
+ {
1116
+ }
1117
+ ]
1118
+ }
1119
+ }
1120
+ },
1121
+ {
1122
+ "description": "a GET request for a unscheduled_maintenance report on all entities",
1123
+ "provider_state": "a check 'www.example.com:SSH' exists",
1124
+ "request": {
1125
+ "method": "get",
1126
+ "path": "/unscheduled_maintenance_report/entities"
1127
+ },
1128
+ "response": {
1129
+ "status": 200,
1130
+ "headers": {
1131
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1132
+ },
1133
+ "body": {
1134
+ "unscheduled_maintenance_reports": [
1135
+ {
1136
+ "unscheduled_maintenances": [
1137
+
1138
+ ],
1139
+ "links": {
1140
+ "entity": [
1141
+ "1234"
1142
+ ],
1143
+ "check": [
1144
+ "www.example.com:SSH"
1145
+ ]
1146
+ }
1147
+ }
1148
+ ]
1149
+ }
1150
+ }
1151
+ },
1152
+ {
1153
+ "description": "a time limited GET request for a outage report on all entities",
1154
+ "provider_state": "a check 'www.example.com:SSH' exists",
1155
+ "request": {
1156
+ "method": "get",
1157
+ "path": "/outage_report/entities",
1158
+ "query": "start_time=2014-10-02T21%3A10%3A16%2B09%3A30&end_time=2014-10-03T09%3A10%3A16%2B09%3A30"
1159
+ },
1160
+ "response": {
1161
+ "status": 200,
1162
+ "headers": {
1163
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1164
+ },
1165
+ "body": {
1166
+ "outage_reports": [
1167
+ {
1168
+ "outages": [
1169
+
1170
+ ],
1171
+ "links": {
1172
+ "entity": [
1173
+ "1234"
1174
+ ],
1175
+ "check": [
1176
+ "www.example.com:SSH"
1177
+ ]
1178
+ }
1179
+ }
1180
+ ]
1181
+ }
1182
+ }
1183
+ },
1184
+ {
1185
+ "description": "a GET request for a outage report on a single check",
1186
+ "provider_state": "a check 'www.example.com:SSH' exists",
1187
+ "request": {
1188
+ "method": "get",
1189
+ "path": "/outage_report/checks/www.example.com:SSH"
1190
+ },
1191
+ "response": {
1192
+ "status": 200,
1193
+ "headers": {
1194
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1195
+ },
1196
+ "body": {
1197
+ "outage_reports": [
1198
+ {
1199
+ "outages": [
1200
+
1201
+ ],
1202
+ "links": {
1203
+ "entity": [
1204
+ "1234"
1205
+ ],
1206
+ "check": [
1207
+ "www.example.com:SSH"
1208
+ ]
1209
+ }
1210
+ }
1211
+ ]
1212
+ }
1213
+ }
1214
+ },
1215
+ {
1216
+ "description": "a GET request for a status report on a single check",
1217
+ "provider_state": "a check 'www.example.com:SSH' exists",
1218
+ "request": {
1219
+ "method": "get",
1220
+ "path": "/status_report/checks/www.example.com:SSH"
1221
+ },
1222
+ "response": {
1223
+ "status": 200,
1224
+ "headers": {
1225
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1226
+ },
1227
+ "body": {
1228
+ "status_reports": [
1229
+ {
1230
+ }
1231
+ ]
1232
+ }
1233
+ }
1234
+ },
1235
+ {
1236
+ "description": "a GET request for a unscheduled_maintenance report on two checks",
1237
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1238
+ "request": {
1239
+ "method": "get",
1240
+ "path": "/unscheduled_maintenance_report/checks/www.example.com:SSH,www2.example.com:PING"
1241
+ },
1242
+ "response": {
1243
+ "status": 200,
1244
+ "headers": {
1245
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1246
+ },
1247
+ "body": {
1248
+ "unscheduled_maintenance_reports": [
1249
+ {
1250
+ "unscheduled_maintenances": [
1251
+
1252
+ ],
1253
+ "links": {
1254
+ "entity": [
1255
+ "1234"
1256
+ ],
1257
+ "check": [
1258
+ "www.example.com:SSH"
1259
+ ]
1260
+ }
1261
+ },
1262
+ {
1263
+ "unscheduled_maintenances": [
1264
+
1265
+ ],
1266
+ "links": {
1267
+ "entity": [
1268
+ "5678"
1269
+ ],
1270
+ "check": [
1271
+ "www2.example.com:PING"
1272
+ ]
1273
+ }
1274
+ }
1275
+ ]
1276
+ }
1277
+ }
1278
+ },
1279
+ {
1280
+ "description": "a time limited GET request for a scheduled_maintenance report on one entity",
1281
+ "provider_state": "a check 'www.example.com:SSH' exists",
1282
+ "request": {
1283
+ "method": "get",
1284
+ "path": "/scheduled_maintenance_report/entities/1234",
1285
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30&end_time=2014-10-03T09%3A10%3A17%2B09%3A30"
1286
+ },
1287
+ "response": {
1288
+ "status": 200,
1289
+ "headers": {
1290
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1291
+ },
1292
+ "body": {
1293
+ "scheduled_maintenance_reports": [
1294
+ {
1295
+ "scheduled_maintenances": [
1296
+
1297
+ ],
1298
+ "links": {
1299
+ "entity": [
1300
+ "1234"
1301
+ ],
1302
+ "check": [
1303
+ "www.example.com:SSH"
1304
+ ]
1305
+ }
1306
+ }
1307
+ ]
1308
+ }
1309
+ }
1310
+ },
1311
+ {
1312
+ "description": "a GET request for a outage report on all entities",
1313
+ "provider_state": "a check 'www.example.com:SSH' exists",
1314
+ "request": {
1315
+ "method": "get",
1316
+ "path": "/outage_report/entities"
1317
+ },
1318
+ "response": {
1319
+ "status": 200,
1320
+ "headers": {
1321
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1322
+ },
1323
+ "body": {
1324
+ "outage_reports": [
1325
+ {
1326
+ "outages": [
1327
+
1328
+ ],
1329
+ "links": {
1330
+ "entity": [
1331
+ "1234"
1332
+ ],
1333
+ "check": [
1334
+ "www.example.com:SSH"
1335
+ ]
1336
+ }
1337
+ }
1338
+ ]
1339
+ }
1340
+ }
1341
+ },
1342
+ {
1343
+ "description": "a GET request for a outage report on two entities",
1344
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1345
+ "request": {
1346
+ "method": "get",
1347
+ "path": "/outage_report/entities/1234,5678"
1348
+ },
1349
+ "response": {
1350
+ "status": 200,
1351
+ "headers": {
1352
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1353
+ },
1354
+ "body": {
1355
+ "outage_reports": [
1356
+ {
1357
+ "outages": [
1358
+
1359
+ ],
1360
+ "links": {
1361
+ "entity": [
1362
+ "1234"
1363
+ ],
1364
+ "check": [
1365
+ "www.example.com:SSH"
1366
+ ]
1367
+ }
1368
+ },
1369
+ {
1370
+ "outages": [
1371
+
1372
+ ],
1373
+ "links": {
1374
+ "entity": [
1375
+ "5678"
1376
+ ],
1377
+ "check": [
1378
+ "www2.example.com:PING"
1379
+ ]
1380
+ }
1381
+ }
1382
+ ]
1383
+ }
1384
+ }
1385
+ },
1386
+ {
1387
+ "description": "a time limited GET request for a downtime report on a single check",
1388
+ "provider_state": "a check 'www.example.com:SSH' exists",
1389
+ "request": {
1390
+ "method": "get",
1391
+ "path": "/downtime_report/checks/www.example.com:SSH",
1392
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30&end_time=2014-10-03T09%3A10%3A17%2B09%3A30"
1393
+ },
1394
+ "response": {
1395
+ "status": 200,
1396
+ "headers": {
1397
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1398
+ },
1399
+ "body": {
1400
+ "downtime_reports": [
1401
+ {
1402
+ }
1403
+ ]
1404
+ }
1405
+ }
1406
+ },
1407
+ {
1408
+ "description": "a time-limited GET request for a downtime report on two checks",
1409
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1410
+ "request": {
1411
+ "method": "get",
1412
+ "path": "/downtime_report/checks/www.example.com:SSH,www2.example.com:PING",
1413
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30&end_time=2014-10-03T09%3A10%3A17%2B09%3A30"
1414
+ },
1415
+ "response": {
1416
+ "status": 200,
1417
+ "headers": {
1418
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1419
+ },
1420
+ "body": {
1421
+ "downtime_reports": [
1422
+ {
1423
+ },
1424
+ {
1425
+ }
1426
+ ]
1427
+ }
1428
+ }
1429
+ },
1430
+ {
1431
+ "description": "a time-limited GET request for a scheduled_maintenance report on two checks",
1432
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1433
+ "request": {
1434
+ "method": "get",
1435
+ "path": "/scheduled_maintenance_report/checks/www.example.com:SSH,www2.example.com:PING",
1436
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30&end_time=2014-10-03T09%3A10%3A17%2B09%3A30"
1437
+ },
1438
+ "response": {
1439
+ "status": 200,
1440
+ "headers": {
1441
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1442
+ },
1443
+ "body": {
1444
+ "scheduled_maintenance_reports": [
1445
+ {
1446
+ "scheduled_maintenances": [
1447
+
1448
+ ],
1449
+ "links": {
1450
+ "entity": [
1451
+ "1234"
1452
+ ],
1453
+ "check": [
1454
+ "www.example.com:SSH"
1455
+ ]
1456
+ }
1457
+ },
1458
+ {
1459
+ "scheduled_maintenances": [
1460
+
1461
+ ],
1462
+ "links": {
1463
+ "entity": [
1464
+ "5678"
1465
+ ],
1466
+ "check": [
1467
+ "www2.example.com:PING"
1468
+ ]
1469
+ }
1470
+ }
1471
+ ]
1472
+ }
1473
+ }
1474
+ },
1475
+ {
1476
+ "description": "a time limited GET request for a outage report on two entities",
1477
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1478
+ "request": {
1479
+ "method": "get",
1480
+ "path": "/outage_report/entities/1234,5678",
1481
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30&end_time=2014-10-03T09%3A10%3A17%2B09%3A30"
1482
+ },
1483
+ "response": {
1484
+ "status": 200,
1485
+ "headers": {
1486
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1487
+ },
1488
+ "body": {
1489
+ "outage_reports": [
1490
+ {
1491
+ "outages": [
1492
+
1493
+ ],
1494
+ "links": {
1495
+ "entity": [
1496
+ "1234"
1497
+ ],
1498
+ "check": [
1499
+ "www.example.com:SSH"
1500
+ ]
1501
+ }
1502
+ },
1503
+ {
1504
+ "outages": [
1505
+
1506
+ ],
1507
+ "links": {
1508
+ "entity": [
1509
+ "5678"
1510
+ ],
1511
+ "check": [
1512
+ "www2.example.com:PING"
1513
+ ]
1514
+ }
1515
+ }
1516
+ ]
1517
+ }
1518
+ }
1519
+ },
1520
+ {
1521
+ "description": "a GET request for a status report on one entity",
1522
+ "provider_state": "a check 'www.example.com:SSH' exists",
1523
+ "request": {
1524
+ "method": "get",
1525
+ "path": "/status_report/entities/1234"
1526
+ },
1527
+ "response": {
1528
+ "status": 200,
1529
+ "headers": {
1530
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1531
+ },
1532
+ "body": {
1533
+ "status_reports": [
1534
+ {
1535
+ }
1536
+ ]
1537
+ }
1538
+ }
1539
+ },
1540
+ {
1541
+ "description": "a time limited GET request for a unscheduled_maintenance report on all entities",
1542
+ "provider_state": "a check 'www.example.com:SSH' exists",
1543
+ "request": {
1544
+ "method": "get",
1545
+ "path": "/unscheduled_maintenance_report/entities",
1546
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30&end_time=2014-10-03T09%3A10%3A17%2B09%3A30"
1547
+ },
1548
+ "response": {
1549
+ "status": 200,
1550
+ "headers": {
1551
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1552
+ },
1553
+ "body": {
1554
+ "unscheduled_maintenance_reports": [
1555
+ {
1556
+ "unscheduled_maintenances": [
1557
+
1558
+ ],
1559
+ "links": {
1560
+ "entity": [
1561
+ "1234"
1562
+ ],
1563
+ "check": [
1564
+ "www.example.com:SSH"
1565
+ ]
1566
+ }
1567
+ }
1568
+ ]
1569
+ }
1570
+ }
1571
+ },
1572
+ {
1573
+ "description": "a time limited GET request for a unscheduled_maintenance report on a single check",
1574
+ "provider_state": "a check 'www.example.com:SSH' exists",
1575
+ "request": {
1576
+ "method": "get",
1577
+ "path": "/unscheduled_maintenance_report/checks/www.example.com:SSH",
1578
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30&end_time=2014-10-03T09%3A10%3A17%2B09%3A30"
1579
+ },
1580
+ "response": {
1581
+ "status": 200,
1582
+ "headers": {
1583
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1584
+ },
1585
+ "body": {
1586
+ "unscheduled_maintenance_reports": [
1587
+ {
1588
+ "unscheduled_maintenances": [
1589
+
1590
+ ],
1591
+ "links": {
1592
+ "entity": [
1593
+ "1234"
1594
+ ],
1595
+ "check": [
1596
+ "www.example.com:SSH"
1597
+ ]
1598
+ }
1599
+ }
1600
+ ]
1601
+ }
1602
+ }
1603
+ },
1604
+ {
1605
+ "description": "a GET request for a downtime report on two checks",
1606
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1607
+ "request": {
1608
+ "method": "get",
1609
+ "path": "/downtime_report/checks/www.example.com:SSH,www2.example.com:PING"
1610
+ },
1611
+ "response": {
1612
+ "status": 200,
1613
+ "headers": {
1614
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1615
+ },
1616
+ "body": {
1617
+ "downtime_reports": [
1618
+ {
1619
+ },
1620
+ {
1621
+ }
1622
+ ]
1623
+ }
1624
+ }
1625
+ },
1626
+ {
1627
+ "description": "a GET request for a outage report on all checks",
1628
+ "provider_state": "a check 'www.example.com:SSH' exists",
1629
+ "request": {
1630
+ "method": "get",
1631
+ "path": "/outage_report/checks"
1632
+ },
1633
+ "response": {
1634
+ "status": 200,
1635
+ "headers": {
1636
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1637
+ },
1638
+ "body": {
1639
+ "outage_reports": [
1640
+ {
1641
+ "outages": [
1642
+
1643
+ ],
1644
+ "links": {
1645
+ "entity": [
1646
+ "1234"
1647
+ ],
1648
+ "check": [
1649
+ "www.example.com:SSH"
1650
+ ]
1651
+ }
1652
+ }
1653
+ ]
1654
+ }
1655
+ }
1656
+ },
1657
+ {
1658
+ "description": "a GET request for a downtime report on all entities",
1659
+ "provider_state": "a check 'www.example.com:SSH' exists",
1660
+ "request": {
1661
+ "method": "get",
1662
+ "path": "/downtime_report/entities"
1663
+ },
1664
+ "response": {
1665
+ "status": 200,
1666
+ "headers": {
1667
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1668
+ },
1669
+ "body": {
1670
+ "downtime_reports": [
1671
+ {
1672
+ }
1673
+ ]
1674
+ }
1675
+ }
1676
+ },
1677
+ {
1678
+ "description": "a GET request for one set of pagerduty credentials",
1679
+ "provider_state": "a contact with id 'abc' has pagerduty credentials",
1680
+ "request": {
1681
+ "method": "get",
1682
+ "path": "/pagerduty_credentials/abc"
1683
+ },
1684
+ "response": {
1685
+ "status": 200,
1686
+ "headers": {
1687
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1688
+ },
1689
+ "body": {
1690
+ "pagerduty_credentials": [
1691
+ {
1692
+ "service_key": "abc",
1693
+ "subdomain": "def",
1694
+ "username": "ghi",
1695
+ "password": "jkl"
1696
+ }
1697
+ ]
1698
+ }
1699
+ }
1700
+ },
1701
+ {
1702
+ "description": "a GET request for one set of pagerduty credentials",
1703
+ "provider_state": "no contact exists",
1704
+ "request": {
1705
+ "method": "get",
1706
+ "path": "/pagerduty_credentials/abc"
1707
+ },
1708
+ "response": {
1709
+ "status": 404,
1710
+ "headers": {
1711
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1712
+ },
1713
+ "body": {
1714
+ "errors": [
1715
+ "could not find contact 'abc'"
1716
+ ]
1717
+ }
1718
+ }
1719
+ },
1720
+ {
1721
+ "description": "a GET request for all pagerduty credentials",
1722
+ "provider_state": "a contact with id 'abc' has pagerduty credentials",
1723
+ "request": {
1724
+ "method": "get",
1725
+ "path": "/pagerduty_credentials"
1726
+ },
1727
+ "response": {
1728
+ "status": 200,
1729
+ "headers": {
1730
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1731
+ },
1732
+ "body": {
1733
+ "pagerduty_credentials": [
1734
+ {
1735
+ "service_key": "abc",
1736
+ "subdomain": "def",
1737
+ "username": "ghi",
1738
+ "password": "jkl"
1739
+ }
1740
+ ]
1741
+ }
1742
+ }
1743
+ },
1744
+ {
1745
+ "description": "a GET request for two sets of pagerduty credentials",
1746
+ "provider_state": "contacts with ids 'abc' and '872' have pagerduty credentials",
1747
+ "request": {
1748
+ "method": "get",
1749
+ "path": "/pagerduty_credentials/abc,872"
1750
+ },
1751
+ "response": {
1752
+ "status": 200,
1753
+ "headers": {
1754
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1755
+ },
1756
+ "body": {
1757
+ "pagerduty_credentials": [
1758
+ {
1759
+ "service_key": "abc",
1760
+ "subdomain": "def",
1761
+ "username": "ghi",
1762
+ "password": "jkl"
1763
+ },
1764
+ {
1765
+ "service_key": "mno",
1766
+ "subdomain": "pqr",
1767
+ "username": "stu",
1768
+ "password": "vwx"
1769
+ }
1770
+ ]
1771
+ }
1772
+ }
1773
+ },
1774
+ {
1775
+ "description": "a DELETE request for one set of pagerduty credentials",
1776
+ "provider_state": "a contact with id 'abc' has pagerduty credentials",
1777
+ "request": {
1778
+ "method": "delete",
1779
+ "path": "/pagerduty_credentials/abc",
1780
+ "body": null
1781
+ },
1782
+ "response": {
1783
+ "status": 204,
1784
+ "body": ""
1785
+ }
1786
+ },
1787
+ {
1788
+ "description": "a DELETE request for two sets of pagerduty credentials",
1789
+ "provider_state": "contacts with ids 'abc' and '872' have pagerduty credentials",
1790
+ "request": {
1791
+ "method": "delete",
1792
+ "path": "/pagerduty_credentials/abc,872",
1793
+ "body": null
1794
+ },
1795
+ "response": {
1796
+ "status": 204,
1797
+ "body": ""
1798
+ }
1799
+ },
1800
+ {
1801
+ "description": "a DELETE request for one set of pagerduty credentials",
1802
+ "provider_state": "no contact exists",
1803
+ "request": {
1804
+ "method": "delete",
1805
+ "path": "/pagerduty_credentials/abc",
1806
+ "body": null
1807
+ },
1808
+ "response": {
1809
+ "status": 404,
1810
+ "headers": {
1811
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1812
+ },
1813
+ "body": {
1814
+ "errors": [
1815
+ "could not find contact 'abc'"
1816
+ ]
1817
+ }
1818
+ }
1819
+ },
1820
+ {
1821
+ "description": "a POST request with one set of pagerduty credentials",
1822
+ "provider_state": "no contact exists",
1823
+ "request": {
1824
+ "method": "post",
1825
+ "path": "/contacts/abc/pagerduty_credentials",
1826
+ "headers": {
1827
+ "Content-Type": "application/vnd.api+json"
1828
+ },
1829
+ "body": {
1830
+ "pagerduty_credentials": [
1831
+ {
1832
+ "service_key": "abc",
1833
+ "subdomain": "def",
1834
+ "username": "ghi",
1835
+ "password": "jkl"
1836
+ }
1837
+ ]
1838
+ }
1839
+ },
1840
+ "response": {
1841
+ "status": 422,
1842
+ "headers": {
1843
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1844
+ },
1845
+ "body": {
1846
+ "errors": [
1847
+ "Contact id: 'abc' could not be loaded"
1848
+ ]
1849
+ }
1850
+ }
1851
+ },
1852
+ {
1853
+ "description": "a POST request with one set of pagerduty credentials",
1854
+ "provider_state": "a contact with id 'abc' exists",
1855
+ "request": {
1856
+ "method": "post",
1857
+ "path": "/contacts/abc/pagerduty_credentials",
1858
+ "headers": {
1859
+ "Content-Type": "application/vnd.api+json"
1860
+ },
1861
+ "body": {
1862
+ "pagerduty_credentials": [
1863
+ {
1864
+ "service_key": "abc",
1865
+ "subdomain": "def",
1866
+ "username": "ghi",
1867
+ "password": "jkl"
1868
+ }
1869
+ ]
1870
+ }
1871
+ },
1872
+ "response": {
1873
+ "status": 201,
1874
+ "headers": {
1875
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1876
+ },
1877
+ "body": [
1878
+ "abc"
1879
+ ]
1880
+ }
1881
+ },
1882
+ {
1883
+ "description": "a PATCH request for pagerduty credentials",
1884
+ "provider_state": "a contact with id 'abc' has pagerduty credentials",
1885
+ "request": {
1886
+ "method": "patch",
1887
+ "path": "/pagerduty_credentials/abc",
1888
+ "headers": {
1889
+ "Content-Type": "application/json-patch+json"
1890
+ },
1891
+ "body": [
1892
+ {
1893
+ "op": "replace",
1894
+ "path": "/pagerduty_credentials/0/password",
1895
+ "value": "pswrd"
1896
+ }
1897
+ ]
1898
+ },
1899
+ "response": {
1900
+ "status": 204,
1901
+ "body": ""
1902
+ }
1903
+ },
1904
+ {
1905
+ "description": "a PATCH request for pagerduty credentials",
1906
+ "provider_state": "contacts with ids 'abc' and '872' have pagerduty credentials",
1907
+ "request": {
1908
+ "method": "patch",
1909
+ "path": "/pagerduty_credentials/abc,872",
1910
+ "headers": {
1911
+ "Content-Type": "application/json-patch+json"
1912
+ },
1913
+ "body": [
1914
+ {
1915
+ "op": "replace",
1916
+ "path": "/pagerduty_credentials/0/password",
1917
+ "value": "pswrd"
1918
+ }
1919
+ ]
1920
+ },
1921
+ "response": {
1922
+ "status": 204,
1923
+ "body": ""
1924
+ }
1925
+ },
1926
+ {
1927
+ "description": "a PATCH request for pagerduty credentials",
1928
+ "provider_state": "no contact exists",
1929
+ "request": {
1930
+ "method": "patch",
1931
+ "path": "/pagerduty_credentials/abc",
1932
+ "headers": {
1933
+ "Content-Type": "application/json-patch+json"
1934
+ },
1935
+ "body": [
1936
+ {
1937
+ "op": "replace",
1938
+ "path": "/pagerduty_credentials/0/password",
1939
+ "value": "pswrd"
1940
+ }
1941
+ ]
1942
+ },
1943
+ "response": {
1944
+ "status": 404,
1945
+ "headers": {
1946
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
1947
+ },
1948
+ "body": {
1949
+ "errors": [
1950
+ "could not find contact 'abc'"
1951
+ ]
1952
+ }
1953
+ }
1954
+ },
1955
+ {
1956
+ "description": "a POST request with one unscheduled maintenance period",
1957
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
1958
+ "request": {
1959
+ "method": "post",
1960
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH,www2.example.com:PING",
1961
+ "headers": {
1962
+ "Content-Type": "application/vnd.api+json"
1963
+ },
1964
+ "body": {
1965
+ "unscheduled_maintenances": [
1966
+ {
1967
+ "duration": 3600,
1968
+ "summary": "working"
1969
+ }
1970
+ ]
1971
+ }
1972
+ },
1973
+ "response": {
1974
+ "status": 204,
1975
+ "body": ""
1976
+ }
1977
+ },
1978
+ {
1979
+ "description": "a POST request with one unscheduled maintenance period",
1980
+ "provider_state": "no check exists",
1981
+ "request": {
1982
+ "method": "post",
1983
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH",
1984
+ "headers": {
1985
+ "Content-Type": "application/vnd.api+json"
1986
+ },
1987
+ "body": {
1988
+ "unscheduled_maintenances": [
1989
+ {
1990
+ "duration": 3600,
1991
+ "summary": "working"
1992
+ }
1993
+ ]
1994
+ }
1995
+ },
1996
+ "response": {
1997
+ "status": 404,
1998
+ "body": {
1999
+ "errors": [
2000
+ "could not find entity 'www.example.com'"
2001
+ ]
2002
+ }
2003
+ }
2004
+ },
2005
+ {
2006
+ "description": "a POST request with one unscheduled maintenance period",
2007
+ "provider_state": "a check 'www.example.com:SSH' exists",
2008
+ "request": {
2009
+ "method": "post",
2010
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH",
2011
+ "headers": {
2012
+ "Content-Type": "application/vnd.api+json"
2013
+ },
2014
+ "body": {
2015
+ "unscheduled_maintenances": [
2016
+ {
2017
+ "duration": 3600,
2018
+ "summary": "working"
2019
+ }
2020
+ ]
2021
+ }
2022
+ },
2023
+ "response": {
2024
+ "status": 204,
2025
+ "body": ""
2026
+ }
2027
+ },
2028
+ {
2029
+ "description": "a POST request with two unscheduled maintenance periods",
2030
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
2031
+ "request": {
2032
+ "method": "post",
2033
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH,www2.example.com:PING",
2034
+ "headers": {
2035
+ "Content-Type": "application/vnd.api+json"
2036
+ },
2037
+ "body": {
2038
+ "unscheduled_maintenances": [
2039
+ {
2040
+ "duration": 3600,
2041
+ "summary": "working"
2042
+ },
2043
+ {
2044
+ "duration": 3600,
2045
+ "summary": "more work"
2046
+ }
2047
+ ]
2048
+ }
2049
+ },
2050
+ "response": {
2051
+ "status": 204,
2052
+ "body": ""
2053
+ }
2054
+ },
2055
+ {
2056
+ "description": "a POST request with two unscheduled maintenance periods",
2057
+ "provider_state": "a check 'www.example.com:SSH' exists",
2058
+ "request": {
2059
+ "method": "post",
2060
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH",
2061
+ "headers": {
2062
+ "Content-Type": "application/vnd.api+json"
2063
+ },
2064
+ "body": {
2065
+ "unscheduled_maintenances": [
2066
+ {
2067
+ "duration": 3600,
2068
+ "summary": "working"
2069
+ },
2070
+ {
2071
+ "duration": 3600,
2072
+ "summary": "more work"
2073
+ }
2074
+ ]
2075
+ }
2076
+ },
2077
+ "response": {
2078
+ "status": 204,
2079
+ "body": ""
2080
+ }
2081
+ },
2082
+ {
2083
+ "description": "a POST request with one scheduled maintenance period",
2084
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
2085
+ "request": {
2086
+ "method": "post",
2087
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH,www2.example.com:PING",
2088
+ "headers": {
2089
+ "Content-Type": "application/vnd.api+json"
2090
+ },
2091
+ "body": {
2092
+ "scheduled_maintenances": [
2093
+ {
2094
+ "start_time": "2014-10-02T21:10:17+09:30",
2095
+ "duration": 3600,
2096
+ "summary": "working"
2097
+ }
2098
+ ]
2099
+ }
2100
+ },
2101
+ "response": {
2102
+ "status": 204,
2103
+ "body": ""
2104
+ }
2105
+ },
2106
+ {
2107
+ "description": "a POST request with one scheduled maintenance period",
2108
+ "provider_state": "no check exists",
2109
+ "request": {
2110
+ "method": "post",
2111
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH",
2112
+ "headers": {
2113
+ "Content-Type": "application/vnd.api+json"
2114
+ },
2115
+ "body": {
2116
+ "scheduled_maintenances": [
2117
+ {
2118
+ "start_time": "2014-10-02T21:10:17+09:30",
2119
+ "duration": 3600,
2120
+ "summary": "working"
2121
+ }
2122
+ ]
2123
+ }
2124
+ },
2125
+ "response": {
2126
+ "status": 404,
2127
+ "body": {
2128
+ "errors": [
2129
+ "could not find entity 'www.example.com'"
2130
+ ]
2131
+ }
2132
+ }
2133
+ },
2134
+ {
2135
+ "description": "a POST request with one scheduled maintenance period",
2136
+ "provider_state": "a check 'www.example.com:SSH' exists",
2137
+ "request": {
2138
+ "method": "post",
2139
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH",
2140
+ "headers": {
2141
+ "Content-Type": "application/vnd.api+json"
2142
+ },
2143
+ "body": {
2144
+ "scheduled_maintenances": [
2145
+ {
2146
+ "start_time": "2014-10-02T21:10:17+09:30",
2147
+ "duration": 3600,
2148
+ "summary": "working"
2149
+ }
2150
+ ]
2151
+ }
2152
+ },
2153
+ "response": {
2154
+ "status": 204,
2155
+ "body": ""
2156
+ }
2157
+ },
2158
+ {
2159
+ "description": "a POST request with two scheduled maintenance periods",
2160
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
2161
+ "request": {
2162
+ "method": "post",
2163
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH,www2.example.com:PING",
2164
+ "headers": {
2165
+ "Content-Type": "application/vnd.api+json"
2166
+ },
2167
+ "body": {
2168
+ "scheduled_maintenances": [
2169
+ {
2170
+ "start_time": "2014-10-02T21:10:17+09:30",
2171
+ "duration": 3600,
2172
+ "summary": "working"
2173
+ },
2174
+ {
2175
+ "start_time": "2014-10-02T23:10:17+09:30",
2176
+ "duration": 3600,
2177
+ "summary": "more work"
2178
+ }
2179
+ ]
2180
+ }
2181
+ },
2182
+ "response": {
2183
+ "status": 204,
2184
+ "body": ""
2185
+ }
2186
+ },
2187
+ {
2188
+ "description": "a POST request with two scheduled maintenance periods",
2189
+ "provider_state": "a check 'www.example.com:SSH' exists",
2190
+ "request": {
2191
+ "method": "post",
2192
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH",
2193
+ "headers": {
2194
+ "Content-Type": "application/vnd.api+json"
2195
+ },
2196
+ "body": {
2197
+ "scheduled_maintenances": [
2198
+ {
2199
+ "start_time": "2014-10-02T21:10:17+09:30",
2200
+ "duration": 3600,
2201
+ "summary": "working"
2202
+ },
2203
+ {
2204
+ "start_time": "2014-10-02T23:10:17+09:30",
2205
+ "duration": 3600,
2206
+ "summary": "more work"
2207
+ }
2208
+ ]
2209
+ }
2210
+ },
2211
+ "response": {
2212
+ "status": 204,
2213
+ "body": ""
2214
+ }
2215
+ },
2216
+ {
2217
+ "description": "a PATCH request for an unscheduled maintenance period",
2218
+ "provider_state": "a check 'www.example.com:SSH' exists",
2219
+ "request": {
2220
+ "method": "patch",
2221
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH",
2222
+ "headers": {
2223
+ "Content-Type": "application/json-patch+json"
2224
+ },
2225
+ "body": [
2226
+ {
2227
+ "op": "replace",
2228
+ "path": "/unscheduled_maintenances/0/end_time",
2229
+ "value": "2014-10-02T21:10:17+09:30"
2230
+ }
2231
+ ]
2232
+ },
2233
+ "response": {
2234
+ "status": 204,
2235
+ "body": ""
2236
+ }
2237
+ },
2238
+ {
2239
+ "description": "a PATCH request for an unscheduled maintenance period",
2240
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
2241
+ "request": {
2242
+ "method": "patch",
2243
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH,www2.example.com:PING",
2244
+ "headers": {
2245
+ "Content-Type": "application/json-patch+json"
2246
+ },
2247
+ "body": [
2248
+ {
2249
+ "op": "replace",
2250
+ "path": "/unscheduled_maintenances/0/end_time",
2251
+ "value": "2014-10-02T21:10:17+09:30"
2252
+ }
2253
+ ]
2254
+ },
2255
+ "response": {
2256
+ "status": 204,
2257
+ "body": ""
2258
+ }
2259
+ },
2260
+ {
2261
+ "description": "a PATCH request for an unscheduled maintenance period",
2262
+ "provider_state": "no check exists",
2263
+ "request": {
2264
+ "method": "patch",
2265
+ "path": "/unscheduled_maintenances/checks/www.example.com:SSH",
2266
+ "headers": {
2267
+ "Content-Type": "application/json-patch+json"
2268
+ },
2269
+ "body": [
2270
+ {
2271
+ "op": "replace",
2272
+ "path": "/unscheduled_maintenances/0/end_time",
2273
+ "value": "2014-10-02T21:10:17+09:30"
2274
+ }
2275
+ ]
2276
+ },
2277
+ "response": {
2278
+ "status": 404,
2279
+ "body": {
2280
+ "errors": [
2281
+ "could not find entity 'www.example.com'"
2282
+ ]
2283
+ }
2284
+ }
2285
+ },
2286
+ {
2287
+ "description": "a DELETE request for a scheduled maintenance period",
2288
+ "provider_state": "a check 'www.example.com:SSH' exists",
2289
+ "request": {
2290
+ "method": "delete",
2291
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH",
2292
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30"
2293
+ },
2294
+ "response": {
2295
+ "status": 204,
2296
+ "body": ""
2297
+ }
2298
+ },
2299
+ {
2300
+ "description": "a DELETE request for a scheduled maintenance period",
2301
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
2302
+ "request": {
2303
+ "method": "delete",
2304
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH,www2.example.com:PING",
2305
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30"
2306
+ },
2307
+ "response": {
2308
+ "status": 204,
2309
+ "body": ""
2310
+ }
2311
+ },
2312
+ {
2313
+ "description": "a DELETE request for a scheduled maintenance period",
2314
+ "provider_state": "no check exists",
2315
+ "request": {
2316
+ "method": "delete",
2317
+ "path": "/scheduled_maintenances/checks/www.example.com:SSH",
2318
+ "query": "start_time=2014-10-02T21%3A10%3A17%2B09%3A30"
2319
+ },
2320
+ "response": {
2321
+ "status": 404,
2322
+ "body": {
2323
+ "errors": [
2324
+ "could not find entity 'www.example.com'"
2325
+ ]
2326
+ }
2327
+ }
2328
+ },
2329
+ {
2330
+ "description": "a POST request with one unscheduled maintenance period",
2331
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
2332
+ "request": {
2333
+ "method": "post",
2334
+ "path": "/unscheduled_maintenances/entities/1234,5678",
2335
+ "headers": {
2336
+ "Content-Type": "application/vnd.api+json"
2337
+ },
2338
+ "body": {
2339
+ "unscheduled_maintenances": [
2340
+ {
2341
+ "duration": 3600,
2342
+ "summary": "working"
2343
+ }
2344
+ ]
2345
+ }
2346
+ },
2347
+ "response": {
2348
+ "status": 204,
2349
+ "body": ""
2350
+ }
2351
+ },
2352
+ {
2353
+ "description": "a POST request with one unscheduled maintenance period",
2354
+ "provider_state": "no entity exists",
2355
+ "request": {
2356
+ "method": "post",
2357
+ "path": "/unscheduled_maintenances/entities/1234",
2358
+ "headers": {
2359
+ "Content-Type": "application/vnd.api+json"
2360
+ },
2361
+ "body": {
2362
+ "unscheduled_maintenances": [
2363
+ {
2364
+ "duration": 3600,
2365
+ "summary": "working"
2366
+ }
2367
+ ]
2368
+ }
2369
+ },
2370
+ "response": {
2371
+ "status": 404,
2372
+ "body": {
2373
+ "errors": [
2374
+ "could not find entity '1234'"
2375
+ ]
2376
+ }
2377
+ }
2378
+ },
2379
+ {
2380
+ "description": "a POST request with one unscheduled maintenance period",
2381
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
2382
+ "request": {
2383
+ "method": "post",
2384
+ "path": "/unscheduled_maintenances/entities/1234",
2385
+ "headers": {
2386
+ "Content-Type": "application/vnd.api+json"
2387
+ },
2388
+ "body": {
2389
+ "unscheduled_maintenances": [
2390
+ {
2391
+ "duration": 3600,
2392
+ "summary": "working"
2393
+ }
2394
+ ]
2395
+ }
2396
+ },
2397
+ "response": {
2398
+ "status": 204,
2399
+ "body": ""
2400
+ }
2401
+ },
2402
+ {
2403
+ "description": "a POST request with two unscheduled maintenance periods",
2404
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
2405
+ "request": {
2406
+ "method": "post",
2407
+ "path": "/unscheduled_maintenances/entities/1234,5678",
2408
+ "headers": {
2409
+ "Content-Type": "application/vnd.api+json"
2410
+ },
2411
+ "body": {
2412
+ "unscheduled_maintenances": [
2413
+ {
2414
+ "duration": 3600,
2415
+ "summary": "working"
2416
+ },
2417
+ {
2418
+ "duration": 3600,
2419
+ "summary": "more work"
2420
+ }
2421
+ ]
2422
+ }
2423
+ },
2424
+ "response": {
2425
+ "status": 204,
2426
+ "body": ""
2427
+ }
2428
+ },
2429
+ {
2430
+ "description": "a POST request with two unscheduled maintenance periods",
2431
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
2432
+ "request": {
2433
+ "method": "post",
2434
+ "path": "/unscheduled_maintenances/entities/1234",
2435
+ "headers": {
2436
+ "Content-Type": "application/vnd.api+json"
2437
+ },
2438
+ "body": {
2439
+ "unscheduled_maintenances": [
2440
+ {
2441
+ "duration": 3600,
2442
+ "summary": "working"
2443
+ },
2444
+ {
2445
+ "duration": 3600,
2446
+ "summary": "more work"
2447
+ }
2448
+ ]
2449
+ }
2450
+ },
2451
+ "response": {
2452
+ "status": 204,
2453
+ "body": ""
2454
+ }
2455
+ },
2456
+ {
2457
+ "description": "a POST request with one scheduled maintenance period",
2458
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
2459
+ "request": {
2460
+ "method": "post",
2461
+ "path": "/scheduled_maintenances/entities/1234,5678",
2462
+ "headers": {
2463
+ "Content-Type": "application/vnd.api+json"
2464
+ },
2465
+ "body": {
2466
+ "scheduled_maintenances": [
2467
+ {
2468
+ "start_time": "2014-10-02T21:10:18+09:30",
2469
+ "duration": 3600,
2470
+ "summary": "working"
2471
+ }
2472
+ ]
2473
+ }
2474
+ },
2475
+ "response": {
2476
+ "status": 204,
2477
+ "body": ""
2478
+ }
2479
+ },
2480
+ {
2481
+ "description": "a POST request with one scheduled maintenance period",
2482
+ "provider_state": "no entity exists",
2483
+ "request": {
2484
+ "method": "post",
2485
+ "path": "/scheduled_maintenances/entities/1234",
2486
+ "headers": {
2487
+ "Content-Type": "application/vnd.api+json"
2488
+ },
2489
+ "body": {
2490
+ "scheduled_maintenances": [
2491
+ {
2492
+ "start_time": "2014-10-02T21:10:18+09:30",
2493
+ "duration": 3600,
2494
+ "summary": "working"
2495
+ }
2496
+ ]
2497
+ }
2498
+ },
2499
+ "response": {
2500
+ "status": 404,
2501
+ "body": {
2502
+ "errors": [
2503
+ "could not find entity '1234'"
2504
+ ]
2505
+ }
2506
+ }
2507
+ },
2508
+ {
2509
+ "description": "a POST request with one scheduled maintenance period",
2510
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
2511
+ "request": {
2512
+ "method": "post",
2513
+ "path": "/scheduled_maintenances/entities/1234",
2514
+ "headers": {
2515
+ "Content-Type": "application/vnd.api+json"
2516
+ },
2517
+ "body": {
2518
+ "scheduled_maintenances": [
2519
+ {
2520
+ "start_time": "2014-10-02T21:10:18+09:30",
2521
+ "duration": 3600,
2522
+ "summary": "working"
2523
+ }
2524
+ ]
2525
+ }
2526
+ },
2527
+ "response": {
2528
+ "status": 204,
2529
+ "body": ""
2530
+ }
2531
+ },
2532
+ {
2533
+ "description": "a POST request with two scheduled maintenance periods",
2534
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
2535
+ "request": {
2536
+ "method": "post",
2537
+ "path": "/scheduled_maintenances/entities/1234,5678",
2538
+ "headers": {
2539
+ "Content-Type": "application/vnd.api+json"
2540
+ },
2541
+ "body": {
2542
+ "scheduled_maintenances": [
2543
+ {
2544
+ "start_time": "2014-10-02T21:10:18+09:30",
2545
+ "duration": 3600,
2546
+ "summary": "working"
2547
+ },
2548
+ {
2549
+ "start_time": "2014-10-02T23:10:18+09:30",
2550
+ "duration": 3600,
2551
+ "summary": "more work"
2552
+ }
2553
+ ]
2554
+ }
2555
+ },
2556
+ "response": {
2557
+ "status": 204,
2558
+ "body": ""
2559
+ }
2560
+ },
2561
+ {
2562
+ "description": "a POST request with two scheduled maintenance periods",
2563
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
2564
+ "request": {
2565
+ "method": "post",
2566
+ "path": "/scheduled_maintenances/entities/1234",
2567
+ "headers": {
2568
+ "Content-Type": "application/vnd.api+json"
2569
+ },
2570
+ "body": {
2571
+ "scheduled_maintenances": [
2572
+ {
2573
+ "start_time": "2014-10-02T21:10:18+09:30",
2574
+ "duration": 3600,
2575
+ "summary": "working"
2576
+ },
2577
+ {
2578
+ "start_time": "2014-10-02T23:10:18+09:30",
2579
+ "duration": 3600,
2580
+ "summary": "more work"
2581
+ }
2582
+ ]
2583
+ }
2584
+ },
2585
+ "response": {
2586
+ "status": 204,
2587
+ "body": ""
2588
+ }
2589
+ },
2590
+ {
2591
+ "description": "a PATCH request for an unscheduled maintenance period",
2592
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
2593
+ "request": {
2594
+ "method": "patch",
2595
+ "path": "/unscheduled_maintenances/entities/1234",
2596
+ "headers": {
2597
+ "Content-Type": "application/json-patch+json"
2598
+ },
2599
+ "body": [
2600
+ {
2601
+ "op": "replace",
2602
+ "path": "/unscheduled_maintenances/0/end_time",
2603
+ "value": "2014-10-02T21:10:18+09:30"
2604
+ }
2605
+ ]
2606
+ },
2607
+ "response": {
2608
+ "status": 204,
2609
+ "body": ""
2610
+ }
2611
+ },
2612
+ {
2613
+ "description": "a PATCH request for an unscheduled maintenance period",
2614
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
2615
+ "request": {
2616
+ "method": "patch",
2617
+ "path": "/unscheduled_maintenances/entities/1234,5678",
2618
+ "headers": {
2619
+ "Content-Type": "application/json-patch+json"
2620
+ },
2621
+ "body": [
2622
+ {
2623
+ "op": "replace",
2624
+ "path": "/unscheduled_maintenances/0/end_time",
2625
+ "value": "2014-10-02T21:10:18+09:30"
2626
+ }
2627
+ ]
2628
+ },
2629
+ "response": {
2630
+ "status": 204,
2631
+ "body": ""
2632
+ }
2633
+ },
2634
+ {
2635
+ "description": "a PATCH request for an unscheduled maintenance period",
2636
+ "provider_state": "no entity exists",
2637
+ "request": {
2638
+ "method": "patch",
2639
+ "path": "/unscheduled_maintenances/entities/1234",
2640
+ "headers": {
2641
+ "Content-Type": "application/json-patch+json"
2642
+ },
2643
+ "body": [
2644
+ {
2645
+ "op": "replace",
2646
+ "path": "/unscheduled_maintenances/0/end_time",
2647
+ "value": "2014-10-02T21:10:18+09:30"
2648
+ }
2649
+ ]
2650
+ },
2651
+ "response": {
2652
+ "status": 404,
2653
+ "body": {
2654
+ "errors": [
2655
+ "could not find entity '1234'"
2656
+ ]
2657
+ }
2658
+ }
2659
+ },
2660
+ {
2661
+ "description": "a DELETE request for a scheduled maintenance period",
2662
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
2663
+ "request": {
2664
+ "method": "delete",
2665
+ "path": "/scheduled_maintenances/entities/1234",
2666
+ "query": "start_time=2014-10-02T21%3A10%3A18%2B09%3A30"
2667
+ },
2668
+ "response": {
2669
+ "status": 204,
2670
+ "body": ""
2671
+ }
2672
+ },
2673
+ {
2674
+ "description": "a DELETE request for a scheduled maintenance period",
2675
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
2676
+ "request": {
2677
+ "method": "delete",
2678
+ "path": "/scheduled_maintenances/entities/1234,5678",
2679
+ "query": "start_time=2014-10-02T21%3A10%3A18%2B09%3A30"
2680
+ },
2681
+ "response": {
2682
+ "status": 204,
2683
+ "body": ""
2684
+ }
2685
+ },
2686
+ {
2687
+ "description": "a DELETE request for a scheduled maintenance period",
2688
+ "provider_state": "no entity exists",
2689
+ "request": {
2690
+ "method": "delete",
2691
+ "path": "/scheduled_maintenances/entities/1234",
2692
+ "query": "start_time=2014-10-02T21%3A10%3A18%2B09%3A30"
2693
+ },
2694
+ "response": {
2695
+ "status": 404,
2696
+ "body": {
2697
+ "errors": [
2698
+ "could not find entity '1234'"
2699
+ ]
2700
+ }
2701
+ }
2702
+ },
2703
+ {
2704
+ "description": "a GET request for sms media",
2705
+ "provider_state": "a contact with id 'abc' has email and sms media",
2706
+ "request": {
2707
+ "method": "get",
2708
+ "path": "/media/abc_sms"
2709
+ },
2710
+ "response": {
2711
+ "status": 200,
2712
+ "headers": {
2713
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2714
+ },
2715
+ "body": {
2716
+ "media": [
2717
+ {
2718
+ "type": "sms",
2719
+ "address": "0123456789",
2720
+ "interval": 300,
2721
+ "rollup_threshold": 5,
2722
+ "links": {
2723
+ "contacts": [
2724
+ "abc"
2725
+ ]
2726
+ }
2727
+ }
2728
+ ]
2729
+ }
2730
+ }
2731
+ },
2732
+ {
2733
+ "description": "a GET request for sms media",
2734
+ "provider_state": "no contact exists",
2735
+ "request": {
2736
+ "method": "get",
2737
+ "path": "/media/abc_sms"
2738
+ },
2739
+ "response": {
2740
+ "status": 404,
2741
+ "headers": {
2742
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2743
+ },
2744
+ "body": {
2745
+ "errors": [
2746
+ "could not find contact 'abc'"
2747
+ ]
2748
+ }
2749
+ }
2750
+ },
2751
+ {
2752
+ "description": "a GET request for all media",
2753
+ "provider_state": "a contact with id 'abc' has email and sms media",
2754
+ "request": {
2755
+ "method": "get",
2756
+ "path": "/media"
2757
+ },
2758
+ "response": {
2759
+ "status": 200,
2760
+ "headers": {
2761
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2762
+ },
2763
+ "body": {
2764
+ "media": [
2765
+ {
2766
+ "type": "email",
2767
+ "address": "ablated@example.org",
2768
+ "interval": 180,
2769
+ "rollup_threshold": 3,
2770
+ "links": {
2771
+ "contacts": [
2772
+ "abc"
2773
+ ]
2774
+ }
2775
+ },
2776
+ {
2777
+ "type": "sms",
2778
+ "address": "0123456789",
2779
+ "interval": 300,
2780
+ "rollup_threshold": 5,
2781
+ "links": {
2782
+ "contacts": [
2783
+ "abc"
2784
+ ]
2785
+ }
2786
+ }
2787
+ ]
2788
+ }
2789
+ }
2790
+ },
2791
+ {
2792
+ "description": "a GET request for email and sms media",
2793
+ "provider_state": "a contact with id 'abc' has email and sms media",
2794
+ "request": {
2795
+ "method": "get",
2796
+ "path": "/media/abc_email,abc_sms"
2797
+ },
2798
+ "response": {
2799
+ "status": 200,
2800
+ "headers": {
2801
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2802
+ },
2803
+ "body": {
2804
+ "media": [
2805
+ {
2806
+ "type": "email",
2807
+ "address": "ablated@example.org",
2808
+ "interval": 180,
2809
+ "rollup_threshold": 3,
2810
+ "links": {
2811
+ "contacts": [
2812
+ "abc"
2813
+ ]
2814
+ }
2815
+ },
2816
+ {
2817
+ "type": "sms",
2818
+ "address": "0123456789",
2819
+ "interval": 300,
2820
+ "rollup_threshold": 5,
2821
+ "links": {
2822
+ "contacts": [
2823
+ "abc"
2824
+ ]
2825
+ }
2826
+ }
2827
+ ]
2828
+ }
2829
+ }
2830
+ },
2831
+ {
2832
+ "description": "a DELETE request for one medium",
2833
+ "provider_state": "a contact with id 'abc' has email and sms media",
2834
+ "request": {
2835
+ "method": "delete",
2836
+ "path": "/media/abc_email",
2837
+ "body": null
2838
+ },
2839
+ "response": {
2840
+ "status": 204,
2841
+ "body": ""
2842
+ }
2843
+ },
2844
+ {
2845
+ "description": "a DELETE request for two media",
2846
+ "provider_state": "a contact with id 'abc' has email and sms media",
2847
+ "request": {
2848
+ "method": "delete",
2849
+ "path": "/media/abc_email,abc_sms",
2850
+ "body": null
2851
+ },
2852
+ "response": {
2853
+ "status": 204,
2854
+ "body": ""
2855
+ }
2856
+ },
2857
+ {
2858
+ "description": "a DELETE request for one medium",
2859
+ "provider_state": "no contact exists",
2860
+ "request": {
2861
+ "method": "delete",
2862
+ "path": "/media/abc_email",
2863
+ "body": null
2864
+ },
2865
+ "response": {
2866
+ "status": 404,
2867
+ "headers": {
2868
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2869
+ },
2870
+ "body": {
2871
+ "errors": [
2872
+ "could not find contact 'abc'"
2873
+ ]
2874
+ }
2875
+ }
2876
+ },
2877
+ {
2878
+ "description": "a POST request with one medium",
2879
+ "provider_state": "a contact with id 'abc' exists",
2880
+ "request": {
2881
+ "method": "post",
2882
+ "path": "/contacts/abc/media",
2883
+ "headers": {
2884
+ "Content-Type": "application/vnd.api+json"
2885
+ },
2886
+ "body": {
2887
+ "media": [
2888
+ {
2889
+ "type": "sms",
2890
+ "address": "0123456789",
2891
+ "interval": 300,
2892
+ "rollup_threshold": 5
2893
+ }
2894
+ ]
2895
+ }
2896
+ },
2897
+ "response": {
2898
+ "status": 201,
2899
+ "headers": {
2900
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2901
+ },
2902
+ "body": [
2903
+ "abc_sms"
2904
+ ]
2905
+ }
2906
+ },
2907
+ {
2908
+ "description": "a POST request with two media",
2909
+ "provider_state": "a contact with id 'abc' exists",
2910
+ "request": {
2911
+ "method": "post",
2912
+ "path": "/contacts/abc/media",
2913
+ "headers": {
2914
+ "Content-Type": "application/vnd.api+json"
2915
+ },
2916
+ "body": {
2917
+ "media": [
2918
+ {
2919
+ "type": "sms",
2920
+ "address": "0123456789",
2921
+ "interval": 300,
2922
+ "rollup_threshold": 5
2923
+ },
2924
+ {
2925
+ "type": "email",
2926
+ "address": "ablated@example.org",
2927
+ "interval": 180,
2928
+ "rollup_threshold": 3
2929
+ }
2930
+ ]
2931
+ }
2932
+ },
2933
+ "response": {
2934
+ "status": 201,
2935
+ "headers": {
2936
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2937
+ },
2938
+ "body": [
2939
+ "abc_sms",
2940
+ "abc_email"
2941
+ ]
2942
+ }
2943
+ },
2944
+ {
2945
+ "description": "a POST request with one medium",
2946
+ "provider_state": "no contact exists",
2947
+ "request": {
2948
+ "method": "post",
2949
+ "path": "/contacts/abc/media",
2950
+ "headers": {
2951
+ "Content-Type": "application/vnd.api+json"
2952
+ },
2953
+ "body": {
2954
+ "media": [
2955
+ {
2956
+ "type": "sms",
2957
+ "address": "0123456789",
2958
+ "interval": 300,
2959
+ "rollup_threshold": 5
2960
+ }
2961
+ ]
2962
+ }
2963
+ },
2964
+ "response": {
2965
+ "status": 422,
2966
+ "headers": {
2967
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
2968
+ },
2969
+ "body": {
2970
+ "errors": [
2971
+ "Contact id: 'abc' could not be loaded"
2972
+ ]
2973
+ }
2974
+ }
2975
+ },
2976
+ {
2977
+ "description": "a PATCH request for email media",
2978
+ "provider_state": "a contact with id 'abc' has email and sms media",
2979
+ "request": {
2980
+ "method": "patch",
2981
+ "path": "/media/abc_email",
2982
+ "headers": {
2983
+ "Content-Type": "application/json-patch+json"
2984
+ },
2985
+ "body": [
2986
+ {
2987
+ "op": "replace",
2988
+ "path": "/media/0/interval",
2989
+ "value": 50
2990
+ },
2991
+ {
2992
+ "op": "replace",
2993
+ "path": "/media/0/rollup_threshold",
2994
+ "value": 3
2995
+ }
2996
+ ]
2997
+ },
2998
+ "response": {
2999
+ "status": 204,
3000
+ "body": ""
3001
+ }
3002
+ },
3003
+ {
3004
+ "description": "a PATCH request for email and sms media",
3005
+ "provider_state": "a contact with id 'abc' has email and sms media",
3006
+ "request": {
3007
+ "method": "patch",
3008
+ "path": "/media/abc_email,abc_sms",
3009
+ "headers": {
3010
+ "Content-Type": "application/json-patch+json"
3011
+ },
3012
+ "body": [
3013
+ {
3014
+ "op": "replace",
3015
+ "path": "/media/0/interval",
3016
+ "value": 50
3017
+ },
3018
+ {
3019
+ "op": "replace",
3020
+ "path": "/media/0/rollup_threshold",
3021
+ "value": 3
3022
+ }
3023
+ ]
3024
+ },
3025
+ "response": {
3026
+ "status": 204,
3027
+ "body": ""
3028
+ }
3029
+ },
3030
+ {
3031
+ "description": "a PATCH request for email media",
3032
+ "provider_state": "no contact exists",
3033
+ "request": {
3034
+ "method": "patch",
3035
+ "path": "/media/abc_email",
3036
+ "headers": {
3037
+ "Content-Type": "application/json-patch+json"
3038
+ },
3039
+ "body": [
3040
+ {
3041
+ "op": "replace",
3042
+ "path": "/media/0/interval",
3043
+ "value": 50
3044
+ }
3045
+ ]
3046
+ },
3047
+ "response": {
3048
+ "status": 404,
3049
+ "headers": {
3050
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3051
+ },
3052
+ "body": {
3053
+ "errors": [
3054
+ "could not find contact 'abc'"
3055
+ ]
3056
+ }
3057
+ }
3058
+ },
3059
+ {
3060
+ "description": "a GET request for a single contact",
3061
+ "provider_state": "no contact exists",
3062
+ "request": {
3063
+ "method": "get",
3064
+ "path": "/contacts/abc"
3065
+ },
3066
+ "response": {
3067
+ "status": 404,
3068
+ "headers": {
3069
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3070
+ },
3071
+ "body": {
3072
+ "errors": [
3073
+ "could not find contacts 'abc'"
3074
+ ]
3075
+ }
3076
+ }
3077
+ },
3078
+ {
3079
+ "description": "a GET request for a single contact",
3080
+ "provider_state": "a contact with id 'abc' exists",
3081
+ "request": {
3082
+ "method": "get",
3083
+ "path": "/contacts/abc"
3084
+ },
3085
+ "response": {
3086
+ "status": 200,
3087
+ "headers": {
3088
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3089
+ },
3090
+ "body": {
3091
+ "contacts": [
3092
+ {
3093
+ "id": "abc",
3094
+ "first_name": "Jim",
3095
+ "last_name": "Smith",
3096
+ "email": "jims@example.com",
3097
+ "timezone": "UTC"
3098
+ }
3099
+ ]
3100
+ }
3101
+ }
3102
+ },
3103
+ {
3104
+ "description": "a GET request for all contacts",
3105
+ "provider_state": "no contact exists",
3106
+ "request": {
3107
+ "method": "get",
3108
+ "path": "/contacts"
3109
+ },
3110
+ "response": {
3111
+ "status": 200,
3112
+ "headers": {
3113
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3114
+ },
3115
+ "body": {
3116
+ "contacts": [
3117
+
3118
+ ]
3119
+ }
3120
+ }
3121
+ },
3122
+ {
3123
+ "description": "a GET request for all contacts",
3124
+ "provider_state": "a contact with id 'abc' exists",
3125
+ "request": {
3126
+ "method": "get",
3127
+ "path": "/contacts"
3128
+ },
3129
+ "response": {
3130
+ "status": 200,
3131
+ "headers": {
3132
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3133
+ },
3134
+ "body": {
3135
+ "contacts": [
3136
+ {
3137
+ "id": "abc",
3138
+ "first_name": "Jim",
3139
+ "last_name": "Smith",
3140
+ "email": "jims@example.com",
3141
+ "timezone": "UTC"
3142
+ }
3143
+ ]
3144
+ }
3145
+ }
3146
+ },
3147
+ {
3148
+ "description": "a DELETE request for a single contact",
3149
+ "provider_state": "a contact with id 'abc' exists",
3150
+ "request": {
3151
+ "method": "delete",
3152
+ "path": "/contacts/abc",
3153
+ "body": null
3154
+ },
3155
+ "response": {
3156
+ "status": 204,
3157
+ "body": ""
3158
+ }
3159
+ },
3160
+ {
3161
+ "description": "a DELETE request for two contacts",
3162
+ "provider_state": "contacts with ids 'abc' and '872' exist",
3163
+ "request": {
3164
+ "method": "delete",
3165
+ "path": "/contacts/abc,872",
3166
+ "body": null
3167
+ },
3168
+ "response": {
3169
+ "status": 204,
3170
+ "body": ""
3171
+ }
3172
+ },
3173
+ {
3174
+ "description": "a DELETE request for a single contact",
3175
+ "provider_state": "no contact exists",
3176
+ "request": {
3177
+ "method": "delete",
3178
+ "path": "/contacts/abc",
3179
+ "body": null
3180
+ },
3181
+ "response": {
3182
+ "status": 404,
3183
+ "headers": {
3184
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3185
+ },
3186
+ "body": {
3187
+ "errors": [
3188
+ "could not find contacts 'abc'"
3189
+ ]
3190
+ }
3191
+ }
3192
+ },
3193
+ {
3194
+ "description": "a POST request with one contact",
3195
+ "provider_state": "no contact exists",
3196
+ "request": {
3197
+ "method": "post",
3198
+ "path": "/contacts",
3199
+ "headers": {
3200
+ "Content-Type": "application/vnd.api+json"
3201
+ },
3202
+ "body": {
3203
+ "contacts": [
3204
+ {
3205
+ "id": "abc",
3206
+ "first_name": "Jim",
3207
+ "last_name": "Smith",
3208
+ "email": "jims@example.com",
3209
+ "timezone": "UTC"
3210
+ }
3211
+ ]
3212
+ }
3213
+ },
3214
+ "response": {
3215
+ "status": 201,
3216
+ "headers": {
3217
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3218
+ },
3219
+ "body": [
3220
+ "abc"
3221
+ ]
3222
+ }
3223
+ },
3224
+ {
3225
+ "description": "a POST request with two contacts",
3226
+ "provider_state": "no contact exists",
3227
+ "request": {
3228
+ "method": "post",
3229
+ "path": "/contacts",
3230
+ "headers": {
3231
+ "Content-Type": "application/vnd.api+json"
3232
+ },
3233
+ "body": {
3234
+ "contacts": [
3235
+ {
3236
+ "id": "abc",
3237
+ "first_name": "Jim",
3238
+ "last_name": "Smith",
3239
+ "email": "jims@example.com",
3240
+ "timezone": "UTC"
3241
+ },
3242
+ {
3243
+ "id": "def",
3244
+ "first_name": "Joan",
3245
+ "last_name": "Smith",
3246
+ "email": "joans@example.com"
3247
+ }
3248
+ ]
3249
+ }
3250
+ },
3251
+ "response": {
3252
+ "status": 201,
3253
+ "headers": {
3254
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3255
+ },
3256
+ "body": [
3257
+ "abc",
3258
+ "def"
3259
+ ]
3260
+ }
3261
+ },
3262
+ {
3263
+ "description": "a POST request with one contact",
3264
+ "provider_state": "a contact with id 'abc' exists",
3265
+ "request": {
3266
+ "method": "post",
3267
+ "path": "/contacts",
3268
+ "headers": {
3269
+ "Content-Type": "application/vnd.api+json"
3270
+ },
3271
+ "body": {
3272
+ "contacts": [
3273
+ {
3274
+ "id": "abc",
3275
+ "first_name": "Jim",
3276
+ "last_name": "Smith",
3277
+ "email": "jims@example.com",
3278
+ "timezone": "UTC"
3279
+ }
3280
+ ]
3281
+ }
3282
+ },
3283
+ "response": {
3284
+ "status": 409,
3285
+ "headers": {
3286
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3287
+ },
3288
+ "body": {
3289
+ "errors": [
3290
+ "Contacts already exist with the following IDs: abc"
3291
+ ]
3292
+ }
3293
+ }
3294
+ },
3295
+ {
3296
+ "description": "a PATCH request to change properties for two contacts",
3297
+ "provider_state": "contacts with ids 'abc' and '872' exist",
3298
+ "request": {
3299
+ "method": "patch",
3300
+ "path": "/contacts/abc,872",
3301
+ "headers": {
3302
+ "Content-Type": "application/json-patch+json"
3303
+ },
3304
+ "body": [
3305
+ {
3306
+ "op": "replace",
3307
+ "path": "/contacts/0/timezone",
3308
+ "value": "UTC"
3309
+ }
3310
+ ]
3311
+ },
3312
+ "response": {
3313
+ "status": 204,
3314
+ "body": ""
3315
+ }
3316
+ },
3317
+ {
3318
+ "description": "a PATCH request to change properties for a single contact",
3319
+ "provider_state": "no contact exists",
3320
+ "request": {
3321
+ "method": "patch",
3322
+ "path": "/contacts/323",
3323
+ "headers": {
3324
+ "Content-Type": "application/json-patch+json"
3325
+ },
3326
+ "body": [
3327
+ {
3328
+ "op": "replace",
3329
+ "path": "/contacts/0/timezone",
3330
+ "value": "UTC"
3331
+ }
3332
+ ]
3333
+ },
3334
+ "response": {
3335
+ "status": 404,
3336
+ "headers": {
3337
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3338
+ },
3339
+ "body": {
3340
+ "errors": [
3341
+ "could not find contacts '323'"
3342
+ ]
3343
+ }
3344
+ }
3345
+ },
3346
+ {
3347
+ "description": "a PATCH request to change properties for a single contact",
3348
+ "provider_state": "a contact with id 'abc' exists",
3349
+ "request": {
3350
+ "method": "patch",
3351
+ "path": "/contacts/abc",
3352
+ "headers": {
3353
+ "Content-Type": "application/json-patch+json"
3354
+ },
3355
+ "body": [
3356
+ {
3357
+ "op": "replace",
3358
+ "path": "/contacts/0/timezone",
3359
+ "value": "UTC"
3360
+ }
3361
+ ]
3362
+ },
3363
+ "response": {
3364
+ "status": 204,
3365
+ "body": ""
3366
+ }
3367
+ },
3368
+ {
3369
+ "description": "a PATCH request to change links for two contacts",
3370
+ "provider_state": "contacts with ids 'abc' and '872' exist",
3371
+ "request": {
3372
+ "method": "patch",
3373
+ "path": "/contacts/abc,872",
3374
+ "headers": {
3375
+ "Content-Type": "application/json-patch+json"
3376
+ },
3377
+ "body": [
3378
+ {
3379
+ "op": "add",
3380
+ "path": "/contacts/0/links/entities/-",
3381
+ "value": "1234"
3382
+ }
3383
+ ]
3384
+ },
3385
+ "response": {
3386
+ "status": 204,
3387
+ "body": ""
3388
+ }
3389
+ },
3390
+ {
3391
+ "description": "a PATCH requestto change a link for a single contact",
3392
+ "provider_state": "a contact with id '872' exists",
3393
+ "request": {
3394
+ "method": "patch",
3395
+ "path": "/contacts/872",
3396
+ "headers": {
3397
+ "Content-Type": "application/json-patch+json"
3398
+ },
3399
+ "body": [
3400
+ {
3401
+ "op": "add",
3402
+ "path": "/contacts/0/links/entities/-",
3403
+ "value": "1234"
3404
+ }
3405
+ ]
3406
+ },
3407
+ "response": {
3408
+ "status": 204,
3409
+ "body": ""
3410
+ }
3411
+ },
3412
+ {
3413
+ "description": "a POST request with two entities",
3414
+ "provider_state": "no entity exists",
3415
+ "request": {
3416
+ "method": "post",
3417
+ "path": "/entities",
3418
+ "headers": {
3419
+ "Content-Type": "application/vnd.api+json"
3420
+ },
3421
+ "body": {
3422
+ "entities": [
3423
+ {
3424
+ "name": "example.org",
3425
+ "id": "57_example"
3426
+ },
3427
+ {
3428
+ "name": "example2.org",
3429
+ "id": "58"
3430
+ }
3431
+ ]
3432
+ }
3433
+ },
3434
+ "response": {
3435
+ "status": 201,
3436
+ "headers": {
3437
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3438
+ },
3439
+ "body": [
3440
+ "57_example",
3441
+ "58"
3442
+ ]
3443
+ }
3444
+ },
3445
+ {
3446
+ "description": "a POST request with one entity",
3447
+ "provider_state": "no entity exists",
3448
+ "request": {
3449
+ "method": "post",
3450
+ "path": "/entities",
3451
+ "headers": {
3452
+ "Content-Type": "application/vnd.api+json"
3453
+ },
3454
+ "body": {
3455
+ "entities": [
3456
+ {
3457
+ "name": "example.org",
3458
+ "id": "57_example"
3459
+ }
3460
+ ]
3461
+ }
3462
+ },
3463
+ "response": {
3464
+ "status": 201,
3465
+ "headers": {
3466
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3467
+ },
3468
+ "body": [
3469
+ "57_example"
3470
+ ]
3471
+ }
3472
+ },
3473
+ {
3474
+ "description": "a GET request for a single entity",
3475
+ "provider_state": "no entity exists",
3476
+ "request": {
3477
+ "method": "get",
3478
+ "path": "/entities/1234"
3479
+ },
3480
+ "response": {
3481
+ "status": 404,
3482
+ "headers": {
3483
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3484
+ },
3485
+ "body": {
3486
+ "errors": [
3487
+ "could not find entities: '1234'"
3488
+ ]
3489
+ }
3490
+ }
3491
+ },
3492
+ {
3493
+ "description": "a GET request for a single entity",
3494
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
3495
+ "request": {
3496
+ "method": "get",
3497
+ "path": "/entities/1234"
3498
+ },
3499
+ "response": {
3500
+ "status": 200,
3501
+ "headers": {
3502
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3503
+ },
3504
+ "body": {
3505
+ "entities": [
3506
+ {
3507
+ "name": "www.example.com",
3508
+ "id": "1234"
3509
+ }
3510
+ ]
3511
+ }
3512
+ }
3513
+ },
3514
+ {
3515
+ "description": "a GET request for all entities",
3516
+ "provider_state": "no entity exists",
3517
+ "request": {
3518
+ "method": "get",
3519
+ "path": "/entities"
3520
+ },
3521
+ "response": {
3522
+ "status": 200,
3523
+ "headers": {
3524
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3525
+ },
3526
+ "body": {
3527
+ "entities": [
3528
+
3529
+ ]
3530
+ }
3531
+ }
3532
+ },
3533
+ {
3534
+ "description": "a GET request for all entities",
3535
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
3536
+ "request": {
3537
+ "method": "get",
3538
+ "path": "/entities"
3539
+ },
3540
+ "response": {
3541
+ "status": 200,
3542
+ "headers": {
3543
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3544
+ },
3545
+ "body": {
3546
+ "entities": [
3547
+ {
3548
+ "name": "www.example.com",
3549
+ "id": "1234"
3550
+ }
3551
+ ]
3552
+ }
3553
+ }
3554
+ },
3555
+ {
3556
+ "description": "a PATCH request for a single entity",
3557
+ "provider_state": "no entity exists",
3558
+ "request": {
3559
+ "method": "patch",
3560
+ "path": "/entities/1234",
3561
+ "headers": {
3562
+ "Content-Type": "application/json-patch+json"
3563
+ },
3564
+ "body": [
3565
+ {
3566
+ "op": "replace",
3567
+ "path": "/entities/0/name",
3568
+ "value": "example3.com"
3569
+ }
3570
+ ]
3571
+ },
3572
+ "response": {
3573
+ "status": 404,
3574
+ "headers": {
3575
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3576
+ },
3577
+ "body": {
3578
+ "errors": [
3579
+ "could not find entity '1234'"
3580
+ ]
3581
+ }
3582
+ }
3583
+ },
3584
+ {
3585
+ "description": "a PATCH request for a single entity",
3586
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
3587
+ "request": {
3588
+ "method": "patch",
3589
+ "path": "/entities/1234",
3590
+ "headers": {
3591
+ "Content-Type": "application/json-patch+json"
3592
+ },
3593
+ "body": [
3594
+ {
3595
+ "op": "replace",
3596
+ "path": "/entities/0/name",
3597
+ "value": "example3.com"
3598
+ }
3599
+ ]
3600
+ },
3601
+ "response": {
3602
+ "status": 204,
3603
+ "body": ""
3604
+ }
3605
+ },
3606
+ {
3607
+ "description": "a POST request with one test notification",
3608
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
3609
+ "request": {
3610
+ "method": "post",
3611
+ "path": "/test_notifications/checks/www.example.com:SSH,www2.example.com:PING",
3612
+ "headers": {
3613
+ "Content-Type": "application/vnd.api+json"
3614
+ },
3615
+ "body": {
3616
+ "test_notifications": [
3617
+ {
3618
+ "summary": "testing"
3619
+ }
3620
+ ]
3621
+ }
3622
+ },
3623
+ "response": {
3624
+ "status": 204,
3625
+ "body": ""
3626
+ }
3627
+ },
3628
+ {
3629
+ "description": "a POST request with one test notification",
3630
+ "provider_state": "no check exists",
3631
+ "request": {
3632
+ "method": "post",
3633
+ "path": "/test_notifications/checks/www.example.com:SSH",
3634
+ "headers": {
3635
+ "Content-Type": "application/vnd.api+json"
3636
+ },
3637
+ "body": {
3638
+ "test_notifications": [
3639
+ {
3640
+ "summary": "testing"
3641
+ }
3642
+ ]
3643
+ }
3644
+ },
3645
+ "response": {
3646
+ "status": 404,
3647
+ "body": {
3648
+ "errors": [
3649
+ "could not find entity 'www.example.com'"
3650
+ ]
3651
+ }
3652
+ }
3653
+ },
3654
+ {
3655
+ "description": "a POST request with one test notification",
3656
+ "provider_state": "a check 'www.example.com:SSH' exists",
3657
+ "request": {
3658
+ "method": "post",
3659
+ "path": "/test_notifications/checks/www.example.com:SSH",
3660
+ "headers": {
3661
+ "Content-Type": "application/vnd.api+json"
3662
+ },
3663
+ "body": {
3664
+ "test_notifications": [
3665
+ {
3666
+ "summary": "testing"
3667
+ }
3668
+ ]
3669
+ }
3670
+ },
3671
+ "response": {
3672
+ "status": 204,
3673
+ "body": ""
3674
+ }
3675
+ },
3676
+ {
3677
+ "description": "a POST request with two test notifications",
3678
+ "provider_state": "checks 'www.example.com:SSH' and 'www2.example.com:PING' exist",
3679
+ "request": {
3680
+ "method": "post",
3681
+ "path": "/test_notifications/checks/www.example.com:SSH,www2.example.com:PING",
3682
+ "headers": {
3683
+ "Content-Type": "application/vnd.api+json"
3684
+ },
3685
+ "body": {
3686
+ "test_notifications": [
3687
+ {
3688
+ "summary": "testing"
3689
+ },
3690
+ {
3691
+ "summary": "more tests"
3692
+ }
3693
+ ]
3694
+ }
3695
+ },
3696
+ "response": {
3697
+ "status": 204,
3698
+ "body": ""
3699
+ }
3700
+ },
3701
+ {
3702
+ "description": "a POST request with two test notifications",
3703
+ "provider_state": "a check 'www.example.com:SSH' exists",
3704
+ "request": {
3705
+ "method": "post",
3706
+ "path": "/test_notifications/checks/www.example.com:SSH",
3707
+ "headers": {
3708
+ "Content-Type": "application/vnd.api+json"
3709
+ },
3710
+ "body": {
3711
+ "test_notifications": [
3712
+ {
3713
+ "summary": "testing"
3714
+ },
3715
+ {
3716
+ "summary": "more tests"
3717
+ }
3718
+ ]
3719
+ }
3720
+ },
3721
+ "response": {
3722
+ "status": 204,
3723
+ "body": ""
3724
+ }
3725
+ },
3726
+ {
3727
+ "description": "a POST request with one test notification",
3728
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
3729
+ "request": {
3730
+ "method": "post",
3731
+ "path": "/test_notifications/entities/1234,5678",
3732
+ "headers": {
3733
+ "Content-Type": "application/vnd.api+json"
3734
+ },
3735
+ "body": {
3736
+ "test_notifications": [
3737
+ {
3738
+ "summary": "testing"
3739
+ }
3740
+ ]
3741
+ }
3742
+ },
3743
+ "response": {
3744
+ "status": 204,
3745
+ "body": ""
3746
+ }
3747
+ },
3748
+ {
3749
+ "description": "a POST request with one test notification",
3750
+ "provider_state": "no entity exists",
3751
+ "request": {
3752
+ "method": "post",
3753
+ "path": "/test_notifications/entities/1234",
3754
+ "headers": {
3755
+ "Content-Type": "application/vnd.api+json"
3756
+ },
3757
+ "body": {
3758
+ "test_notifications": [
3759
+ {
3760
+ "summary": "testing"
3761
+ }
3762
+ ]
3763
+ }
3764
+ },
3765
+ "response": {
3766
+ "status": 404,
3767
+ "body": {
3768
+ "errors": [
3769
+ "could not find entity '1234'"
3770
+ ]
3771
+ }
3772
+ }
3773
+ },
3774
+ {
3775
+ "description": "a POST request with one test notification",
3776
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
3777
+ "request": {
3778
+ "method": "post",
3779
+ "path": "/test_notifications/entities/1234",
3780
+ "headers": {
3781
+ "Content-Type": "application/vnd.api+json"
3782
+ },
3783
+ "body": {
3784
+ "test_notifications": [
3785
+ {
3786
+ "summary": "testing"
3787
+ }
3788
+ ]
3789
+ }
3790
+ },
3791
+ "response": {
3792
+ "status": 204,
3793
+ "body": ""
3794
+ }
3795
+ },
3796
+ {
3797
+ "description": "a POST request with two test notifications",
3798
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
3799
+ "request": {
3800
+ "method": "post",
3801
+ "path": "/test_notifications/entities/1234,5678",
3802
+ "headers": {
3803
+ "Content-Type": "application/vnd.api+json"
3804
+ },
3805
+ "body": {
3806
+ "test_notifications": [
3807
+ {
3808
+ "summary": "testing"
3809
+ },
3810
+ {
3811
+ "summary": "more tests"
3812
+ }
3813
+ ]
3814
+ }
3815
+ },
3816
+ "response": {
3817
+ "status": 204,
3818
+ "body": ""
3819
+ }
3820
+ },
3821
+ {
3822
+ "description": "a POST request with two test notifications",
3823
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
3824
+ "request": {
3825
+ "method": "post",
3826
+ "path": "/test_notifications/entities/1234",
3827
+ "headers": {
3828
+ "Content-Type": "application/vnd.api+json"
3829
+ },
3830
+ "body": {
3831
+ "test_notifications": [
3832
+ {
3833
+ "summary": "testing"
3834
+ },
3835
+ {
3836
+ "summary": "more tests"
3837
+ }
3838
+ ]
3839
+ }
3840
+ },
3841
+ "response": {
3842
+ "status": 204,
3843
+ "body": ""
3844
+ }
3845
+ },
3846
+ {
3847
+ "description": "a GET request for a single notification rule",
3848
+ "provider_state": "a contact 'abc' with generic notification rule '05983623-fcef-42da-af44-ed6990b500fa' exists",
3849
+ "request": {
3850
+ "method": "get",
3851
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa"
3852
+ },
3853
+ "response": {
3854
+ "status": 200,
3855
+ "headers": {
3856
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3857
+ },
3858
+ "body": {
3859
+ "notification_rules": [
3860
+ {
3861
+ "id": "05983623-fcef-42da-af44-ed6990b500fa",
3862
+ "tags": [
3863
+
3864
+ ],
3865
+ "regex_tags": [
3866
+
3867
+ ],
3868
+ "entities": [
3869
+
3870
+ ],
3871
+ "regex_entities": [
3872
+
3873
+ ],
3874
+ "time_restrictions": [
3875
+
3876
+ ],
3877
+ "warning_media": [
3878
+ "email"
3879
+ ],
3880
+ "critical_media": [
3881
+ "sms",
3882
+ "email"
3883
+ ],
3884
+ "warning_blackhole": false,
3885
+ "critical_blackhole": false
3886
+ }
3887
+ ]
3888
+ }
3889
+ }
3890
+ },
3891
+ {
3892
+ "description": "a GET request for a single notification rule",
3893
+ "provider_state": "no notification rule exists",
3894
+ "request": {
3895
+ "method": "get",
3896
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa"
3897
+ },
3898
+ "response": {
3899
+ "status": 404,
3900
+ "headers": {
3901
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3902
+ },
3903
+ "body": {
3904
+ "errors": [
3905
+ "could not find notification rules '05983623-fcef-42da-af44-ed6990b500fa'"
3906
+ ]
3907
+ }
3908
+ }
3909
+ },
3910
+ {
3911
+ "description": "a GET request for all notification rules",
3912
+ "provider_state": "a contact 'abc' with generic notification rule '05983623-fcef-42da-af44-ed6990b500fa' exists",
3913
+ "request": {
3914
+ "method": "get",
3915
+ "path": "/notification_rules"
3916
+ },
3917
+ "response": {
3918
+ "status": 200,
3919
+ "headers": {
3920
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3921
+ },
3922
+ "body": {
3923
+ "notification_rules": [
3924
+ {
3925
+ "id": "05983623-fcef-42da-af44-ed6990b500fa",
3926
+ "tags": [
3927
+
3928
+ ],
3929
+ "regex_tags": [
3930
+
3931
+ ],
3932
+ "entities": [
3933
+
3934
+ ],
3935
+ "regex_entities": [
3936
+
3937
+ ],
3938
+ "time_restrictions": [
3939
+
3940
+ ],
3941
+ "warning_media": [
3942
+ "email"
3943
+ ],
3944
+ "critical_media": [
3945
+ "sms",
3946
+ "email"
3947
+ ],
3948
+ "warning_blackhole": false,
3949
+ "critical_blackhole": false
3950
+ }
3951
+ ]
3952
+ }
3953
+ }
3954
+ },
3955
+ {
3956
+ "description": "a GET request for two notification rules",
3957
+ "provider_state": "a contact 'abc' with generic notification rule '05983623-fcef-42da-af44-ed6990b500fa' and notification rule '20f182fc-6e32-4794-9007-97366d162c51' exists",
3958
+ "request": {
3959
+ "method": "get",
3960
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa,20f182fc-6e32-4794-9007-97366d162c51"
3961
+ },
3962
+ "response": {
3963
+ "status": 200,
3964
+ "headers": {
3965
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
3966
+ },
3967
+ "body": {
3968
+ "notification_rules": [
3969
+ {
3970
+ "id": "05983623-fcef-42da-af44-ed6990b500fa",
3971
+ "tags": [
3972
+
3973
+ ],
3974
+ "regex_tags": [
3975
+
3976
+ ],
3977
+ "entities": [
3978
+
3979
+ ],
3980
+ "regex_entities": [
3981
+
3982
+ ],
3983
+ "time_restrictions": [
3984
+
3985
+ ],
3986
+ "warning_media": [
3987
+ "email"
3988
+ ],
3989
+ "critical_media": [
3990
+ "sms",
3991
+ "email"
3992
+ ],
3993
+ "warning_blackhole": false,
3994
+ "critical_blackhole": false
3995
+ },
3996
+ {
3997
+ "id": "20f182fc-6e32-4794-9007-97366d162c51",
3998
+ "tags": [
3999
+ "physical"
4000
+ ],
4001
+ "regex_tags": [
4002
+
4003
+ ],
4004
+ "entities": [
4005
+ "example.com"
4006
+ ],
4007
+ "regex_entities": [
4008
+
4009
+ ],
4010
+ "time_restrictions": [
4011
+
4012
+ ],
4013
+ "warning_media": [
4014
+ "email"
4015
+ ],
4016
+ "critical_media": [
4017
+ "sms",
4018
+ "email"
4019
+ ],
4020
+ "warning_blackhole": true,
4021
+ "critical_blackhole": true
4022
+ }
4023
+ ]
4024
+ }
4025
+ }
4026
+ },
4027
+ {
4028
+ "description": "a DELETE request for a single notification rule",
4029
+ "provider_state": "a contact 'abc' with generic notification rule '05983623-fcef-42da-af44-ed6990b500fa' exists",
4030
+ "request": {
4031
+ "method": "delete",
4032
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa",
4033
+ "body": null
4034
+ },
4035
+ "response": {
4036
+ "status": 204,
4037
+ "body": ""
4038
+ }
4039
+ },
4040
+ {
4041
+ "description": "a DELETE request for two notification rules",
4042
+ "provider_state": "a contact 'abc' with generic notification rule '05983623-fcef-42da-af44-ed6990b500fa' and notification rule '20f182fc-6e32-4794-9007-97366d162c51' exists",
4043
+ "request": {
4044
+ "method": "delete",
4045
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa,20f182fc-6e32-4794-9007-97366d162c51",
4046
+ "body": null
4047
+ },
4048
+ "response": {
4049
+ "status": 204,
4050
+ "body": ""
4051
+ }
4052
+ },
4053
+ {
4054
+ "description": "a DELETE request for a single notification rule",
4055
+ "provider_state": "no notification rule exists",
4056
+ "request": {
4057
+ "method": "delete",
4058
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa",
4059
+ "body": null
4060
+ },
4061
+ "response": {
4062
+ "status": 404,
4063
+ "headers": {
4064
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4065
+ },
4066
+ "body": {
4067
+ "errors": [
4068
+ "could not find notification rule '05983623-fcef-42da-af44-ed6990b500fa'"
4069
+ ]
4070
+ }
4071
+ }
4072
+ },
4073
+ {
4074
+ "description": "a POST request with one notification rule",
4075
+ "provider_state": "a contact with id 'abc' exists",
4076
+ "request": {
4077
+ "method": "post",
4078
+ "path": "/contacts/abc/notification_rules",
4079
+ "headers": {
4080
+ "Content-Type": "application/vnd.api+json"
4081
+ },
4082
+ "body": {
4083
+ "notification_rules": [
4084
+ {
4085
+ "entity_tags": [
4086
+ "database",
4087
+ "physical"
4088
+ ],
4089
+ "entities": [
4090
+ "foo-app-01.example.com"
4091
+ ],
4092
+ "time_restrictions": null,
4093
+ "warning_media": [
4094
+ "email"
4095
+ ],
4096
+ "critical_media": [
4097
+ "sms",
4098
+ "email"
4099
+ ],
4100
+ "warning_blackhole": false,
4101
+ "critical_blackhole": false
4102
+ }
4103
+ ]
4104
+ }
4105
+ },
4106
+ "response": {
4107
+ "status": 201,
4108
+ "headers": {
4109
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4110
+ },
4111
+ "body": [
4112
+ {
4113
+ "json_class": "Pact::Term",
4114
+ "data": {
4115
+ "generate": "05983623-fcef-42da-af44-ed6990b500fa",
4116
+ "matcher": {"json_class":"Regexp","o":0,"s":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}
4117
+ }
4118
+ }
4119
+ ]
4120
+ }
4121
+ },
4122
+ {
4123
+ "description": "a POST request with two notification rules",
4124
+ "provider_state": "a contact with id 'abc' exists",
4125
+ "request": {
4126
+ "method": "post",
4127
+ "path": "/contacts/abc/notification_rules",
4128
+ "headers": {
4129
+ "Content-Type": "application/vnd.api+json"
4130
+ },
4131
+ "body": {
4132
+ "notification_rules": [
4133
+ {
4134
+ "entity_tags": [
4135
+ "database",
4136
+ "physical"
4137
+ ],
4138
+ "entities": [
4139
+ "foo-app-01.example.com"
4140
+ ],
4141
+ "time_restrictions": null,
4142
+ "warning_media": [
4143
+ "email"
4144
+ ],
4145
+ "critical_media": [
4146
+ "sms",
4147
+ "email"
4148
+ ],
4149
+ "warning_blackhole": false,
4150
+ "critical_blackhole": false
4151
+ },
4152
+ {
4153
+ "entity_tags": null,
4154
+ "entities": [
4155
+ "foo-app-02.example.com"
4156
+ ],
4157
+ "time_restrictions": null,
4158
+ "warning_media": [
4159
+ "email"
4160
+ ],
4161
+ "critical_media": [
4162
+ "sms",
4163
+ "email"
4164
+ ],
4165
+ "warning_blackhole": true,
4166
+ "critical_blackhole": false
4167
+ }
4168
+ ]
4169
+ }
4170
+ },
4171
+ "response": {
4172
+ "status": 201,
4173
+ "headers": {
4174
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4175
+ },
4176
+ "body": [
4177
+ {
4178
+ "json_class": "Pact::Term",
4179
+ "data": {
4180
+ "generate": "05983623-fcef-42da-af44-ed6990b500fa",
4181
+ "matcher": {"json_class":"Regexp","o":0,"s":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}
4182
+ }
4183
+ },
4184
+ {
4185
+ "json_class": "Pact::Term",
4186
+ "data": {
4187
+ "generate": "20f182fc-6e32-4794-9007-97366d162c51",
4188
+ "matcher": {"json_class":"Regexp","o":0,"s":"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}
4189
+ }
4190
+ }
4191
+ ]
4192
+ }
4193
+ },
4194
+ {
4195
+ "description": "a POST request with one notification rule",
4196
+ "provider_state": "no contact exists",
4197
+ "request": {
4198
+ "method": "post",
4199
+ "path": "/contacts/abc/notification_rules",
4200
+ "headers": {
4201
+ "Content-Type": "application/vnd.api+json"
4202
+ },
4203
+ "body": {
4204
+ "notification_rules": [
4205
+ {
4206
+ "entity_tags": [
4207
+ "database",
4208
+ "physical"
4209
+ ],
4210
+ "entities": [
4211
+ "foo-app-01.example.com"
4212
+ ],
4213
+ "time_restrictions": null,
4214
+ "warning_media": [
4215
+ "email"
4216
+ ],
4217
+ "critical_media": [
4218
+ "sms",
4219
+ "email"
4220
+ ],
4221
+ "warning_blackhole": false,
4222
+ "critical_blackhole": false
4223
+ }
4224
+ ]
4225
+ }
4226
+ },
4227
+ "response": {
4228
+ "status": 404,
4229
+ "headers": {
4230
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4231
+ },
4232
+ "body": {
4233
+ "errors": [
4234
+ "could not find contact 'abc'"
4235
+ ]
4236
+ }
4237
+ }
4238
+ },
4239
+ {
4240
+ "description": "a PATCH request to change properties for a single notification rule",
4241
+ "provider_state": "a contact 'abc' with generic notification rule '05983623-fcef-42da-af44-ed6990b500fa' exists",
4242
+ "request": {
4243
+ "method": "patch",
4244
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa",
4245
+ "headers": {
4246
+ "Content-Type": "application/json-patch+json"
4247
+ },
4248
+ "body": [
4249
+ {
4250
+ "op": "replace",
4251
+ "path": "/notification_rules/0/warning_blackhole",
4252
+ "value": false
4253
+ }
4254
+ ]
4255
+ },
4256
+ "response": {
4257
+ "status": 204,
4258
+ "body": ""
4259
+ }
4260
+ },
4261
+ {
4262
+ "description": "a PATCH request to change properties for two notification rules",
4263
+ "provider_state": "a contact 'abc' with generic notification rule '05983623-fcef-42da-af44-ed6990b500fa' and notification rule '20f182fc-6e32-4794-9007-97366d162c51' exists",
4264
+ "request": {
4265
+ "method": "patch",
4266
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa,20f182fc-6e32-4794-9007-97366d162c51",
4267
+ "headers": {
4268
+ "Content-Type": "application/json-patch+json"
4269
+ },
4270
+ "body": [
4271
+ {
4272
+ "op": "replace",
4273
+ "path": "/notification_rules/0/warning_blackhole",
4274
+ "value": false
4275
+ }
4276
+ ]
4277
+ },
4278
+ "response": {
4279
+ "status": 204,
4280
+ "body": ""
4281
+ }
4282
+ },
4283
+ {
4284
+ "description": "a PATCH request to change properties for a single notification rule",
4285
+ "provider_state": "no notification rule exists",
4286
+ "request": {
4287
+ "method": "patch",
4288
+ "path": "/notification_rules/05983623-fcef-42da-af44-ed6990b500fa",
4289
+ "headers": {
4290
+ "Content-Type": "application/json-patch+json"
4291
+ },
4292
+ "body": [
4293
+ {
4294
+ "op": "replace",
4295
+ "path": "/notification_rules/0/warning_blackhole",
4296
+ "value": false
4297
+ }
4298
+ ]
4299
+ },
4300
+ "response": {
4301
+ "status": 404,
4302
+ "headers": {
4303
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4304
+ },
4305
+ "body": {
4306
+ "errors": [
4307
+ "could not find notification rule '05983623-fcef-42da-af44-ed6990b500fa'"
4308
+ ]
4309
+ }
4310
+ }
4311
+ },
4312
+ {
4313
+ "description": "a POST request with two checks",
4314
+ "provider_state": "entities 'www.example.com', id '1234' and 'www2.example.com', id '5678' exist",
4315
+ "request": {
4316
+ "method": "post",
4317
+ "path": "/checks",
4318
+ "headers": {
4319
+ "Content-Type": "application/vnd.api+json"
4320
+ },
4321
+ "body": {
4322
+ "checks": [
4323
+ {
4324
+ "name": "SSH",
4325
+ "entity_id": "1234"
4326
+ },
4327
+ {
4328
+ "name": "PING",
4329
+ "entity_id": "5678"
4330
+ }
4331
+ ]
4332
+ }
4333
+ },
4334
+ "response": {
4335
+ "status": 201,
4336
+ "headers": {
4337
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4338
+ },
4339
+ "body": [
4340
+ "www.example.com:SSH",
4341
+ "www2.example.com:PING"
4342
+ ]
4343
+ }
4344
+ },
4345
+ {
4346
+ "description": "a POST request with one check",
4347
+ "provider_state": "an entity 'www.example.com' with id '1234' exists",
4348
+ "request": {
4349
+ "method": "post",
4350
+ "path": "/checks",
4351
+ "headers": {
4352
+ "Content-Type": "application/vnd.api+json"
4353
+ },
4354
+ "body": {
4355
+ "checks": [
4356
+ {
4357
+ "name": "SSH",
4358
+ "entity_id": "1234"
4359
+ }
4360
+ ]
4361
+ }
4362
+ },
4363
+ "response": {
4364
+ "status": 201,
4365
+ "headers": {
4366
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4367
+ },
4368
+ "body": [
4369
+ "www.example.com:SSH"
4370
+ ]
4371
+ }
4372
+ },
4373
+ {
4374
+ "description": "a GET request for check 'www.example.com:SSH'",
4375
+ "provider_state": "no entity exists",
4376
+ "request": {
4377
+ "method": "get",
4378
+ "path": "/checks/www.example.com:SSH"
4379
+ },
4380
+ "response": {
4381
+ "status": 404,
4382
+ "headers": {
4383
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4384
+ },
4385
+ "body": {
4386
+ "errors": [
4387
+ "could not find entity checks: 'www.example.com:SSH'"
4388
+ ]
4389
+ }
4390
+ }
4391
+ },
4392
+ {
4393
+ "description": "a GET request for check 'www.example.com:SSH'",
4394
+ "provider_state": "a check 'www.example.com:SSH' exists",
4395
+ "request": {
4396
+ "method": "get",
4397
+ "path": "/checks/www.example.com:SSH"
4398
+ },
4399
+ "response": {
4400
+ "status": 200,
4401
+ "headers": {
4402
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4403
+ },
4404
+ "body": {
4405
+ "checks": [
4406
+ {
4407
+ "id": "www.example.com:SSH",
4408
+ "name": "SSH",
4409
+ "entity_name": "www.example.com",
4410
+ "links": {
4411
+ "entities": [
4412
+ "1234"
4413
+ ]
4414
+ }
4415
+ }
4416
+ ]
4417
+ }
4418
+ }
4419
+ },
4420
+ {
4421
+ "description": "a GET request for all checks",
4422
+ "provider_state": "a check 'www.example.com:SSH' exists",
4423
+ "request": {
4424
+ "method": "get",
4425
+ "path": "/checks"
4426
+ },
4427
+ "response": {
4428
+ "status": 200,
4429
+ "headers": {
4430
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4431
+ },
4432
+ "body": {
4433
+ "checks": [
4434
+ {
4435
+ "id": "www.example.com:SSH",
4436
+ "name": "SSH",
4437
+ "entity_name": "www.example.com",
4438
+ "links": {
4439
+ "entities": [
4440
+ "1234"
4441
+ ]
4442
+ }
4443
+ }
4444
+ ]
4445
+ }
4446
+ }
4447
+ },
4448
+ {
4449
+ "description": "a GET request for all checks",
4450
+ "provider_state": "no entity exists",
4451
+ "request": {
4452
+ "method": "get",
4453
+ "path": "/checks"
4454
+ },
4455
+ "response": {
4456
+ "status": 200,
4457
+ "headers": {
4458
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4459
+ },
4460
+ "body": {
4461
+ "checks": [
4462
+
4463
+ ]
4464
+ }
4465
+ }
4466
+ },
4467
+ {
4468
+ "description": "a PATCH request for a single check",
4469
+ "provider_state": "no entity exists",
4470
+ "request": {
4471
+ "method": "patch",
4472
+ "path": "/checks/www.example.com:SSH",
4473
+ "headers": {
4474
+ "Content-Type": "application/json-patch+json"
4475
+ },
4476
+ "body": [
4477
+ {
4478
+ "op": "replace",
4479
+ "path": "/checks/0/enabled",
4480
+ "value": false
4481
+ }
4482
+ ]
4483
+ },
4484
+ "response": {
4485
+ "status": 404,
4486
+ "headers": {
4487
+ "Content-Type": "application/vnd.api+json; charset=utf-8"
4488
+ },
4489
+ "body": {
4490
+ "errors": [
4491
+ "could not find entity 'www.example.com'"
4492
+ ]
4493
+ }
4494
+ }
4495
+ },
4496
+ {
4497
+ "description": "a PATCH request for a single check",
4498
+ "provider_state": "a check 'www.example.com:SSH' exists",
4499
+ "request": {
4500
+ "method": "patch",
4501
+ "path": "/checks/www.example.com:SSH",
4502
+ "headers": {
4503
+ "Content-Type": "application/json-patch+json"
4504
+ },
4505
+ "body": [
4506
+ {
4507
+ "op": "replace",
4508
+ "path": "/checks/0/enabled",
4509
+ "value": false
4510
+ }
4511
+ ]
4512
+ },
4513
+ "response": {
4514
+ "status": 204,
4515
+ "body": ""
4516
+ }
4517
+ }
4518
+ ],
4519
+ "metadata": {
4520
+ "pactSpecificationVersion": "1.0.0"
4521
+ }
4522
+ }