flapjack-diner 1.4.0 → 2.0.0.a4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -1
- data/README.md +620 -413
- data/flapjack-diner.gemspec +1 -1
- data/lib/flapjack-diner/argument_validator.rb +77 -7
- data/lib/flapjack-diner/configuration.rb +409 -0
- data/lib/flapjack-diner/index_range.rb +42 -0
- data/lib/flapjack-diner/log_formatter.rb +22 -0
- data/lib/flapjack-diner/query.rb +114 -0
- data/lib/flapjack-diner/relationships.rb +180 -0
- data/lib/flapjack-diner/request.rb +280 -0
- data/lib/flapjack-diner/resources.rb +64 -0
- data/lib/flapjack-diner/response.rb +91 -0
- data/lib/flapjack-diner/tools.rb +47 -251
- data/lib/flapjack-diner/utility.rb +16 -0
- data/lib/flapjack-diner/version.rb +1 -1
- data/lib/flapjack-diner.rb +54 -20
- data/spec/argument_validator_spec.rb +87 -28
- data/spec/flapjack-diner_spec.rb +42 -64
- data/spec/relationships_spec.rb +211 -0
- data/spec/resources/checks_spec.rb +219 -79
- data/spec/resources/contacts_spec.rb +179 -151
- data/spec/resources/events_spec.rb +208 -0
- data/spec/resources/maintenance_periods_spec.rb +177 -565
- data/spec/resources/media_spec.rb +157 -171
- data/spec/resources/metrics_spec.rb +45 -0
- data/spec/resources/rules_spec.rb +278 -0
- data/spec/resources/states_spec.rb +93 -0
- data/spec/resources/statistics_spec.rb +53 -0
- data/spec/resources/tags_spec.rb +243 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/fixture_data.rb +541 -0
- metadata +33 -31
- data/.rubocop.yml +0 -21
- data/.rubocop_todo.yml +0 -135
- data/lib/flapjack-diner/resources/checks.rb +0 -64
- data/lib/flapjack-diner/resources/contacts.rb +0 -70
- data/lib/flapjack-diner/resources/entities.rb +0 -68
- data/lib/flapjack-diner/resources/maintenance_periods.rb +0 -82
- data/lib/flapjack-diner/resources/media.rb +0 -61
- data/lib/flapjack-diner/resources/notification_rules.rb +0 -66
- data/lib/flapjack-diner/resources/notifications.rb +0 -28
- data/lib/flapjack-diner/resources/pagerduty_credentials.rb +0 -59
- data/lib/flapjack-diner/resources/reports.rb +0 -33
- data/spec/pacts/flapjack-diner-flapjack.json +0 -4515
- data/spec/resources/entities_spec.rb +0 -181
- data/spec/resources/notification_rules_spec.rb +0 -341
- data/spec/resources/notifications_spec.rb +0 -208
- data/spec/resources/pagerduty_credentials_spec.rb +0 -237
- data/spec/resources/reports_spec.rb +0 -255
data/README.md
CHANGED
@@ -7,8 +7,7 @@
|
|
7
7
|
|
8
8
|
Access the JSON API of a [Flapjack](http://flapjack.io/) system monitoring server.
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
Please note that the following documentation refers to the `v2.0.0-alpha.3` pre-release of this gem. You may instead be looking for [documentation for the latest stable version](https://github.com/flapjack/flapjack-diner/blob/maint/1.x/README.md).
|
12
11
|
|
13
12
|
## Installation
|
14
13
|
|
@@ -54,122 +53,199 @@ Flapjack::Diner.return_keys_as_strings = true
|
|
54
53
|
|
55
54
|
## Functions
|
56
55
|
|
57
|
-
|
56
|
+
Options for all of **flapjack-diner**'s functions are organised as either:
|
58
57
|
|
59
|
-
* Ids
|
60
|
-
*
|
61
|
-
* Payload data -- Arrays of Hashes
|
58
|
+
* Ids &emdash; One or more String or Integer values; or
|
59
|
+
* Parameters &emdash; One or more Hashes
|
62
60
|
|
63
61
|
While these can be passed in in any order, the convention is that they will be ordered as listed above.
|
64
62
|
|
65
|
-
If any operation fails (returning nil), `Flapjack::Diner.last_error` will
|
63
|
+
If any operation fails (returning nil), the `Flapjack::Diner.last_error` method will return an error message regarding the failure.
|
64
|
+
|
65
|
+
<a name="contents_section_checks"> </a>
|
66
|
+
### <a name="contents_section_checks"> </a>[Checks](#section_checks)
|
67
|
+
|
68
|
+
* <a name="contents_create_checks"> </a>[create_checks](#create_checks)
|
69
|
+
* <a name="contents_checks"> </a>[checks](#get_checks)
|
70
|
+
* <a name="contents_update_checks"> </a>[update_checks](#update_checks)
|
71
|
+
* <a name="contents_delete_checks"> </a>[delete_checks](#delete_checks)
|
72
|
+
|
73
|
+
### <a name="contents_section_contacts"> </a>[Contacts](#section_contacts)
|
74
|
+
|
75
|
+
* <a name="contents_create_contacts"> </a>[create_contacts](#create_contacts)
|
76
|
+
* <a name="contents_contacts"> </a>[contacts](#get_contacts)
|
77
|
+
* <a name="contents_update_contacts"> </a>[update_contacts](#update_contacts)
|
78
|
+
* <a name="contents_delete_contacts"> </a>[delete_contacts](#delete_contacts)
|
79
|
+
|
80
|
+
### <a name="contents_section_media"> </a>[Media](#section_media)
|
81
|
+
|
82
|
+
* <a name="contents_create_media"> </a>[create_media](#create_media)
|
83
|
+
* <a name="contents_media"> </a>[media](#get_media)
|
84
|
+
* <a name="contents_update_media"> </a>[update_media](#update_media)
|
85
|
+
* <a name="contents_delete_media"> </a>[delete_media](#delete_media)
|
86
|
+
|
87
|
+
### <a name="contents_section_acceptors"> </a>[Acceptors](#section_acceptors)
|
88
|
+
|
89
|
+
* <a name="contents_create_acceptors"> </a>[create_acceptors](#create_acceptors)
|
90
|
+
* <a name="contents_acceptors"> </a>[acceptors](#get_acceptors)
|
91
|
+
* <a name="contents_update_acceptors"> </a>[update_acceptors](#update_acceptors)
|
92
|
+
* <a name="contents_delete_acceptors"> </a>[delete_acceptors](#delete_acceptors)
|
93
|
+
|
94
|
+
### <a name="contents_section_rejectors"> </a>[Rejectors](#section_rejectors)
|
95
|
+
|
96
|
+
* <a name="contents_create_rejectors"> </a>[create_rejectors](#create_rejectors)
|
97
|
+
* <a name="contents_rejectors"> </a>[rejectors](#get_rejectors)
|
98
|
+
* <a name="contents_update_rejectors"> </a>[update_rejectors](#update_rejectors)
|
99
|
+
* <a name="contents_delete_rejectors"> </a>[delete_rejectors](#delete_rejectors)
|
100
|
+
|
101
|
+
### <a name="contents_section_tags"> </a>[Tags](#section_tags)
|
102
|
+
|
103
|
+
* <a name="contents_create_tags"> </a>[create_tags](#create_tags)
|
104
|
+
* <a name="contents_tags"> </a>[tags](#get_tags)
|
105
|
+
* <a name="contents_update_tags"> </a>[update_tags](#update_tags)
|
106
|
+
* <a name="contents_delete_tags"> </a>[delete_tags](#delete_tags)
|
107
|
+
|
108
|
+
### <a name="contents_section_maintenance_periods"> </a>[Maintenance periods](#section_maintenance_periods)
|
109
|
+
|
110
|
+
* <a name="contents_create_scheduled_maintenances"> </a>[create_scheduled_maintenances](#create_scheduled_maintenances)
|
111
|
+
* <a name="contents_scheduled_maintenances"> </a>[scheduled_maintenances](#get_scheduled_maintenances)
|
112
|
+
* <a name="contents_update_scheduled_maintenances"> </a>[update_scheduled_maintenances](#update_scheduled_maintenances)
|
113
|
+
* <a name="contents_delete_scheduled_maintenances"> </a>[delete_scheduled_maintenances](#delete_scheduled_maintenances)
|
114
|
+
* <a name="contents_unscheduled_maintenances"> </a>[unscheduled_maintenances](#get_unscheduled_maintenances)
|
115
|
+
* <a name="contents_update_unscheduled_maintenances"> </a>[update_unscheduled_maintenances](#update_unscheduled_maintenances)
|
116
|
+
* <a name="contents_delete_unscheduled_maintenances"> </a>[delete_unscheduled_maintenances](#delete_unscheduled_maintenances)
|
117
|
+
|
118
|
+
### <a name="contents_section_events"> </a>[Events](#section_events)
|
119
|
+
|
120
|
+
* <a name="contents_create_acknowledgements"> </a>[create_acknowledgements](#create_acknowledgements)
|
121
|
+
* <a name="contents_create_test_notifications"> </a>[create_test_notifications](#create_test_notifications)
|
122
|
+
|
123
|
+
### <a name="contents_section_miscellaneous"> </a>[Miscellaneous](#section_miscellaneous)
|
124
|
+
|
125
|
+
* <a name="contents_states"> </a>[states](#get_states)
|
126
|
+
* <a name="contents_metrics"> </a>[metrics](#get_metrics)
|
127
|
+
* <a name="contents_statistics"> </a>[statistics](#get_statistics)
|
128
|
+
|
129
|
+
---
|
130
|
+
|
131
|
+
<a name="section_checks"> </a>
|
132
|
+
### Checks [^](#contents_section_checks)
|
133
|
+
|
134
|
+
<a name="create_checks"> </a>
|
135
|
+
### create_checks
|
136
|
+
|
137
|
+
Create one or more checks.
|
66
138
|
|
67
|
-
|
139
|
+
```ruby
|
140
|
+
Flapjack::Diner.create_checks(CHECK, ...)
|
141
|
+
```
|
68
142
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
143
|
+
```
|
144
|
+
CHECK
|
145
|
+
{
|
146
|
+
:id => STRING,
|
147
|
+
:name => STRING,
|
148
|
+
:enabled => BOOLEAN,
|
149
|
+
:tags => [TAG_NAME, ...]
|
150
|
+
}
|
151
|
+
```
|
73
152
|
|
74
|
-
|
153
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
75
154
|
|
76
|
-
|
77
|
-
* [media](#media)
|
78
|
-
* [update_media](#update_media)
|
79
|
-
* [delete_media](#delete_media)
|
155
|
+
[^](#contents_create_checks)
|
80
156
|
|
81
|
-
|
157
|
+
<a name="get_checks"> </a>
|
158
|
+
### checks
|
82
159
|
|
83
|
-
|
84
|
-
* [pagerduty_credentials](#pagerduty_credentials)
|
85
|
-
* [update_pagerduty_credentials](#update_pagerduty_credentials)
|
86
|
-
* [delete_pagerduty_credentials](#delete_pagerduty_credentials)
|
160
|
+
Return data for one, some or all checks.
|
87
161
|
|
88
|
-
|
162
|
+
```ruby
|
163
|
+
check = Flapjack::Diner.checks(CHECK_ID)
|
164
|
+
some_checks = Flapjack::Diner.checks(CHECK_ID, CHECK_ID, ...)
|
165
|
+
first_page_of_checks = Flapjack::Diner.checks
|
166
|
+
```
|
89
167
|
|
90
|
-
|
91
|
-
* [notification_rules](#notification_rules)
|
92
|
-
* [update_notification_rules](#update_notification_rules)
|
93
|
-
* [delete_notification_rules](#delete_notification_rules)
|
168
|
+
[^](#contents_checks)
|
94
169
|
|
95
|
-
|
170
|
+
<a name="update_checks"> </a>
|
171
|
+
### update_checks
|
172
|
+
|
173
|
+
Update data for one or more checks.
|
96
174
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
* [update_entities](#update_entities)
|
175
|
+
```ruby
|
176
|
+
# update values for one check
|
177
|
+
Flapjack::Diner.update_checks(CHECK_ID, KEY => VALUE, ...)
|
101
178
|
|
102
|
-
|
103
|
-
|
179
|
+
# update values for multiple checks
|
180
|
+
Flapjack::Diner.update_checks({CHECK_ID, KEY => VALUE, ...}, {CHECK_ID, KEY => VALUE, ...})
|
181
|
+
```
|
104
182
|
|
105
|
-
|
106
|
-
* [update_unscheduled_maintenances_entities](#update_unscheduled_maintenances_entities)
|
183
|
+
Acceptable update field keys are
|
107
184
|
|
108
|
-
|
185
|
+
`:enabled`, `:name` and `:tags`
|
109
186
|
|
110
|
-
|
187
|
+
Returns true if updating succeeded or false if updating failed.
|
111
188
|
|
112
|
-
|
113
|
-
* [checks](#checks)
|
114
|
-
* [update_checks](#update_checks)
|
189
|
+
[^](#contents_update_checks)
|
115
190
|
|
116
|
-
|
117
|
-
|
191
|
+
<a name="delete_checks"> </a>
|
192
|
+
#### delete_checks
|
118
193
|
|
119
|
-
|
120
|
-
* [update_unscheduled_maintenances_checks](#update_unscheduled_maintenances_checks)
|
194
|
+
Delete one or more checks.
|
121
195
|
|
122
|
-
|
196
|
+
```ruby
|
197
|
+
# delete one check
|
198
|
+
Flapjack::Diner.delete_checks(CHECK_ID)
|
123
199
|
|
124
|
-
|
200
|
+
# delete multiple check
|
201
|
+
Flapjack::Diner.delete_checks(CHECK_ID, CHECK_ID, ...)
|
202
|
+
```
|
125
203
|
|
126
|
-
|
127
|
-
* [scheduled_maintenance_report_entities](#scheduled_maintenance_report_entities)
|
128
|
-
* [unscheduled_maintenance_report_entities](#unscheduled_maintenance_report_entities)
|
129
|
-
* [downtime_report_entities](#downtime_report_entities)
|
130
|
-
* [outage_report_entities](#outage_report_entities)
|
204
|
+
Returns true if deletion succeeded or false if deletion failed.
|
131
205
|
|
132
|
-
|
133
|
-
* [scheduled_maintenance_report_checks](#scheduled_maintenance_report_checks)
|
134
|
-
* [unscheduled_maintenance_report_checks](#unscheduled_maintenance_report_checks)
|
135
|
-
* [downtime_report_checks](#downtime_report_checks)
|
136
|
-
* [outage_report_checks](#outage_report_checks)
|
206
|
+
[^](#contents_delete_checks)
|
137
207
|
|
138
208
|
---
|
139
209
|
|
210
|
+
<a name="section_contacts"> </a>
|
211
|
+
### Contacts [^](#contents_section_contacts)
|
212
|
+
|
140
213
|
<a name="create_contacts"> </a>
|
141
214
|
#### create_contacts
|
142
215
|
|
143
216
|
Create one or more contacts.
|
144
217
|
|
145
218
|
```ruby
|
146
|
-
Flapjack::Diner.create_contacts(
|
219
|
+
Flapjack::Diner.create_contacts(CONTACT, ...)
|
147
220
|
```
|
148
221
|
|
149
222
|
```
|
150
223
|
CONTACT
|
151
224
|
{
|
152
225
|
:id => STRING,
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:tags => [STRING, ...]
|
226
|
+
:name => STRING,
|
227
|
+
:timezone => STRING,
|
228
|
+
:tags => [TAG_NAME, ...]
|
157
229
|
}
|
158
230
|
```
|
159
231
|
|
160
|
-
Returns
|
232
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
161
233
|
|
162
|
-
|
234
|
+
[^](#contents_create_contacts)
|
235
|
+
|
236
|
+
<a name="get_contacts"> </a>
|
163
237
|
#### contacts
|
164
238
|
|
165
239
|
Return data for one, some or all contacts.
|
166
240
|
|
167
241
|
```ruby
|
168
|
-
contact = Flapjack::Diner.contacts(
|
169
|
-
some_contacts = Flapjack::Diner.contacts(
|
170
|
-
|
242
|
+
contact = Flapjack::Diner.contacts(CONTACT_ID)
|
243
|
+
some_contacts = Flapjack::Diner.contacts(CONTACT_ID, CONTACT_ID, ...)
|
244
|
+
first_page_of_contacts = Flapjack::Diner.contacts
|
171
245
|
```
|
172
246
|
|
247
|
+
[^](#contents_contacts)
|
248
|
+
|
173
249
|
<a name="update_contacts"> </a>
|
174
250
|
#### update_contacts
|
175
251
|
|
@@ -177,27 +253,20 @@ Update data for one or more contacts.
|
|
177
253
|
|
178
254
|
```ruby
|
179
255
|
# update values for one contact
|
180
|
-
Flapjack::Diner.update_contacts(
|
256
|
+
Flapjack::Diner.update_contacts(CONTACT_ID, KEY => VALUE, ...)
|
181
257
|
|
182
258
|
# update values for multiple contacts
|
183
|
-
Flapjack::Diner.update_contacts(
|
259
|
+
Flapjack::Diner.update_contacts({CONTACT_ID, KEY => VALUE, ...}, {CONTACT_ID, KEY => VALUE, ...})
|
184
260
|
```
|
185
261
|
|
186
262
|
Acceptable update field keys are
|
187
263
|
|
188
|
-
`:
|
189
|
-
|
190
|
-
as well as the linkage operations
|
191
|
-
|
192
|
-
`:add_entity`, `:remove_entity`
|
193
|
-
`:add_notification_rule`, `:remove_notification_rule`
|
194
|
-
|
195
|
-
which take the id (for entity and notification rule) of the relevant resource as the value.
|
196
|
-
|
197
|
-
(NB: `:add_medium` and `:remove_medium` are not supported in Flapjack v1.x but will be in future versions.)
|
264
|
+
`:name`, `:timezone` and `:tags`
|
198
265
|
|
199
266
|
Returns true if updating succeeded, false if updating failed.
|
200
267
|
|
268
|
+
[^](#contents_update_contacts)
|
269
|
+
|
201
270
|
<a name="delete_contacts"> </a>
|
202
271
|
#### delete_contacts
|
203
272
|
|
@@ -205,48 +274,64 @@ Delete one or more contacts.
|
|
205
274
|
|
206
275
|
```ruby
|
207
276
|
# delete one contact
|
208
|
-
Flapjack::Diner.delete_contacts(
|
277
|
+
Flapjack::Diner.delete_contacts(CONTACT_ID)
|
209
278
|
|
210
279
|
# delete multiple contacts
|
211
|
-
Flapjack::Diner.delete_contacts(
|
280
|
+
Flapjack::Diner.delete_contacts(CONTACT_ID, CONTACT_ID, ...)
|
212
281
|
```
|
213
282
|
|
214
283
|
Returns true if deletion succeeded or false if deletion failed.
|
215
284
|
|
285
|
+
[^](#contents_delete_contacts)
|
286
|
+
|
216
287
|
---
|
217
288
|
|
218
|
-
<a name="
|
219
|
-
|
289
|
+
<a name="section_media"> </a>
|
290
|
+
### Media [^](#contents_section_media)
|
291
|
+
|
292
|
+
<a name="create_media"> </a>
|
293
|
+
#### create_media
|
220
294
|
|
221
295
|
Create one or more notification media.
|
222
296
|
|
223
297
|
```ruby
|
224
|
-
Flapjack::Diner.
|
298
|
+
Flapjack::Diner.create_media(MEDIUM, MEDIUM, ...)
|
225
299
|
```
|
226
300
|
|
227
|
-
```
|
228
|
-
MEDIUM
|
301
|
+
```ruby
|
302
|
+
# MEDIUM
|
229
303
|
{
|
230
|
-
:
|
231
|
-
:
|
232
|
-
:
|
233
|
-
:
|
304
|
+
:id => UUID,
|
305
|
+
:transport => STRING, # required
|
306
|
+
:address => STRING, # required (context depends on transport)
|
307
|
+
:interval => INTEGER, # required (if transport != 'pagerduty')
|
308
|
+
:rollup_threshold => INTEGER, # required (if transport != 'pagerduty')
|
309
|
+
:pagerduty_subdomain => STRING, # required (if transport == 'pagerduty')
|
310
|
+
:pagerduty_token => STRING, # required (if transport == 'pagerduty')
|
311
|
+
:pagerduty_ack_duration => INTEGER, # required (if transport == 'pagerduty')
|
312
|
+
:contact => CONTACT_ID, # required
|
313
|
+
:acceptors => [ACCEPTOR_ID, ACCEPTOR_ID, ...],
|
314
|
+
:rejectors => [REJECTOR_ID, REJECTOR_ID, ...]
|
234
315
|
}
|
235
316
|
```
|
236
317
|
|
237
|
-
Returns
|
318
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
319
|
+
|
320
|
+
[^](#contents_create_media)
|
238
321
|
|
239
|
-
<a name="
|
322
|
+
<a name="get_media"> </a>
|
240
323
|
#### media
|
241
324
|
|
242
|
-
Return data for one, some or all notification media.
|
325
|
+
Return data for one, some or all notification media.
|
243
326
|
|
244
327
|
```ruby
|
245
|
-
medium = Flapjack::Diner.media(
|
246
|
-
some_media = Flapjack::Diner.media(
|
247
|
-
|
328
|
+
medium = Flapjack::Diner.media(MEDIUM_ID)
|
329
|
+
some_media = Flapjack::Diner.media(MEDIUM_ID, MEDIUM_ID, ...)
|
330
|
+
first_page_of_media = Flapjack::Diner.media
|
248
331
|
```
|
249
332
|
|
333
|
+
[^](#contents_media)
|
334
|
+
|
250
335
|
<a name="update_media"> </a>
|
251
336
|
#### update_media
|
252
337
|
|
@@ -254,18 +339,20 @@ Update data for one or more notification media.
|
|
254
339
|
|
255
340
|
```ruby
|
256
341
|
# update values for one medium
|
257
|
-
Flapjack::Diner.update_media(
|
342
|
+
Flapjack::Diner.update_media(MEDIUM_ID, KEY => VALUE, ...)
|
258
343
|
|
259
344
|
# update values for multiple media
|
260
|
-
Flapjack::Diner.update_media(
|
345
|
+
Flapjack::Diner.update_media({MEDIUM_ID, KEY => VALUE, ...}, {MEDIUM_ID, KEY => VALUE, ...})
|
261
346
|
```
|
262
347
|
|
263
348
|
Acceptable update field keys are
|
264
349
|
|
265
|
-
`:address`, `:interval`, `:rollup_threshold`
|
350
|
+
`:address`, `:interval`, `:rollup_threshold`, `:pagerduty_subdomain`, `:pagerduty_token`, `:pagerduty_ack_duration`, `:acceptors` and `:rejectors`
|
266
351
|
|
267
352
|
Returns true if updating succeeded or false if updating failed.
|
268
353
|
|
354
|
+
[^](#contents_update_media)
|
355
|
+
|
269
356
|
<a name="delete_media"> </a>
|
270
357
|
#### delete_media
|
271
358
|
|
@@ -273,564 +360,684 @@ Delete one or more notification media.
|
|
273
360
|
|
274
361
|
```ruby
|
275
362
|
# delete one medium
|
276
|
-
Flapjack::Diner.delete_media(
|
363
|
+
Flapjack::Diner.delete_media(MEDIUM_ID)
|
277
364
|
|
278
365
|
# delete multiple media
|
279
|
-
Flapjack::Diner.delete_media(
|
366
|
+
Flapjack::Diner.delete_media(MEDIUM_ID, MEDIUM_ID, ...)
|
280
367
|
```
|
281
368
|
|
282
369
|
Returns true if deletion succeeded or false if deletion failed.
|
283
370
|
|
371
|
+
[^](#contents_delete_media)
|
372
|
+
|
284
373
|
---
|
285
374
|
|
286
|
-
<a name="
|
287
|
-
|
375
|
+
<a name="section_acceptors"> </a>
|
376
|
+
### Acceptors [^](#contents_section_acceptors)
|
377
|
+
|
378
|
+
<a name="create_acceptors"> </a>
|
379
|
+
#### create_acceptors
|
288
380
|
|
289
|
-
Create
|
381
|
+
Create one or more notification acceptors.
|
290
382
|
|
291
383
|
```ruby
|
292
|
-
Flapjack::Diner.
|
384
|
+
Flapjack::Diner.create_acceptors(ACCEPTOR, ...)
|
293
385
|
```
|
294
386
|
|
295
|
-
|
296
|
-
|
387
|
+
**FIXME** time_restrictions data structure isn't handled yet
|
388
|
+
|
389
|
+
```ruby
|
390
|
+
# ACCEPTOR
|
297
391
|
{
|
298
|
-
:
|
299
|
-
:
|
300
|
-
:
|
301
|
-
:
|
392
|
+
:id => UUID_STRING,
|
393
|
+
:name => STRING,
|
394
|
+
:all => BOOLEAN, # apply to all checks, ignore tag linkages
|
395
|
+
:conditions_list => STRING, # which conditions the acceptor will match;
|
396
|
+
# all if empty, or comma-separated subset
|
397
|
+
# of 'critical,warning,unknown'
|
398
|
+
:contact => CONTACT_ID, # required
|
399
|
+
:media => [MEDIUM_ID, ...]
|
400
|
+
:tags => [TAG_NAME, ...]
|
302
401
|
}
|
303
402
|
```
|
304
403
|
|
305
|
-
Returns
|
404
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
306
405
|
|
307
|
-
|
308
|
-
#### pagerduty_credentials
|
406
|
+
[^](#contents_create_acceptors)
|
309
407
|
|
310
|
-
|
408
|
+
<a name="get_acceptors"> </a>
|
409
|
+
#### acceptors
|
410
|
+
|
411
|
+
Return data for one, some or all notification acceptors.
|
311
412
|
|
312
413
|
```ruby
|
313
|
-
|
314
|
-
|
315
|
-
|
414
|
+
acceptor = Flapjack::Diner.acceptors(ACCEPTOR_ID)
|
415
|
+
some_acceptors = Flapjack::Diner.acceptors(ACCEPTOR_ID, ACCEPTOR_ID, ...)
|
416
|
+
first_page_of_acceptors = Flapjack::Diner.acceptors
|
316
417
|
```
|
317
418
|
|
318
|
-
|
319
|
-
|
419
|
+
[^](#contents_acceptors)
|
420
|
+
|
421
|
+
<a name="update_acceptors"> </a>
|
422
|
+
#### update_acceptors
|
320
423
|
|
321
|
-
Update
|
424
|
+
Update data for one or more notification acceptors.
|
322
425
|
|
323
426
|
```ruby
|
324
|
-
# update
|
325
|
-
Flapjack::Diner.
|
427
|
+
# update values for one acceptor
|
428
|
+
Flapjack::Diner.update_acceptors(:id => ACCEPTOR_ID, KEY => VALUE, ...)
|
326
429
|
|
327
|
-
# update
|
328
|
-
Flapjack::Diner.
|
430
|
+
# update values for multiple acceptors
|
431
|
+
Flapjack::Diner.update_acceptors({:id => ACCEPTOR_ID, KEY => VALUE, ...}, {:id => ACCEPTOR_ID, KEY => VALUE, ...})
|
329
432
|
```
|
330
433
|
|
331
434
|
Acceptable update field keys are
|
332
435
|
|
333
|
-
`:
|
436
|
+
`:conditions_list`, `:is_blackhole`, `:media` and `:tags`
|
334
437
|
|
335
438
|
Returns true if updating succeeded or false if updating failed.
|
336
439
|
|
337
|
-
|
338
|
-
|
440
|
+
[^](#contents_update_acceptors)
|
441
|
+
|
442
|
+
<a name="delete_acceptors"> </a>
|
443
|
+
#### delete_acceptors
|
339
444
|
|
340
|
-
Delete
|
445
|
+
Delete one or more notification acceptors.
|
341
446
|
|
342
447
|
```ruby
|
343
|
-
# delete
|
344
|
-
Flapjack::Diner.
|
448
|
+
# delete one acceptor
|
449
|
+
Flapjack::Diner.delete_acceptors(ACCEPTOR_ID)
|
345
450
|
|
346
|
-
# delete
|
347
|
-
Flapjack::Diner.
|
451
|
+
# delete multiple acceptors
|
452
|
+
Flapjack::Diner.delete_acceptors(ACCEPTOR_ID, ACCEPTOR_ID, ...)
|
348
453
|
```
|
349
454
|
|
350
455
|
Returns true if deletion succeeded or false if deletion failed.
|
351
456
|
|
457
|
+
[^](#contents_delete_acceptors)
|
458
|
+
|
352
459
|
---
|
353
460
|
|
354
|
-
<a name="
|
355
|
-
|
461
|
+
<a name="section_rejectors"> </a>
|
462
|
+
### Rules [^](#contents_section_rejectors)
|
463
|
+
|
464
|
+
<a name="create_rejectors"> </a>
|
465
|
+
#### create_rejectors
|
356
466
|
|
357
|
-
Create one or more notification
|
467
|
+
Create one or more notification rejectors.
|
358
468
|
|
359
469
|
```ruby
|
360
|
-
Flapjack::Diner.
|
470
|
+
Flapjack::Diner.create_rejectors(REJECTOR, ...)
|
361
471
|
```
|
362
472
|
|
363
|
-
|
364
|
-
|
473
|
+
**FIXME** time_restrictions data structure isn't handled yet
|
474
|
+
|
475
|
+
```ruby
|
476
|
+
# REJECTOR
|
365
477
|
{
|
366
|
-
:id
|
367
|
-
:
|
368
|
-
:
|
369
|
-
:
|
370
|
-
|
371
|
-
|
372
|
-
:
|
373
|
-
:
|
374
|
-
:
|
375
|
-
:unknown_blackhole => BOOLEAN,
|
376
|
-
:warning_blackhole => BOOLEAN,
|
377
|
-
:critical_blackhole => BOOLEAN
|
478
|
+
:id => UUID_STRING,
|
479
|
+
:name => STRING,
|
480
|
+
:all => BOOLEAN, # apply to all checks, ignore tag linkages
|
481
|
+
:conditions_list => STRING, # which conditions the rejector will match;
|
482
|
+
# all if empty, or comma-separated subset
|
483
|
+
# of 'critical,warning,unknown'
|
484
|
+
:contact => CONTACT_ID, # required
|
485
|
+
:media => [MEDIUM_ID, ...]
|
486
|
+
:tags => [TAG_NAME, ...]
|
378
487
|
}
|
379
488
|
```
|
380
489
|
|
381
|
-
Returns
|
490
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
382
491
|
|
383
|
-
|
384
|
-
#### notification_rules
|
492
|
+
[^](#contents_create_rejectors)
|
385
493
|
|
386
|
-
|
494
|
+
<a name="get_rejectors"> </a>
|
495
|
+
#### rejectors
|
496
|
+
|
497
|
+
Return data for one, some or all notification rejectors.
|
387
498
|
|
388
499
|
```ruby
|
389
|
-
|
390
|
-
|
391
|
-
|
500
|
+
rejector = Flapjack::Diner.rejectors(REJECTOR_ID)
|
501
|
+
some_rejectors = Flapjack::Diner.rejectors(REJECTOR_ID, REJECTOR_ID, ...)
|
502
|
+
first_page_of_rejectors = Flapjack::Diner.rejectors
|
392
503
|
```
|
393
504
|
|
394
|
-
|
395
|
-
|
505
|
+
[^](#contents_rejectors)
|
506
|
+
|
507
|
+
<a name="update_rejectors"> </a>
|
508
|
+
#### update_rejectors
|
396
509
|
|
397
|
-
Update data for one or more notification
|
510
|
+
Update data for one or more notification rejectors.
|
398
511
|
|
399
512
|
```ruby
|
400
|
-
# update values for one
|
401
|
-
Flapjack::Diner.
|
513
|
+
# update values for one rejector
|
514
|
+
Flapjack::Diner.update_rejectors(:id => REJECTOR_ID, KEY => VALUE, ...)
|
402
515
|
|
403
|
-
# update values for multiple
|
404
|
-
Flapjack::Diner.
|
516
|
+
# update values for multiple rejectors
|
517
|
+
Flapjack::Diner.update_rejectors({:id => REJECTOR_ID, KEY => VALUE, ...}, {:id => REJECTOR_ID, KEY => VALUE, ...})
|
405
518
|
```
|
406
519
|
|
407
520
|
Acceptable update field keys are
|
408
521
|
|
409
|
-
|
522
|
+
`:conditions_list`, `:is_blackhole`, `:media` and `:tags`
|
410
523
|
|
411
524
|
Returns true if updating succeeded or false if updating failed.
|
412
525
|
|
413
|
-
|
414
|
-
|
526
|
+
[^](#contents_update_rejectors)
|
527
|
+
|
528
|
+
<a name="delete_rejectors"> </a>
|
529
|
+
#### delete_rejectors
|
415
530
|
|
416
|
-
Delete one or more notification
|
531
|
+
Delete one or more notification rejectors.
|
417
532
|
|
418
533
|
```ruby
|
419
|
-
# delete one
|
420
|
-
Flapjack::Diner.
|
534
|
+
# delete one rejector
|
535
|
+
Flapjack::Diner.delete_rejectors(REJECTOR_ID)
|
421
536
|
|
422
|
-
# delete multiple
|
423
|
-
Flapjack::Diner.
|
537
|
+
# delete multiple rejectors
|
538
|
+
Flapjack::Diner.delete_rejectors(REJECTOR_ID, REJECTOR_ID, ...)
|
424
539
|
```
|
425
540
|
|
426
541
|
Returns true if deletion succeeded or false if deletion failed.
|
427
542
|
|
543
|
+
[^](#contents_delete_rejectors)
|
544
|
+
|
428
545
|
---
|
429
546
|
|
430
|
-
<a name="
|
431
|
-
###
|
547
|
+
<a name="section_tags"> </a>
|
548
|
+
### Tags [^](#contents_section_tags)
|
432
549
|
|
433
|
-
|
550
|
+
<a name="create_tags"> </a>
|
551
|
+
#### create_tags
|
552
|
+
|
553
|
+
Create one or more tags.
|
434
554
|
|
435
555
|
```ruby
|
436
|
-
Flapjack::Diner.
|
556
|
+
Flapjack::Diner.create_tags(TAG, ...)
|
437
557
|
```
|
438
558
|
|
439
|
-
```
|
440
|
-
|
559
|
+
```ruby
|
560
|
+
# TAG
|
441
561
|
{
|
442
|
-
:
|
443
|
-
:
|
444
|
-
:
|
562
|
+
:name => STRING, # required
|
563
|
+
:checks => [CHECK_ID, ...],
|
564
|
+
:contacts => [CONTACT_ID, ...],
|
565
|
+
:acceptors => [ACCEPTOR_ID, ...],
|
566
|
+
:rejectors => [REJECTOR_ID, ...]
|
445
567
|
}
|
446
568
|
```
|
447
569
|
|
448
|
-
Returns
|
449
|
-
|
450
|
-
<a name="entities"> </a>
|
451
|
-
### entities
|
570
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
452
571
|
|
453
|
-
|
454
|
-
|
455
|
-
```ruby
|
456
|
-
entity = Flapjack::Diner.entities(ID)
|
457
|
-
some_entities = Flapjack::Diner.entities(ID1, ID2, ...)
|
458
|
-
all_entities = Flapjack::Diner.entities
|
459
|
-
```
|
572
|
+
[^](#contents_create_tags)
|
460
573
|
|
461
|
-
<a name="
|
462
|
-
|
574
|
+
<a name="get_tags"> </a>
|
575
|
+
#### tags
|
463
576
|
|
464
|
-
|
577
|
+
Return data for one, some or all tags.
|
465
578
|
|
466
579
|
```ruby
|
467
|
-
|
580
|
+
tag = Flapjack::Diner.tags(TAG_NAME)
|
581
|
+
some_tags = Flapjack::Diner.tags(TAG_NAME, TAG_NAME, ...)
|
582
|
+
first_page_of_tags = Flapjack::Diner.tags
|
468
583
|
```
|
469
584
|
|
470
|
-
|
471
|
-
### update_entities
|
585
|
+
[^](#contents_tags)
|
472
586
|
|
473
|
-
|
587
|
+
<a name="update_tags"> </a>
|
588
|
+
#### update_tags
|
589
|
+
|
590
|
+
Update data for one or more tags.
|
474
591
|
|
475
592
|
```ruby
|
476
|
-
# update values for one
|
477
|
-
Flapjack::Diner.
|
593
|
+
# update values for one tag
|
594
|
+
Flapjack::Diner.update_tags(:id => TAG_NAME, KEY => VALUE, ...)
|
478
595
|
|
479
|
-
# update values for multiple
|
480
|
-
Flapjack::Diner.
|
596
|
+
# update values for multiple tags
|
597
|
+
Flapjack::Diner.update_tags({:id => TAG_NAME, KEY => VALUE, ...}, {:id => TAG_NAME, KEY => VALUE, ...})
|
481
598
|
```
|
482
599
|
|
483
|
-
|
484
|
-
|
485
|
-
The linkage operations
|
486
|
-
|
487
|
-
`:add_contact` and `:remove_contact`
|
488
|
-
`:add_tag` and `:remove_tag`
|
600
|
+
Acceptable update field keys are
|
489
601
|
|
490
|
-
|
602
|
+
`:checks`, `:contacts`, `:acceptors` and `:rejectors`
|
491
603
|
|
492
604
|
Returns true if updating succeeded or false if updating failed.
|
493
605
|
|
606
|
+
[^](#contents_update_tags)
|
494
607
|
|
495
|
-
<a name="
|
496
|
-
|
608
|
+
<a name="delete_tags"> </a>
|
609
|
+
#### delete_tags
|
497
610
|
|
498
|
-
|
611
|
+
Delete one or more tags.
|
499
612
|
|
500
613
|
```ruby
|
501
|
-
|
502
|
-
|
614
|
+
# delete one tag
|
615
|
+
Flapjack::Diner.delete_tags(TAG_NAME)
|
503
616
|
|
504
|
-
|
505
|
-
|
506
|
-
{
|
507
|
-
:start_time => DATETIME,
|
508
|
-
:duration => INTEGER,
|
509
|
-
:summary => STRING
|
510
|
-
}
|
617
|
+
# delete multiple tags
|
618
|
+
Flapjack::Diner.delete_tags(TAG_NAME, TAG_NAME, ...)
|
511
619
|
```
|
512
620
|
|
513
|
-
Returns true if
|
514
|
-
|
515
|
-
<a name="delete_scheduled_maintenances_entities"> </a>
|
516
|
-
### delete_scheduled_maintenances_entities
|
621
|
+
Returns true if deletion succeeded or false if deletion failed.
|
517
622
|
|
518
|
-
|
623
|
+
[^](#contents_delete_tags)
|
519
624
|
|
520
|
-
|
521
|
-
Flapjack::Diner.delete_scheduled_maintenances_entities(ENTITY_ID(S), :start_time => DATETIME)
|
522
|
-
```
|
625
|
+
---
|
523
626
|
|
524
|
-
|
627
|
+
<a name="section_maintenance_periods"> </a>
|
628
|
+
### Maintenance periods [^](#contents_section_maintenance_periods)
|
525
629
|
|
526
|
-
<a name="
|
527
|
-
###
|
630
|
+
<a name="create_scheduled_maintenances"> </a>
|
631
|
+
### create_scheduled_maintenances
|
528
632
|
|
529
|
-
|
633
|
+
Create one or more scheduled maintenance periods (`duration` seconds in length) on one or more checks.
|
530
634
|
|
531
635
|
```ruby
|
532
|
-
Flapjack::Diner.
|
636
|
+
Flapjack::Diner.create_scheduled_maintenances(SCHEDULED_MAINTENANCE, ...)
|
533
637
|
```
|
534
638
|
|
535
|
-
```
|
536
|
-
|
639
|
+
```ruby
|
640
|
+
SCHEDULED_MAINTENANCE
|
537
641
|
{
|
538
|
-
:
|
539
|
-
:
|
642
|
+
:id => UUID,
|
643
|
+
:start_time => DATETIME, # required
|
644
|
+
:end_time => DATETIME, # required
|
645
|
+
:summary => STRING,
|
646
|
+
:check => CHECK_ID, # one (and only one) of :check or :tag must be provided
|
647
|
+
:tag => TAG_NAME # :tag will create scheduled maintenance periods for all checks that this tag is associated with
|
540
648
|
}
|
541
649
|
```
|
542
650
|
|
543
|
-
Returns
|
651
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
544
652
|
|
545
|
-
|
546
|
-
### update_unscheduled_maintenances_entities
|
653
|
+
[^](#contents_create_scheduled_maintenances)
|
547
654
|
|
548
|
-
|
655
|
+
<a name="get_scheduled_maintenances"> </a>
|
656
|
+
### scheduled_maintenances
|
657
|
+
|
658
|
+
Return data for one, some or all scheduled maintenance periods.
|
549
659
|
|
550
660
|
```ruby
|
551
|
-
Flapjack::Diner.
|
661
|
+
scheduled_maintenance = Flapjack::Diner.scheduled_maintenances(SCHEDULED_MAINTENANCE_ID)
|
662
|
+
some_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances(SCHEDULED_MAINTENANCE_ID, SCHEDULED_MAINTENANCE_ID, ...)
|
663
|
+
first_page_of_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances
|
552
664
|
```
|
553
665
|
|
554
|
-
|
666
|
+
[^](#contents_scheduled_maintenances)
|
555
667
|
|
556
|
-
<a name="
|
557
|
-
###
|
668
|
+
<a name="update_scheduled_maintenances"> </a>
|
669
|
+
### update_scheduled_maintenances
|
558
670
|
|
559
|
-
|
671
|
+
Update data for one or more scheduled maintenance periods.
|
560
672
|
|
561
673
|
```ruby
|
562
|
-
|
563
|
-
|
674
|
+
# update values for one scheduled maintenance period
|
675
|
+
Flapjack::Diner.update_scheduled_maintenances(:id => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...)
|
564
676
|
|
677
|
+
# update values for multiple scheduled maintenance periods
|
678
|
+
Flapjack::Diner.update_scheduled_maintenances({:id => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...}, {:id => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...})
|
565
679
|
```
|
566
|
-
TEST_NOTIFICATION
|
567
|
-
{
|
568
|
-
:summary => STRING
|
569
|
-
}
|
570
|
-
```
|
571
680
|
|
572
|
-
|
681
|
+
Acceptable update field keys are
|
682
|
+
|
683
|
+
`:start_time`, `:end_time` and `:summary`
|
573
684
|
|
574
|
-
|
685
|
+
Returns true if updating succeeded or false if updating failed.
|
575
686
|
|
576
|
-
|
577
|
-
### create_checks
|
687
|
+
**FIXME** we may make it a configuration setting as to whether times in the past may be edited
|
578
688
|
|
579
|
-
|
689
|
+
[^](#contents_update_scheduled_maintenances)
|
690
|
+
|
691
|
+
<a name="delete_scheduled_maintenances"> </a>
|
692
|
+
### delete_scheduled_maintenances
|
693
|
+
|
694
|
+
Delete one or more scheduled maintenance periods.
|
580
695
|
|
581
696
|
```ruby
|
582
|
-
Flapjack::Diner.
|
697
|
+
Flapjack::Diner.delete_scheduled_maintenances(SCHEDULED_MAINTENANCE_ID)
|
698
|
+
Flapjack::Diner.delete_scheduled_maintenances(SCHEDULED_MAINTENANCE_ID, SCHEDULED_MAINTENANCE_ID, ...)
|
583
699
|
```
|
584
700
|
|
585
|
-
|
586
|
-
CHECK
|
587
|
-
{
|
588
|
-
:entity_id => STRING,
|
589
|
-
:name => STRING,
|
590
|
-
:tags => [STRING, ...]
|
591
|
-
}
|
592
|
-
```
|
701
|
+
Returns true if deletion succeeded or false if deletion failed.
|
593
702
|
|
594
|
-
|
703
|
+
**FIXME** we may make it a configuration setting as to whether scheduled maintenance periods that have already started (or finished) may be deleted
|
595
704
|
|
596
|
-
|
597
|
-
### checks
|
705
|
+
[^](#contents_delete_scheduled_maintenances)
|
598
706
|
|
599
|
-
|
707
|
+
<a name="get_unscheduled_maintenances"> </a>
|
708
|
+
### unscheduled_maintenances
|
709
|
+
|
710
|
+
Return data for one, some or all unscheduled maintenance periods.
|
600
711
|
|
601
712
|
```ruby
|
602
|
-
|
603
|
-
|
604
|
-
|
713
|
+
unscheduled_maintenance = Flapjack::Diner.unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID)
|
714
|
+
some_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID, UNSCHEDULED_MAINTENANCE_ID, ...)
|
715
|
+
first_page_of_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances
|
605
716
|
```
|
606
717
|
|
607
|
-
|
608
|
-
|
718
|
+
[^](#contents_unscheduled_maintenances)
|
719
|
+
|
720
|
+
<a name="update_unscheduled_maintenances"> </a>
|
721
|
+
### update_unscheduled_maintenances
|
609
722
|
|
610
|
-
|
723
|
+
Update data for one or more unscheduled maintenance periods.
|
611
724
|
|
612
725
|
```ruby
|
613
|
-
|
726
|
+
Flapjack::Diner.update_unscheduled_maintenances(:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE)
|
727
|
+
|
728
|
+
Flapjack::Diner.update_unscheduled_maintenances({:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE},
|
729
|
+
{:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE}, ...)
|
614
730
|
```
|
615
731
|
|
616
|
-
|
617
|
-
### update_checks
|
732
|
+
Acceptable update field keys are
|
618
733
|
|
619
|
-
|
734
|
+
`:start_time`, `:end_time` and `:summary`
|
620
735
|
|
621
|
-
|
622
|
-
# update values for one checks
|
623
|
-
Flapjack::Diner.update_checks(ID, :key => value, ...)
|
736
|
+
Returns true if updating succeeded or false if updating failed.
|
624
737
|
|
625
|
-
|
626
|
-
Flapjack::Diner.update_checks(ID1, ID2, ..., :key => value, ...)
|
627
|
-
```
|
738
|
+
**FIXME** we may make it a configuration setting as to whether times in the past may be edited
|
628
739
|
|
629
|
-
|
740
|
+
[^](#contents_update_unscheduled_maintenances)
|
630
741
|
|
631
|
-
|
742
|
+
<a name="delete_unscheduled_maintenances"> </a>
|
743
|
+
### delete_unscheduled_maintenances
|
632
744
|
|
633
|
-
|
745
|
+
Delete one or more unscheduled maintenance periods.
|
634
746
|
|
635
|
-
|
747
|
+
```ruby
|
748
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID)
|
749
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID, UNSCHEDULED_MAINTENANCE_ID, ...)
|
750
|
+
```
|
636
751
|
|
637
|
-
|
752
|
+
Returns true if deletion succeeded or false if deletion failed.
|
638
753
|
|
639
|
-
|
754
|
+
**FIXME** we may make it a configuration setting as to whether unscheduled maintenance periods may be deleted
|
755
|
+
|
756
|
+
[^](#contents_delete_unscheduled_maintenances)
|
640
757
|
|
641
758
|
---
|
642
759
|
|
643
|
-
<a name="
|
644
|
-
###
|
760
|
+
<a name="section_events"> </a>
|
761
|
+
### Events [^](#contents_section_events)
|
762
|
+
|
763
|
+
<a name="create_acknowledgements"> </a>
|
764
|
+
### create_acknowledgements
|
645
765
|
|
646
|
-
|
766
|
+
Acknowledges any failing checks from those passed and sets up unscheduled maintenance (`duration` seconds long) on them.
|
647
767
|
|
648
768
|
```ruby
|
649
|
-
Flapjack::Diner.
|
769
|
+
Flapjack::Diner.create_acknowledgements(ACKNOWLEDGEMENT, ...)
|
650
770
|
```
|
651
771
|
|
652
|
-
```
|
653
|
-
|
772
|
+
```ruby
|
773
|
+
# ACKNOWLEDGEMENT
|
654
774
|
{
|
655
|
-
:
|
775
|
+
:summary => STRING,
|
656
776
|
:duration => INTEGER,
|
657
|
-
:
|
777
|
+
:check => CHECK_ID, # one (and only one) of :check or :tag must be provided
|
778
|
+
:tag => TAG_NAME # :tag will acknowledge all failing checks that this tag is associated with
|
658
779
|
}
|
659
780
|
```
|
660
781
|
|
661
|
-
Returns
|
782
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
662
783
|
|
663
|
-
|
664
|
-
### delete_scheduled_maintenances_checks
|
784
|
+
[^](#contents_create_acknowledgements)
|
665
785
|
|
666
|
-
|
786
|
+
<a name="create_test_notifications"> </a>
|
787
|
+
### create_test_notifications
|
667
788
|
|
668
|
-
|
669
|
-
Flapjack::Diner.delete_scheduled_maintenances_checks(CHECK_ID(S), :start_time => DATETIME)
|
670
|
-
```
|
671
|
-
|
672
|
-
Returns true if deletion succeeded or false if deletion failed. Raises an exception if the `:start_time` parameter is not supplied.
|
673
|
-
|
674
|
-
<a name="create_unscheduled_maintenances_checks"> </a>
|
675
|
-
### create_unscheduled_maintenances_checks
|
676
|
-
|
677
|
-
Acknowledges any failing checks from those passed and sets up unscheduled maintenance (`duration` seconds long) on them. (Check ids are composed by joining together the check's entity's name, the character ':' and the check's name.)
|
789
|
+
Instructs Flapjack to issue test notifications on the passed checks. These notifications will be sent to contacts configured to receive notifications for those checks.
|
678
790
|
|
679
791
|
```ruby
|
680
|
-
Flapjack::Diner.
|
792
|
+
Flapjack::Diner.create_test_notifications(TEST_NOTIFICATION, ...)
|
681
793
|
```
|
682
794
|
|
683
|
-
```
|
684
|
-
|
795
|
+
```ruby
|
796
|
+
# TEST_NOTIFICATION
|
685
797
|
{
|
686
|
-
:
|
687
|
-
:
|
798
|
+
:summary => STRING,
|
799
|
+
:check => CHECK_ID, # one (and only one) of :check or :tag must be provided
|
800
|
+
:tag => TAG_NAME # :tag will send test notifications for all checks that this tag is associated with
|
688
801
|
}
|
689
802
|
```
|
690
803
|
|
691
|
-
Returns
|
804
|
+
Returns false if creation failed, or the created object(s) if it succeeded.
|
692
805
|
|
693
|
-
|
694
|
-
### update_unscheduled_maintenances_checks
|
806
|
+
[^](#contents_create_test_notifications)
|
695
807
|
|
696
|
-
|
808
|
+
---
|
809
|
+
|
810
|
+
<a name="section_miscellaneous"> </a>
|
811
|
+
### Miscellaneous [^](#contents_section_miscellaneous)
|
812
|
+
|
813
|
+
<a name="get_states"> </a>
|
814
|
+
### states
|
815
|
+
|
816
|
+
Return data for one, some or all check states.
|
697
817
|
|
698
818
|
```ruby
|
699
|
-
Flapjack::Diner.
|
819
|
+
states = Flapjack::Diner.states(STATE_ID)
|
820
|
+
some_states = Flapjack::Diner.states(STATE_ID, STATE_ID, ...)
|
821
|
+
first_page_of_states = Flapjack::Diner.states
|
700
822
|
```
|
701
823
|
|
702
|
-
|
824
|
+
[^](#contents_states)
|
703
825
|
|
704
|
-
<a name="
|
705
|
-
###
|
826
|
+
<a name="get_metrics"> </a>
|
827
|
+
### metrics
|
706
828
|
|
707
|
-
|
829
|
+
Return global metric data for the flapjack instance (i.e. all components backed by the shared data store).
|
708
830
|
|
709
831
|
```ruby
|
710
|
-
Flapjack::Diner.
|
832
|
+
metrics = Flapjack::Diner.metrics
|
711
833
|
```
|
712
834
|
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
835
|
+
[^](#contents_metrics)
|
836
|
+
|
837
|
+
<a name="get_statistics"> </a>
|
838
|
+
### statistics
|
839
|
+
|
840
|
+
Return data for one, some or all flapjack processor instances.
|
841
|
+
|
842
|
+
```ruby
|
843
|
+
statistics = Flapjack::Diner.statistics(STATISTICS_ID)
|
844
|
+
some_statistics = Flapjack::Diner.statistics(STATISTICS_ID, STATISTICS_ID, ...)
|
845
|
+
first_page_of_statistics = Flapjack::Diner.statistics
|
718
846
|
```
|
719
847
|
|
720
|
-
|
848
|
+
[^](#contents_statistics)
|
721
849
|
|
722
850
|
---
|
723
851
|
|
724
|
-
<a name="
|
725
|
-
###
|
726
|
-
|
727
|
-
|
852
|
+
<a name="common_options_get"> </a>
|
853
|
+
### Common options for all GET requests
|
854
|
+
|
855
|
+
| Option | Type | Description |
|
856
|
+
|--------------|-----------------------------|-------------|
|
857
|
+
| `:fields` | String or Array of Strings | Limit the fields of `:include`d records |
|
858
|
+
| `:filter` | Hash | Resources must match query terms |
|
859
|
+
| `:include` | String or Array of Strings | Full resources to return with the response |
|
860
|
+
| `:sort` | String or Array of Strings | How the resources should be sorted |
|
861
|
+
| `:page` | Integer, > 0 | Page number |
|
862
|
+
| `:per_page` | Integer, > 0 | Number of resources per page |
|
863
|
+
|
864
|
+
|
865
|
+
<a name="common_options_get_include"> </a>
|
866
|
+
### Associated data allowed for the include parameter
|
867
|
+
|
868
|
+
| Method | Association | Assoc. Type |
|
869
|
+
|-----------------------------|-----------------------------------|--------------------------------|
|
870
|
+
| `.checks` | 'alerting_media' | ['medium', ...] |
|
871
|
+
| `.checks` | 'contacts' | ['contact', ...] |
|
872
|
+
| `.checks` | 'current_scheduled_maintenances' | ['scheduled_maintenance', ...] |
|
873
|
+
| `.checks` | 'current_state' | 'state' |
|
874
|
+
| `.checks` | 'current_unscheduled_maintenance' | 'unscheduled_maintenance' |
|
875
|
+
| `.checks` | 'latest_notifications' | ['state', ...] |
|
876
|
+
| `.checks` | 'tags' | ['tag', ...] |
|
877
|
+
| `.contacts` | 'acceptors' | ['acceptor', ...] |
|
878
|
+
| `.contacts` | 'checks' | ['check', ...] |
|
879
|
+
| `.contacts` | 'media' | ['medium', ...] |
|
880
|
+
| `.contacts` | 'rejectors' | ['rejector', ...] |
|
881
|
+
| `.contacts` | 'tags' | ['tag', ...] |
|
882
|
+
| `.media` | 'acceptors' | ['acceptor', ...] |
|
883
|
+
| `.media` | 'alerting_checks' | ['check', ...] |
|
884
|
+
| `.media` | 'contact' | 'contact' |
|
885
|
+
| `.media` | 'rejectors' | ['rejector', ...] |
|
886
|
+
| `.acceptors` | 'contact' | 'contact' |
|
887
|
+
| `.acceptors` | 'media' | ['medium', ...] |
|
888
|
+
| `.acceptors` | 'tags' | ['tag', ...] |
|
889
|
+
| `.rejectors` | 'contact' | 'contact' |
|
890
|
+
| `.rejectors` | 'media' | ['medium', ...] |
|
891
|
+
| `.rejectors` | 'tags' | ['tag', ...] |
|
892
|
+
| `.scheduled_maintenances` | 'check' | 'check' |
|
893
|
+
| `.states` | 'check' | 'check' |
|
894
|
+
| `.tags` | 'acceptors' | ['acceptor', ...] |
|
895
|
+
| `.tags` | 'checks' | ['check', ...] |
|
896
|
+
| `.tags` | 'contacts' | ['contact', ...] |
|
897
|
+
| `.tags` | 'rejectors' | ['acceptor', ...] |
|
898
|
+
| `.unscheduled_maintenances` | 'check' | 'check' |
|
899
|
+
|
900
|
+
NB: these may be chained, as long as they follow the allowed paths above; e.g.
|
728
901
|
|
729
902
|
```ruby
|
730
|
-
|
731
|
-
report_some = Flapjack::Diner.status_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
|
732
|
-
report_all = Flapjack::Diner.status_report_entities
|
903
|
+
Flapjack::Diner.contacts(CONTACT_ID, :include => 'media.alerting_checks')
|
733
904
|
```
|
734
905
|
|
735
|
-
|
736
|
-
### scheduled_maintenance_report_entities
|
906
|
+
The above will include both the contact's media *and* any alerting checks in extra data accessible via the `Flapjack::Diner.context` method; specifically, from the value held for`:included` key in the resulting Hash.
|
737
907
|
|
738
|
-
|
908
|
+
---
|
909
|
+
|
910
|
+
<a name="object_relationships_read"> </a>
|
911
|
+
### Retrieving object relationships
|
912
|
+
|
913
|
+
The following operations are supported: they will all return data in the format
|
739
914
|
|
740
915
|
```ruby
|
741
|
-
|
742
|
-
report_some = Flapjack::Diner.scheduled_maintenance_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
|
743
|
-
report_all = Flapjack::Diner.scheduled_maintenance_report_entities
|
916
|
+
{:type => LINKED_TYPE, :id => UUID}
|
744
917
|
```
|
745
918
|
|
746
|
-
|
747
|
-
### unscheduled_maintenance_report_entities
|
748
|
-
|
749
|
-
Return a report on unscheduled maintenance periods for checks in one, some or all entities.
|
919
|
+
(for singular resources), or
|
750
920
|
|
751
921
|
```ruby
|
752
|
-
|
753
|
-
report_some = Flapjack::Diner.unscheduled_maintenance_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
|
754
|
-
report_all = Flapjack::Diner.unscheduled_maintenance_report_entities
|
922
|
+
[{:type => LINKED_TYPE, :id => UUID}, {:type => LINKED_TYPE, :id => UUID}, ...]
|
755
923
|
```
|
756
924
|
|
757
|
-
|
758
|
-
### downtime_report_entities
|
759
|
-
|
760
|
-
Return a report on downtime data for checks in one, some or all entities.
|
925
|
+
for multiple resources.
|
761
926
|
|
762
|
-
```ruby
|
763
|
-
report = Flapjack::Diner.downtime_report_entities(ENTITY_ID)
|
764
|
-
report_some = Flapjack::Diner.downtime_report_entities(ENTITY_ID1, ENTITY_ID2, ...)
|
765
|
-
report_all = Flapjack::Diner.downtime_report_entities
|
766
927
|
```
|
928
|
+
check_link_alerting_media(check_id, opts = {})
|
929
|
+
check_link_contacts(check_id, opts = {})
|
930
|
+
check_link_current_scheduled_maintenances(check_id, opts = {})
|
931
|
+
check_link_current_state(check_id, opts = {})
|
932
|
+
check_link_current_unscheduled_maintenance(check_id, opts = {})
|
933
|
+
check_link_latest_notifications(check_id, opts = {})
|
934
|
+
check_link_scheduled_maintenances(check_id, opts = {})
|
935
|
+
check_link_states(check_id, opts = {})
|
936
|
+
check_link_tags(check_id, opts = {})
|
937
|
+
check_link_unscheduled_maintenances(check_id, opts = {})
|
767
938
|
|
768
|
-
|
769
|
-
|
939
|
+
contact_link_acceptors(contact_id, opts = {})
|
940
|
+
contact_link_checks(contact_id, opts = {})
|
941
|
+
contact_link_media(contact_id, opts = {})
|
942
|
+
contact_link_rejectors(contact_id, opts = {})
|
943
|
+
contact_link_tags(contact_id, opts = {})
|
770
944
|
|
771
|
-
|
945
|
+
medium_link_acceptors(medium_id, opts = {})
|
946
|
+
medium_link_alerting_checks(medium_id, opts = {})
|
947
|
+
medium_link_contact(medium_id, opts = {})
|
948
|
+
medium_link_rejectors(medium_id, opts = {})
|
772
949
|
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
report_all = Flapjack::Diner.outage_report_entities
|
777
|
-
```
|
950
|
+
acceptor_link_contact(acceptor_id, opts = {})
|
951
|
+
acceptor_link_media(acceptor_id, opts = {})
|
952
|
+
acceptor_link_tags(acceptor_id, opts = {})
|
778
953
|
|
779
|
-
|
780
|
-
|
954
|
+
rejector_link_contact(rejector_id, opts = {})
|
955
|
+
rejector_link_media(rejector_id, opts = {})
|
956
|
+
rejector_link_tags(rejector_id, opts = {})
|
781
957
|
|
782
|
-
|
958
|
+
state_link_check(state_id, opts = {})
|
783
959
|
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
960
|
+
tag_link_acceptors(tag_name, opts = {})
|
961
|
+
tag_link_checks(tag_name, opts = {})
|
962
|
+
tag_link_contacts(tag_name, opts = {})
|
963
|
+
tag_link_rejectors(tag_name, opts = {})
|
964
|
+
tag_link_scheduled_maintenances(tag_name, opts = {})
|
965
|
+
tag_link_states(tag_name, opts = {})
|
966
|
+
tag_link_unscheduled_maintenances(tag_name, opts = {})
|
788
967
|
```
|
789
968
|
|
790
|
-
|
791
|
-
### scheduled_maintenance_report_checks
|
969
|
+
All returned results are paginated, and the [common options for GET requests](#common_options_get) apply here too.
|
792
970
|
|
793
|
-
|
971
|
+
<a name="object_relationships_write"> </a>
|
972
|
+
### Manipulating object relationships
|
973
|
+
|
974
|
+
The following operations are supported; please note that some associations (e.g. associating an acceptor with a contact) must be made on object creation, via the secondary resource's create method, and cannot be altered later.
|
794
975
|
|
795
|
-
```ruby
|
796
|
-
report = Flapjack::Diner.scheduled_maintenance_report_checks(CHECK_ID)
|
797
|
-
report_some = Flapjack::Diner.scheduled_maintenance_report_checks(CHECK_ID1, CHECK_ID2, ...)
|
798
|
-
report_all = Flapjack::Diner.scheduled_maintenance_report_checks
|
799
976
|
```
|
977
|
+
create_check_link_tags(check_id, *tags_names)
|
978
|
+
update_check_link_tags(check_id, *tags_names)
|
979
|
+
delete_check_link_tags(check_id, *tags_names)
|
800
980
|
|
801
|
-
|
802
|
-
|
981
|
+
create_contact_link_tags(contact_id, *tags_names)
|
982
|
+
update_contact_link_tags(contact_id, *tags_names)
|
983
|
+
delete_contact_link_tags(contact_id, *tags_names)
|
803
984
|
|
804
|
-
|
985
|
+
create_medium_link_acceptors(medium_id, *acceptors_ids)
|
986
|
+
update_medium_link_acceptors(medium_id, *acceptors_ids)
|
987
|
+
delete_medium_link_acceptors(medium_id, *acceptors_ids)
|
805
988
|
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
report_all = Flapjack::Diner.unscheduled_maintenance_report_checks
|
810
|
-
```
|
989
|
+
create_medium_link_rejectors(medium_id, *rejectors_ids)
|
990
|
+
update_medium_link_rejectors(medium_id, *rejectors_ids)
|
991
|
+
delete_medium_link_rejectors(medium_id, *rejectors_ids)
|
811
992
|
|
812
|
-
|
813
|
-
|
993
|
+
create_acceptor_link_media(acceptor_id, *media_ids)
|
994
|
+
update_acceptor_link_media(acceptor_id, *media_ids)
|
995
|
+
delete_acceptor_link_media(acceptor_id, *media_ids)
|
814
996
|
|
815
|
-
|
997
|
+
create_acceptor_link_tags(acceptor_id, *tags_names)
|
998
|
+
update_acceptor_link_tags(acceptor_id, *tags_names)
|
999
|
+
delete_acceptor_link_tags(acceptor_id, *tags_names)
|
816
1000
|
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
report_all = Flapjack::Diner.downtime_report_checks
|
821
|
-
```
|
1001
|
+
create_rejector_link_media(rejector_id, *media_ids)
|
1002
|
+
update_rejector_link_media(rejector_id, *media_ids)
|
1003
|
+
delete_rejector_link_media(rejector_id, *media_ids)
|
822
1004
|
|
823
|
-
|
824
|
-
|
1005
|
+
create_rejector_link_tags(rejector_id, *tags_names)
|
1006
|
+
update_rejector_link_tags(rejector_id, *tags_names)
|
1007
|
+
delete_rejector_link_tags(rejector_id, *tags_names)
|
825
1008
|
|
826
|
-
|
1009
|
+
create_tag_link_checks(tag_name, *checks_ids)
|
1010
|
+
update_tag_link_checks(tag_name, *checks_ids)
|
1011
|
+
delete_tag_link_checks(tag_name, *checks_ids)
|
827
1012
|
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
1013
|
+
create_tag_link_contacts(tag_name, *contacts_ids)
|
1014
|
+
update_tag_link_contacts(tag_name, *contacts_ids)
|
1015
|
+
delete_tag_link_contacts(tag_name, *contacts_ids)
|
1016
|
+
|
1017
|
+
create_tag_link_acceptors(tag_name, *acceptors_ids)
|
1018
|
+
update_tag_link_acceptors(tag_name, *acceptors_ids)
|
1019
|
+
delete_tag_link_acceptors(tag_name, *acceptors_ids)
|
1020
|
+
|
1021
|
+
create_tag_link_rejectors(tag_name, *rejectors_ids)
|
1022
|
+
update_tag_link_rejectors(tag_name, *rejectors_ids)
|
1023
|
+
delete_tag_link_rejectors(tag_name, *rejectors_ids)
|
832
1024
|
```
|
833
1025
|
|
1026
|
+
<a name="object_relationships_write_create"> </a>
|
1027
|
+
#### `create_{resource}_link_{related}`
|
1028
|
+
|
1029
|
+
Creates new links between the `resource` represented by the first argument and the `related` resources represented by the rest of the arguments. At least one `related` resource identifier must be provided. If the `related` resource is already linked, it is skipped.
|
1030
|
+
|
1031
|
+
<a name="object_relationships_write_update"> </a>
|
1032
|
+
#### `update_{resource}_link_{related}`
|
1033
|
+
|
1034
|
+
Replace all current links between the `resource` represented by the first argument with the `related` resources represented by the rest of the arguments. If there are no further arguments, removes all current links of that type for the `resource`, otherwise removes any not present in the passed `related` resources and adds any that are passed but not already present.
|
1035
|
+
|
1036
|
+
<a name="object_relationships_write_delete"> </a>
|
1037
|
+
#### `delete_{resource}_link_{related}`
|
1038
|
+
|
1039
|
+
Remove the link between the `resource` represented by the first argument, and the `related` resources represented by the rest of the arguments. If there is no link for a related resource, deletion is skipped for that linkage.
|
1040
|
+
|
834
1041
|
---
|
835
1042
|
|
836
1043
|
## Contributing
|
@@ -839,4 +1046,4 @@ report_all = Flapjack::Diner.outage_report_checks
|
|
839
1046
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
840
1047
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
841
1048
|
4. Push to the branch (`git push origin my-new-feature`)
|
842
|
-
5. Create new Pull Request
|
1049
|
+
5. Create a new Pull Request
|