flapjack-diner 2.0.0b1 → 2.0.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +135 -0
- data/.travis.yml +10 -5
- data/README.md +125 -143
- data/flapjack-diner.gemspec +1 -1
- data/lib/flapjack-diner.rb +24 -54
- data/lib/flapjack-diner/argument_validator.rb +17 -0
- data/lib/flapjack-diner/resources/checks.rb +52 -0
- data/lib/flapjack-diner/resources/contacts.rb +54 -0
- data/lib/flapjack-diner/resources/events.rb +54 -0
- data/lib/flapjack-diner/resources/maintenance_periods.rb +76 -0
- data/lib/flapjack-diner/resources/media.rb +75 -0
- data/lib/flapjack-diner/resources/metrics.rb +23 -0
- data/lib/flapjack-diner/resources/relationships.rb +275 -0
- data/lib/flapjack-diner/resources/rules.rb +75 -0
- data/lib/flapjack-diner/resources/states.rb +24 -0
- data/lib/flapjack-diner/resources/statistics.rb +24 -0
- data/lib/flapjack-diner/resources/tags.rb +47 -0
- data/lib/flapjack-diner/tools.rb +456 -46
- data/lib/flapjack-diner/version.rb +1 -1
- data/spec/flapjack-diner_spec.rb +18 -9
- data/spec/resources/checks_spec.rb +7 -7
- data/spec/resources/contacts_spec.rb +12 -14
- data/spec/resources/events_spec.rb +13 -13
- data/spec/resources/maintenance_periods_spec.rb +3 -3
- data/spec/resources/media_spec.rb +3 -3
- data/spec/resources/metrics_spec.rb +1 -1
- data/spec/{relationships_spec.rb → resources/relationships_spec.rb} +25 -71
- data/spec/resources/rules_spec.rb +62 -62
- data/spec/resources/states_spec.rb +1 -1
- data/spec/resources/statistics_spec.rb +1 -1
- data/spec/resources/tags_spec.rb +19 -75
- data/spec/support/fixture_data.rb +43 -80
- metadata +22 -17
- data/lib/flapjack-diner/configuration.rb +0 -417
- data/lib/flapjack-diner/log_formatter.rb +0 -22
- data/lib/flapjack-diner/query.rb +0 -114
- data/lib/flapjack-diner/relationships.rb +0 -180
- data/lib/flapjack-diner/request.rb +0 -280
- data/lib/flapjack-diner/resources.rb +0 -64
- data/lib/flapjack-diner/response.rb +0 -91
- data/lib/flapjack-diner/utility.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ca71cf066fca99781cc543fb931e950771c52bc
|
4
|
+
data.tar.gz: 3487411a016d2d23688a188f74462dce813aa29d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d48ca39d5c3bc2eeee576baf6f469a7afde1bfc68e67356ce076caeba28c0ef9a613157a49006c12305e5746d0a87328fa3e86340cb47eeb495241f15ea3348
|
7
|
+
data.tar.gz: f54b0e2abd6e8836c8d46c9328a9af2e23aa8fb19f4169787370b0a9b29102cc3704b308a470dfd9f88aef9bb0af534a97e351b402b1de6ddabbf89072a26bb5
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
Exclude:
|
5
|
+
- 'lib/flapjack-diner.rb'
|
6
|
+
|
7
|
+
# doesn't handle multi-file state
|
8
|
+
Documentation:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/HashSyntax:
|
12
|
+
EnforcedStyle: hash_rockets
|
13
|
+
|
14
|
+
Style/SignalException:
|
15
|
+
EnforcedStyle: only_raise
|
16
|
+
|
17
|
+
Style/SpaceInsideBlockBraces:
|
18
|
+
SpaceBeforeBlockParameters: false
|
19
|
+
|
20
|
+
Style/SpaceInsideHashLiteralBraces:
|
21
|
+
EnforcedStyle: no_space
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`.
|
2
|
+
# The point is for the user to remove these configuration records
|
3
|
+
# one by one as the offences are removed from the code base.
|
4
|
+
|
5
|
+
# AccessorMethodName:
|
6
|
+
# Enabled: false
|
7
|
+
|
8
|
+
# AlignArray:
|
9
|
+
# Enabled: false
|
10
|
+
|
11
|
+
# AlignHash:
|
12
|
+
# Enabled: false
|
13
|
+
|
14
|
+
# AlignParameters:
|
15
|
+
# Enabled: false
|
16
|
+
|
17
|
+
# AndOr:
|
18
|
+
# Enabled: false
|
19
|
+
|
20
|
+
# AssignmentInCondition:
|
21
|
+
# Enabled: false
|
22
|
+
|
23
|
+
# BlockAlignment:
|
24
|
+
# Enabled: false
|
25
|
+
|
26
|
+
# BlockNesting:
|
27
|
+
# Max: 4
|
28
|
+
|
29
|
+
# Blocks:
|
30
|
+
# Enabled: false
|
31
|
+
|
32
|
+
# BracesAroundHashParameters:
|
33
|
+
# Enabled: false
|
34
|
+
|
35
|
+
# CaseIndentation:
|
36
|
+
# Enabled: false
|
37
|
+
|
38
|
+
# ClassLength:
|
39
|
+
# Max: 221
|
40
|
+
|
41
|
+
# CollectionMethods:
|
42
|
+
# Enabled: false
|
43
|
+
|
44
|
+
# CommentAnnotation:
|
45
|
+
# Enabled: false
|
46
|
+
|
47
|
+
# CyclomaticComplexity:
|
48
|
+
# Max: 32
|
49
|
+
|
50
|
+
# DotPosition:
|
51
|
+
# Enabled: false
|
52
|
+
|
53
|
+
# EmptyLines:
|
54
|
+
# Enabled: false
|
55
|
+
|
56
|
+
# EmptyLinesAroundBody:
|
57
|
+
# Enabled: false
|
58
|
+
|
59
|
+
# EndAlignment:
|
60
|
+
# Enabled: false
|
61
|
+
|
62
|
+
# FavorUnlessOverNegatedIf:
|
63
|
+
# Enabled: false
|
64
|
+
|
65
|
+
# FinalNewline:
|
66
|
+
# Enabled: false
|
67
|
+
|
68
|
+
# HashMethods:
|
69
|
+
# Enabled: false
|
70
|
+
|
71
|
+
# IfUnlessModifier:
|
72
|
+
# Enabled: false
|
73
|
+
|
74
|
+
# IndentationWidth:
|
75
|
+
# Enabled: false
|
76
|
+
|
77
|
+
# LineLength:
|
78
|
+
# Max: 120
|
79
|
+
|
80
|
+
# MethodCallParentheses:
|
81
|
+
# Enabled: false
|
82
|
+
|
83
|
+
# MethodLength:
|
84
|
+
# Max: 95
|
85
|
+
|
86
|
+
# MultilineBlockChain:
|
87
|
+
# Enabled: false
|
88
|
+
|
89
|
+
# ParenthesesAroundCondition:
|
90
|
+
# Enabled: false
|
91
|
+
|
92
|
+
# PredicateName:
|
93
|
+
# Enabled: false
|
94
|
+
|
95
|
+
# RaiseArgs:
|
96
|
+
# Enabled: false
|
97
|
+
|
98
|
+
# RedundantSelf:
|
99
|
+
# Enabled: false
|
100
|
+
|
101
|
+
# RescueException:
|
102
|
+
# Enabled: false
|
103
|
+
|
104
|
+
# Semicolon:
|
105
|
+
# Enabled: false
|
106
|
+
|
107
|
+
# ShadowingOuterLocalVariable:
|
108
|
+
# Enabled: false
|
109
|
+
|
110
|
+
# SpaceAfterNot:
|
111
|
+
# Enabled: false
|
112
|
+
|
113
|
+
# SpaceAroundOperators:
|
114
|
+
# Enabled: false
|
115
|
+
|
116
|
+
# SpaceInsideHashLiteralBraces:
|
117
|
+
# Enabled: false
|
118
|
+
|
119
|
+
# SpaceInsideParens:
|
120
|
+
# Enabled: false
|
121
|
+
|
122
|
+
# SpecialGlobalVars:
|
123
|
+
# Enabled: false
|
124
|
+
|
125
|
+
# StringLiterals:
|
126
|
+
# Enabled: false
|
127
|
+
|
128
|
+
# TrivialAccessors:
|
129
|
+
# Enabled: false
|
130
|
+
|
131
|
+
# UselessAssignment:
|
132
|
+
# Enabled: false
|
133
|
+
|
134
|
+
# WordArray:
|
135
|
+
# Enabled: false
|
data/.travis.yml
CHANGED
@@ -5,12 +5,17 @@ rvm:
|
|
5
5
|
- '2.1'
|
6
6
|
- '2.2'
|
7
7
|
cache: bundler
|
8
|
-
script: bundle exec rspec
|
8
|
+
script: "bundle exec rspec"
|
9
9
|
notifications:
|
10
10
|
irc:
|
11
11
|
channels:
|
12
|
-
|
12
|
+
- 'irc.freenode.net#flapjack'
|
13
13
|
template:
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
- '%{message} %{repository}#%{build_number} (%{branch} - %{commit} : %{author})'
|
15
|
+
hipchat:
|
16
|
+
template:
|
17
|
+
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}
|
18
|
+
(<a href="%{build_url}">Details</a>/<a href="%{compare_url}">Change view</a>)'
|
19
|
+
format: html
|
20
|
+
rooms:
|
21
|
+
secure: BfENxsVOSS6YKJn/kMr8ctXTvOvZHHlpgRN8AWshCEEaorPwFlCwlQuEYz+DSR7COjwLNZav5xnTFRaPkcCG8wc4ztMgSdv9XkrGjwJHxEEIzsjPT556LtLF4d8U2Di1MNsD6YGU7kvvzhh5hAPpEn0LBGhYlz+TCv+XCjI8/6I=
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
Access the JSON API of a [Flapjack](http://flapjack.io/) system monitoring server.
|
9
9
|
|
10
|
-
Please note that the following documentation refers to the `v2.0.
|
10
|
+
Please note that the following documentation refers to the `v2.0.0-alpha.1` pre-release of this gem. You may instead be looking for [documentation for the latest stable version](https://github.com/flapjack/flapjack-diner/blob/maint/1.x/README.md).
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -45,7 +45,7 @@ Flapjack::Diner.open_timeout(30)
|
|
45
45
|
Flapjack::Diner.read_timeout(300)
|
46
46
|
```
|
47
47
|
|
48
|
-
If you want the old behaviour
|
48
|
+
If you want the old behaviour wrt returning hashes with keys as strings (they're now symbols by default) then:
|
49
49
|
|
50
50
|
```ruby
|
51
51
|
Flapjack::Diner.return_keys_as_strings = true
|
@@ -55,8 +55,8 @@ Flapjack::Diner.return_keys_as_strings = true
|
|
55
55
|
|
56
56
|
Options for all of **flapjack-diner**'s functions are organised as either:
|
57
57
|
|
58
|
-
* Ids
|
59
|
-
* Parameters
|
58
|
+
* Ids &emdash; One or more String or Integer values; or
|
59
|
+
* Parameters &emdash; One or more Hashes
|
60
60
|
|
61
61
|
While these can be passed in in any order, the convention is that they will be ordered as listed above.
|
62
62
|
|
@@ -136,12 +136,10 @@ Flapjack::Diner.create_checks(CHECK, ...)
|
|
136
136
|
```
|
137
137
|
CHECK
|
138
138
|
{
|
139
|
-
:id =>
|
139
|
+
:id => STRING,
|
140
140
|
:name => STRING,
|
141
141
|
:enabled => BOOLEAN,
|
142
|
-
:
|
143
|
-
:repeat_failure_delay => INTEGER,
|
144
|
-
:tags => [UUID_STRING, ...]
|
142
|
+
:tags => [TAG_NAME, ...]
|
145
143
|
}
|
146
144
|
```
|
147
145
|
|
@@ -155,8 +153,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
155
153
|
Return data for one, some or all checks.
|
156
154
|
|
157
155
|
```ruby
|
158
|
-
check = Flapjack::Diner.checks(
|
159
|
-
some_checks = Flapjack::Diner.checks(
|
156
|
+
check = Flapjack::Diner.checks(CHECK_ID)
|
157
|
+
some_checks = Flapjack::Diner.checks(CHECK_ID, CHECK_ID, ...)
|
160
158
|
first_page_of_checks = Flapjack::Diner.checks
|
161
159
|
```
|
162
160
|
|
@@ -169,15 +167,15 @@ Update data for one or more checks.
|
|
169
167
|
|
170
168
|
```ruby
|
171
169
|
# update values for one check
|
172
|
-
Flapjack::Diner.update_checks(
|
170
|
+
Flapjack::Diner.update_checks(CHECK_ID, KEY => VALUE, ...)
|
173
171
|
|
174
172
|
# update values for multiple checks
|
175
|
-
Flapjack::Diner.update_checks({
|
173
|
+
Flapjack::Diner.update_checks({CHECK_ID, KEY => VALUE, ...}, {CHECK_ID, KEY => VALUE, ...})
|
176
174
|
```
|
177
175
|
|
178
176
|
Acceptable update field keys are
|
179
177
|
|
180
|
-
`:enabled`, `:name
|
178
|
+
`:enabled`, `:name` and `:tags`
|
181
179
|
|
182
180
|
Returns true if updating succeeded or false if updating failed.
|
183
181
|
|
@@ -190,10 +188,10 @@ Delete one or more checks.
|
|
190
188
|
|
191
189
|
```ruby
|
192
190
|
# delete one check
|
193
|
-
Flapjack::Diner.delete_checks(
|
191
|
+
Flapjack::Diner.delete_checks(CHECK_ID)
|
194
192
|
|
195
193
|
# delete multiple check
|
196
|
-
Flapjack::Diner.delete_checks(
|
194
|
+
Flapjack::Diner.delete_checks(CHECK_ID, CHECK_ID, ...)
|
197
195
|
```
|
198
196
|
|
199
197
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -214,13 +212,13 @@ Create one or more contacts.
|
|
214
212
|
Flapjack::Diner.create_contacts(CONTACT, ...)
|
215
213
|
```
|
216
214
|
|
217
|
-
```
|
218
|
-
|
215
|
+
```
|
216
|
+
CONTACT
|
219
217
|
{
|
220
|
-
:id =>
|
218
|
+
:id => STRING,
|
221
219
|
:name => STRING,
|
222
220
|
:timezone => STRING,
|
223
|
-
:tags => [
|
221
|
+
:tags => [TAG_NAME, ...]
|
224
222
|
}
|
225
223
|
```
|
226
224
|
|
@@ -234,8 +232,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
234
232
|
Return data for one, some or all contacts.
|
235
233
|
|
236
234
|
```ruby
|
237
|
-
contact = Flapjack::Diner.contacts(
|
238
|
-
some_contacts = Flapjack::Diner.contacts(
|
235
|
+
contact = Flapjack::Diner.contacts(CONTACT_ID)
|
236
|
+
some_contacts = Flapjack::Diner.contacts(CONTACT_ID, CONTACT_ID, ...)
|
239
237
|
first_page_of_contacts = Flapjack::Diner.contacts
|
240
238
|
```
|
241
239
|
|
@@ -248,10 +246,10 @@ Update data for one or more contacts.
|
|
248
246
|
|
249
247
|
```ruby
|
250
248
|
# update values for one contact
|
251
|
-
Flapjack::Diner.update_contacts(
|
249
|
+
Flapjack::Diner.update_contacts(CONTACT_ID, KEY => VALUE, ...)
|
252
250
|
|
253
251
|
# update values for multiple contacts
|
254
|
-
Flapjack::Diner.update_contacts({
|
252
|
+
Flapjack::Diner.update_contacts({CONTACT_ID, KEY => VALUE, ...}, {CONTACT_ID, KEY => VALUE, ...})
|
255
253
|
```
|
256
254
|
|
257
255
|
Acceptable update field keys are
|
@@ -269,10 +267,10 @@ Delete one or more contacts.
|
|
269
267
|
|
270
268
|
```ruby
|
271
269
|
# delete one contact
|
272
|
-
Flapjack::Diner.delete_contacts(
|
270
|
+
Flapjack::Diner.delete_contacts(CONTACT_ID)
|
273
271
|
|
274
272
|
# delete multiple contacts
|
275
|
-
Flapjack::Diner.delete_contacts(
|
273
|
+
Flapjack::Diner.delete_contacts(CONTACT_ID, CONTACT_ID, ...)
|
276
274
|
```
|
277
275
|
|
278
276
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -296,7 +294,7 @@ Flapjack::Diner.create_media(MEDIUM, MEDIUM, ...)
|
|
296
294
|
```ruby
|
297
295
|
# MEDIUM
|
298
296
|
{
|
299
|
-
:id =>
|
297
|
+
:id => UUID,
|
300
298
|
:transport => STRING, # required
|
301
299
|
:address => STRING, # required (context depends on transport)
|
302
300
|
:interval => INTEGER, # required (if transport != 'pagerduty')
|
@@ -304,8 +302,8 @@ Flapjack::Diner.create_media(MEDIUM, MEDIUM, ...)
|
|
304
302
|
:pagerduty_subdomain => STRING, # required (if transport == 'pagerduty')
|
305
303
|
:pagerduty_token => STRING, # required (if transport == 'pagerduty')
|
306
304
|
:pagerduty_ack_duration => INTEGER, # required (if transport == 'pagerduty')
|
307
|
-
:contact =>
|
308
|
-
:rules => [
|
305
|
+
:contact => CONTACT_ID, # required
|
306
|
+
:rules => [RULE_ID, RULE_ID, ...]
|
309
307
|
}
|
310
308
|
```
|
311
309
|
|
@@ -319,8 +317,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
319
317
|
Return data for one, some or all notification media.
|
320
318
|
|
321
319
|
```ruby
|
322
|
-
medium = Flapjack::Diner.media(
|
323
|
-
some_media = Flapjack::Diner.media(
|
320
|
+
medium = Flapjack::Diner.media(MEDIUM_ID)
|
321
|
+
some_media = Flapjack::Diner.media(MEDIUM_ID, MEDIUM_ID, ...)
|
324
322
|
first_page_of_media = Flapjack::Diner.media
|
325
323
|
```
|
326
324
|
|
@@ -333,10 +331,10 @@ Update data for one or more notification media.
|
|
333
331
|
|
334
332
|
```ruby
|
335
333
|
# update values for one medium
|
336
|
-
Flapjack::Diner.update_media(
|
334
|
+
Flapjack::Diner.update_media(MEDIUM_ID, KEY => VALUE, ...)
|
337
335
|
|
338
336
|
# update values for multiple media
|
339
|
-
Flapjack::Diner.update_media({
|
337
|
+
Flapjack::Diner.update_media({MEDIUM_ID, KEY => VALUE, ...}, {MEDIUM_ID, KEY => VALUE, ...})
|
340
338
|
```
|
341
339
|
|
342
340
|
Acceptable update field keys are
|
@@ -354,10 +352,10 @@ Delete one or more notification media.
|
|
354
352
|
|
355
353
|
```ruby
|
356
354
|
# delete one medium
|
357
|
-
Flapjack::Diner.delete_media(
|
355
|
+
Flapjack::Diner.delete_media(MEDIUM_ID)
|
358
356
|
|
359
357
|
# delete multiple media
|
360
|
-
Flapjack::Diner.delete_media(
|
358
|
+
Flapjack::Diner.delete_media(MEDIUM_ID, MEDIUM_ID, ...)
|
361
359
|
```
|
362
360
|
|
363
361
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -378,21 +376,22 @@ Create one or more notification rules.
|
|
378
376
|
Flapjack::Diner.create_rules(RULE, ...)
|
379
377
|
```
|
380
378
|
|
379
|
+
**FIXME** time_restrictions data structure isn't handled yet
|
380
|
+
|
381
|
+
**FIXME** should empty `conditions_list` implicitly specify blackhole -- thus
|
382
|
+
remove the `is_blackhole` boolean?
|
383
|
+
|
381
384
|
```ruby
|
382
385
|
# RULE
|
383
386
|
{
|
384
|
-
:id
|
385
|
-
:
|
386
|
-
|
387
|
-
|
388
|
-
:
|
389
|
-
:
|
390
|
-
|
391
|
-
|
392
|
-
:time_restriction_ical => STRING,
|
393
|
-
:contact => UUID_STRING, # required
|
394
|
-
:media => [UUID_STRING, ...]
|
395
|
-
:tags => [UUID_STRING, ...]
|
387
|
+
:id => UUID_STRING,
|
388
|
+
:conditions_list => STRING, # which conditions the rule will match;
|
389
|
+
# all if empty, or comma-separated subset
|
390
|
+
# of 'critical,warning,unknown'
|
391
|
+
:is_blackhole => BOOLEAN,
|
392
|
+
:contact => CONTACT_ID, # required
|
393
|
+
:media => [MEDIUM_ID, ...]
|
394
|
+
:tags => [TAG_NAME, ...]
|
396
395
|
}
|
397
396
|
```
|
398
397
|
|
@@ -406,8 +405,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
406
405
|
Return data for one, some or all notification rules.
|
407
406
|
|
408
407
|
```ruby
|
409
|
-
rule = Flapjack::Diner.rules(
|
410
|
-
some_rules = Flapjack::Diner.rules(
|
408
|
+
rule = Flapjack::Diner.rules(RULE_ID)
|
409
|
+
some_rules = Flapjack::Diner.rules(RULE_ID, RULE_ID, ...)
|
411
410
|
first_page_of_rules = Flapjack::Diner.rules
|
412
411
|
```
|
413
412
|
|
@@ -420,15 +419,15 @@ Update data for one or more notification rules.
|
|
420
419
|
|
421
420
|
```ruby
|
422
421
|
# update values for one rule
|
423
|
-
Flapjack::Diner.update_rules(:id =>
|
422
|
+
Flapjack::Diner.update_rules(:id => RULE_ID, KEY => VALUE, ...)
|
424
423
|
|
425
424
|
# update values for multiple rules
|
426
|
-
Flapjack::Diner.update_rules({:id =>
|
425
|
+
Flapjack::Diner.update_rules({:id => RULE_ID, KEY => VALUE, ...}, {:id => RULE_ID, KEY => VALUE, ...})
|
427
426
|
```
|
428
427
|
|
429
428
|
Acceptable update field keys are
|
430
429
|
|
431
|
-
`:
|
430
|
+
`:conditions_list`, `:is_blackhole`, `:media` and `:tags`
|
432
431
|
|
433
432
|
Returns true if updating succeeded or false if updating failed.
|
434
433
|
|
@@ -441,10 +440,10 @@ Delete one or more notification rules.
|
|
441
440
|
|
442
441
|
```ruby
|
443
442
|
# delete one rule
|
444
|
-
Flapjack::Diner.delete_rules(
|
443
|
+
Flapjack::Diner.delete_rules(RULE_ID)
|
445
444
|
|
446
445
|
# delete multiple rules
|
447
|
-
Flapjack::Diner.delete_rules(
|
446
|
+
Flapjack::Diner.delete_rules(RULE_ID, RULE_ID, ...)
|
448
447
|
```
|
449
448
|
|
450
449
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -468,11 +467,10 @@ Flapjack::Diner.create_tags(TAG, ...)
|
|
468
467
|
```ruby
|
469
468
|
# TAG
|
470
469
|
{
|
471
|
-
:
|
472
|
-
:
|
473
|
-
:
|
474
|
-
|
475
|
-
:rules => [UUID_STRING, ...]
|
470
|
+
:name => STRING, # required
|
471
|
+
:checks => [CHECK_ID, ...]
|
472
|
+
:rules => [RULE_ID, ...]
|
473
|
+
}
|
476
474
|
```
|
477
475
|
|
478
476
|
Returns false if creation failed, or the created object(s) if it succeeded.
|
@@ -485,8 +483,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
485
483
|
Return data for one, some or all tags.
|
486
484
|
|
487
485
|
```ruby
|
488
|
-
tag = Flapjack::Diner.tags(
|
489
|
-
some_tags = Flapjack::Diner.tags(
|
486
|
+
tag = Flapjack::Diner.tags(TAG_NAME)
|
487
|
+
some_tags = Flapjack::Diner.tags(TAG_NAME, TAG_NAME, ...)
|
490
488
|
first_page_of_tags = Flapjack::Diner.tags
|
491
489
|
```
|
492
490
|
|
@@ -499,15 +497,15 @@ Update data for one or more tags.
|
|
499
497
|
|
500
498
|
```ruby
|
501
499
|
# update values for one tag
|
502
|
-
Flapjack::Diner.update_tags(:id =>
|
500
|
+
Flapjack::Diner.update_tags(:id => TAG_NAME, KEY => VALUE, ...)
|
503
501
|
|
504
502
|
# update values for multiple tags
|
505
|
-
Flapjack::Diner.update_tags({:id =>
|
503
|
+
Flapjack::Diner.update_tags({:id => TAG_NAME, KEY => VALUE, ...}, {:id => TAG_NAME, KEY => VALUE, ...})
|
506
504
|
```
|
507
505
|
|
508
506
|
Acceptable update field keys are
|
509
507
|
|
510
|
-
`:checks
|
508
|
+
`:checks` and `:rules`
|
511
509
|
|
512
510
|
Returns true if updating succeeded or false if updating failed.
|
513
511
|
|
@@ -520,10 +518,10 @@ Delete one or more tags.
|
|
520
518
|
|
521
519
|
```ruby
|
522
520
|
# delete one tag
|
523
|
-
Flapjack::Diner.delete_tags(
|
521
|
+
Flapjack::Diner.delete_tags(TAG_NAME)
|
524
522
|
|
525
523
|
# delete multiple tags
|
526
|
-
Flapjack::Diner.delete_tags(
|
524
|
+
Flapjack::Diner.delete_tags(TAG_NAME, TAG_NAME, ...)
|
527
525
|
```
|
528
526
|
|
529
527
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -547,12 +545,12 @@ Flapjack::Diner.create_scheduled_maintenances(SCHEDULED_MAINTENANCE, ...)
|
|
547
545
|
```ruby
|
548
546
|
SCHEDULED_MAINTENANCE
|
549
547
|
{
|
550
|
-
:id =>
|
548
|
+
:id => UUID,
|
551
549
|
:start_time => DATETIME, # required
|
552
550
|
:end_time => DATETIME, # required
|
553
551
|
:summary => STRING,
|
554
|
-
:check =>
|
555
|
-
:tag =>
|
552
|
+
:check => CHECK_ID, # one (and only one) of :check or :tag must be provided
|
553
|
+
:tag => TAG_NAME # :tag will create scheduled maintenance periods for all checks that this tag is associated with
|
556
554
|
}
|
557
555
|
```
|
558
556
|
|
@@ -566,8 +564,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
566
564
|
Return data for one, some or all scheduled maintenance periods.
|
567
565
|
|
568
566
|
```ruby
|
569
|
-
scheduled_maintenance = Flapjack::Diner.scheduled_maintenances(
|
570
|
-
some_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances(
|
567
|
+
scheduled_maintenance = Flapjack::Diner.scheduled_maintenances(SCHEDULED_MAINTENANCE_ID)
|
568
|
+
some_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances(SCHEDULED_MAINTENANCE_ID, SCHEDULED_MAINTENANCE_ID, ...)
|
571
569
|
first_page_of_scheduled_maintenances = Flapjack::Diner.scheduled_maintenances
|
572
570
|
```
|
573
571
|
|
@@ -580,10 +578,10 @@ Update data for one or more scheduled maintenance periods.
|
|
580
578
|
|
581
579
|
```ruby
|
582
580
|
# update values for one scheduled maintenance period
|
583
|
-
Flapjack::Diner.update_scheduled_maintenances(:id =>
|
581
|
+
Flapjack::Diner.update_scheduled_maintenances(:id => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...)
|
584
582
|
|
585
583
|
# update values for multiple scheduled maintenance periods
|
586
|
-
Flapjack::Diner.update_scheduled_maintenances({:id =>
|
584
|
+
Flapjack::Diner.update_scheduled_maintenances({:id => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...}, {:id => SCHEDULED_MAINTENANCE_ID, KEY => VALUE, ...})
|
587
585
|
```
|
588
586
|
|
589
587
|
Acceptable update field keys are
|
@@ -602,8 +600,8 @@ Returns true if updating succeeded or false if updating failed.
|
|
602
600
|
Delete one or more scheduled maintenance periods.
|
603
601
|
|
604
602
|
```ruby
|
605
|
-
Flapjack::Diner.delete_scheduled_maintenances(
|
606
|
-
Flapjack::Diner.delete_scheduled_maintenances(
|
603
|
+
Flapjack::Diner.delete_scheduled_maintenances(SCHEDULED_MAINTENANCE_ID)
|
604
|
+
Flapjack::Diner.delete_scheduled_maintenances(SCHEDULED_MAINTENANCE_ID, SCHEDULED_MAINTENANCE_ID, ...)
|
607
605
|
```
|
608
606
|
|
609
607
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -618,8 +616,8 @@ Returns true if deletion succeeded or false if deletion failed.
|
|
618
616
|
Return data for one, some or all unscheduled maintenance periods.
|
619
617
|
|
620
618
|
```ruby
|
621
|
-
unscheduled_maintenance = Flapjack::Diner.unscheduled_maintenances(
|
622
|
-
some_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances(
|
619
|
+
unscheduled_maintenance = Flapjack::Diner.unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID)
|
620
|
+
some_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID, UNSCHEDULED_MAINTENANCE_ID, ...)
|
623
621
|
first_page_of_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenances
|
624
622
|
```
|
625
623
|
|
@@ -631,10 +629,10 @@ first_page_of_unscheduled_maintenances = Flapjack::Diner.unscheduled_maintenance
|
|
631
629
|
Update data for one or more unscheduled maintenance periods.
|
632
630
|
|
633
631
|
```ruby
|
634
|
-
Flapjack::Diner.update_unscheduled_maintenances(:id =>
|
632
|
+
Flapjack::Diner.update_unscheduled_maintenances(:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE)
|
635
633
|
|
636
|
-
Flapjack::Diner.update_unscheduled_maintenances({:id =>
|
637
|
-
{:id =>
|
634
|
+
Flapjack::Diner.update_unscheduled_maintenances({:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE},
|
635
|
+
{:id => UNSCHEDULED_MAINTENANCE_ID, KEY => VALUE}, ...)
|
638
636
|
```
|
639
637
|
|
640
638
|
Acceptable update field keys are
|
@@ -653,8 +651,8 @@ Returns true if updating succeeded or false if updating failed.
|
|
653
651
|
Delete one or more unscheduled maintenance periods.
|
654
652
|
|
655
653
|
```ruby
|
656
|
-
Flapjack::Diner.delete_unscheduled_maintenances(
|
657
|
-
Flapjack::Diner.delete_unscheduled_maintenances(
|
654
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID)
|
655
|
+
Flapjack::Diner.delete_unscheduled_maintenances(UNSCHEDULED_MAINTENANCE_ID, UNSCHEDULED_MAINTENANCE_ID, ...)
|
658
656
|
```
|
659
657
|
|
660
658
|
Returns true if deletion succeeded or false if deletion failed.
|
@@ -682,8 +680,8 @@ Flapjack::Diner.create_acknowledgements(ACKNOWLEDGEMENT, ...)
|
|
682
680
|
{
|
683
681
|
:summary => STRING,
|
684
682
|
:duration => INTEGER,
|
685
|
-
:check =>
|
686
|
-
:tag =>
|
683
|
+
:check => CHECK_ID, # one (and only one) of :check or :tag must be provided
|
684
|
+
:tag => TAG_NAME # :tag will acknowledge all failing checks that this tag is associated with
|
687
685
|
}
|
688
686
|
```
|
689
687
|
|
@@ -704,9 +702,8 @@ Flapjack::Diner.create_test_notifications(TEST_NOTIFICATION, ...)
|
|
704
702
|
# TEST_NOTIFICATION
|
705
703
|
{
|
706
704
|
:summary => STRING,
|
707
|
-
:
|
708
|
-
:
|
709
|
-
:tag => UUID_STRING # :tag will send test notifications for all checks that this tag is associated with
|
705
|
+
:check => CHECK_ID, # one (and only one) of :check or :tag must be provided
|
706
|
+
:tag => TAG_NAME # :tag will send test notifications for all checks that this tag is associated with
|
710
707
|
}
|
711
708
|
```
|
712
709
|
|
@@ -725,8 +722,8 @@ Returns false if creation failed, or the created object(s) if it succeeded.
|
|
725
722
|
Return data for one, some or all check states.
|
726
723
|
|
727
724
|
```ruby
|
728
|
-
states = Flapjack::Diner.states(
|
729
|
-
some_states = Flapjack::Diner.states(
|
725
|
+
states = Flapjack::Diner.states(STATE_ID)
|
726
|
+
some_states = Flapjack::Diner.states(STATE_ID, STATE_ID, ...)
|
730
727
|
first_page_of_states = Flapjack::Diner.states
|
731
728
|
```
|
732
729
|
|
@@ -749,8 +746,8 @@ metrics = Flapjack::Diner.metrics
|
|
749
746
|
Return data for one, some or all flapjack processor instances.
|
750
747
|
|
751
748
|
```ruby
|
752
|
-
statistics = Flapjack::Diner.statistics(
|
753
|
-
some_statistics = Flapjack::Diner.statistics(
|
749
|
+
statistics = Flapjack::Diner.statistics(STATISTICS_ID)
|
750
|
+
some_statistics = Flapjack::Diner.statistics(STATISTICS_ID, STATISTICS_ID, ...)
|
754
751
|
first_page_of_statistics = Flapjack::Diner.statistics
|
755
752
|
```
|
756
753
|
|
@@ -774,31 +771,29 @@ first_page_of_statistics = Flapjack::Diner.statistics
|
|
774
771
|
<a name="common_options_get_include"> </a>
|
775
772
|
### Associated data allowed for the include parameter
|
776
773
|
|
777
|
-
| Method
|
778
|
-
|
779
|
-
| `.checks`
|
780
|
-
| `.checks`
|
781
|
-
| `.checks`
|
782
|
-
| `.checks`
|
783
|
-
| `.checks`
|
784
|
-
| `.checks`
|
785
|
-
| `.checks`
|
786
|
-
| `.contacts`
|
787
|
-
| `.contacts`
|
788
|
-
| `.contacts`
|
789
|
-
| `.
|
790
|
-
| `.media`
|
791
|
-
| `.media`
|
792
|
-
| `.
|
793
|
-
| `.rules`
|
794
|
-
| `.rules`
|
795
|
-
| `.
|
796
|
-
| `.
|
797
|
-
| `.
|
798
|
-
| `.tags`
|
799
|
-
| `.
|
800
|
-
| `.tags` | 'rules' | ['rule', ...] |
|
801
|
-
| `.unscheduled_maintenances` | 'check' | 'check' |
|
774
|
+
| Method | Association | Assoc. Type |
|
775
|
+
|-----------|--------------|-------------|
|
776
|
+
| `.checks` | 'alerting_media' | ['medium', ...] |
|
777
|
+
| `.checks` | 'contacts' | ['contact', ...] |
|
778
|
+
| `.checks` | 'current_scheduled_maintenances' | ['scheduled_maintenance', ...] |
|
779
|
+
| `.checks` | 'current_state' | 'state' |
|
780
|
+
| `.checks` | 'current_unscheduled_maintenance' | 'unscheduled_maintenance' |
|
781
|
+
| `.checks` | 'latest_notifications' | ['state', ...] |
|
782
|
+
| `.checks` | 'tags' | ['tag', ...] |
|
783
|
+
| `.contacts` | 'checks' | ['check', ...] |
|
784
|
+
| `.contacts` | 'media' | ['medium', ...] |
|
785
|
+
| `.contacts` | 'rules' | ['rule', ...] |
|
786
|
+
| `.media` | 'alerting_checks' | ['check', ...] |
|
787
|
+
| `.media` | 'contact' | 'contact' |
|
788
|
+
| `.media` | 'rules' | ['rule', ...] |
|
789
|
+
| `.rules` | 'contact' | 'contact' |
|
790
|
+
| `.rules` | 'media' | ['medium', ...] |
|
791
|
+
| `.rules` | 'tags' | ['tag', ...] |
|
792
|
+
| `.scheduled_maintenances` | 'check' | 'check' |
|
793
|
+
| `.states` | 'check' | 'check' |
|
794
|
+
| `.tags` | 'checks' | ['check', ...] |
|
795
|
+
| `.tags` | 'rules' | ['rule', ...] |
|
796
|
+
| `.unscheduled_maintenances` | 'check' | 'check' |
|
802
797
|
|
803
798
|
NB: these may be chained, as long as they follow the allowed paths above; e.g.
|
804
799
|
|
@@ -842,7 +837,6 @@ check_link_unscheduled_maintenances(check_id, opts = {})
|
|
842
837
|
contact_link_checks(contact_id, opts = {})
|
843
838
|
contact_link_media(contact_id, opts = {})
|
844
839
|
contact_link_rules(contact_id, opts = {})
|
845
|
-
contact_link_tags(contact_id, opts = {})
|
846
840
|
|
847
841
|
medium_link_alerting_checks(medium_id, opts = {})
|
848
842
|
medium_link_contact(medium_id, opts = {})
|
@@ -854,12 +848,8 @@ rule_link_tags(rule_id, opts = {})
|
|
854
848
|
|
855
849
|
state_link_check(state_id, opts = {})
|
856
850
|
|
857
|
-
tag_link_checks(
|
858
|
-
|
859
|
-
tag_link_rules(tag_id, opts = {})
|
860
|
-
tag_link_scheduled_maintenances(tag_id, opts = {})
|
861
|
-
tag_link_states(tag_id, opts = {})
|
862
|
-
tag_link_unscheduled_maintenances(tag_id, opts = {})
|
851
|
+
tag_link_checks(tag_name, opts = {})
|
852
|
+
tag_link_rules(tag_name, opts = {})
|
863
853
|
```
|
864
854
|
|
865
855
|
All returned results are paginated, and the [common options for GET requests](#common_options_get) apply here too.
|
@@ -867,16 +857,12 @@ All returned results are paginated, and the [common options for GET requests](#c
|
|
867
857
|
<a name="object_relationships_write"> </a>
|
868
858
|
### Manipulating object relationships
|
869
859
|
|
870
|
-
The following operations are supported; please note that some associations (e.g. associating
|
860
|
+
The following operations are supported; please note that some associations (e.g. associating a rule with a contact) must be made on object creation, via the secondary resource's create method, and cannot be altered later.
|
871
861
|
|
872
862
|
```
|
873
|
-
create_check_link_tags(check_id, *
|
874
|
-
update_check_link_tags(check_id, *
|
875
|
-
delete_check_link_tags(check_id, *
|
876
|
-
|
877
|
-
create_contact_link_tags(contact_id, *tags_ids)
|
878
|
-
update_contact_link_tags(contact_id, *tags_ids)
|
879
|
-
delete_contact_link_tags(contact_id, *tags_ids)
|
863
|
+
create_check_link_tags(check_id, *tags_names)
|
864
|
+
update_check_link_tags(check_id, *tags_names)
|
865
|
+
delete_check_link_tags(check_id, *tags_names)
|
880
866
|
|
881
867
|
create_medium_link_rules(medium_id, *rules_ids)
|
882
868
|
update_medium_link_rules(medium_id, *rules_ids)
|
@@ -886,21 +872,17 @@ create_rule_link_media(rule_id, *media_ids)
|
|
886
872
|
update_rule_link_media(rule_id, *media_ids)
|
887
873
|
delete_rule_link_media(rule_id, *media_ids)
|
888
874
|
|
889
|
-
create_rule_link_tags(rule_id, *
|
890
|
-
update_rule_link_tags(rule_id, *
|
891
|
-
delete_rule_link_tags(rule_id, *
|
892
|
-
|
893
|
-
create_tag_link_checks(tag_id, *checks_ids)
|
894
|
-
update_tag_link_checks(tag_id, *checks_ids)
|
895
|
-
delete_tag_link_checks(tag_id, *checks_ids)
|
875
|
+
create_rule_link_tags(rule_id, *tags_names)
|
876
|
+
update_rule_link_tags(rule_id, *tags_names)
|
877
|
+
delete_rule_link_tags(rule_id, *tags_names)
|
896
878
|
|
897
|
-
|
898
|
-
|
899
|
-
|
879
|
+
create_tag_link_checks(tag_name, *checks_ids)
|
880
|
+
update_tag_link_checks(tag_name, *checks_ids)
|
881
|
+
delete_tag_link_checks(tag_name, *checks_ids)
|
900
882
|
|
901
|
-
create_tag_link_rules(
|
902
|
-
update_tag_link_rules(
|
903
|
-
delete_tag_link_rules(
|
883
|
+
create_tag_link_rules(tag_name, *rules_ids)
|
884
|
+
update_tag_link_rules(tag_name, *rules_ids)
|
885
|
+
delete_tag_link_rules(tag_name, *rules_ids)
|
904
886
|
```
|
905
887
|
|
906
888
|
<a name="object_relationships_write_create"> </a>
|