flapjack 1.6.0 → 2.0.0b1

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