dogapi 1.22.0 → 1.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -1
  4. data/.rubocop.yml +13 -0
  5. data/.travis.yml +3 -1
  6. data/CHANGELOG.md +16 -1
  7. data/Gemfile +6 -3
  8. data/README.rdoc +1 -1
  9. data/Rakefile +8 -15
  10. data/lib/capistrano/datadog.rb +12 -12
  11. data/lib/capistrano/datadog/v2.rb +5 -5
  12. data/lib/capistrano/datadog/v3.rb +9 -4
  13. data/lib/dogapi/common.rb +43 -39
  14. data/lib/dogapi/event.rb +4 -4
  15. data/lib/dogapi/facade.rb +57 -54
  16. data/lib/dogapi/metric.rb +2 -2
  17. data/lib/dogapi/v1/alert.rb +17 -80
  18. data/lib/dogapi/v1/comment.rb +8 -39
  19. data/lib/dogapi/v1/dash.rb +20 -67
  20. data/lib/dogapi/v1/embed.rb +11 -57
  21. data/lib/dogapi/v1/event.rb +37 -72
  22. data/lib/dogapi/v1/metric.rb +17 -46
  23. data/lib/dogapi/v1/monitor.rb +54 -194
  24. data/lib/dogapi/v1/screenboard.rb +8 -77
  25. data/lib/dogapi/v1/search.rb +5 -11
  26. data/lib/dogapi/v1/service_check.rb +6 -15
  27. data/lib/dogapi/v1/snapshot.rb +10 -15
  28. data/lib/dogapi/v1/tag.rb +39 -99
  29. data/lib/dogapi/v1/user.rb +15 -69
  30. data/lib/dogapi/version.rb +1 -1
  31. data/spec/integration/alert_spec.rb +48 -0
  32. data/spec/integration/comment_spec.rb +32 -0
  33. data/spec/integration/common_spec.rb +32 -0
  34. data/spec/integration/dash_spec.rb +60 -0
  35. data/spec/integration/embed_spec.rb +43 -0
  36. data/spec/integration/event_spec.rb +73 -0
  37. data/spec/integration/metric_spec.rb +96 -0
  38. data/spec/integration/monitor_spec.rb +106 -0
  39. data/spec/integration/screenboard_spec.rb +61 -0
  40. data/spec/integration/search_spec.rb +11 -0
  41. data/spec/integration/service_check_spec.rb +12 -0
  42. data/spec/integration/snapshot_spec.rb +24 -0
  43. data/spec/integration/tag_spec.rb +66 -0
  44. data/spec/integration/user_spec.rb +46 -0
  45. data/spec/spec_helper.rb +85 -16
  46. data/spec/unit/common_spec.rb +101 -0
  47. data/spec/unit/facade_spec.rb +79 -0
  48. metadata +55 -52
  49. data/spec/alerts_spec.rb +0 -33
  50. data/spec/common_spec.rb +0 -37
  51. data/spec/facade_spec.rb +0 -166
  52. data/spec/support/cassettes/Alerts/create/returns_HTTP_code_200.yml +0 -114
  53. data/spec/support/cassettes/Alerts/create/returns_a_valid_event_ID.yml +0 -114
  54. data/spec/support/cassettes/Alerts/create/returns_the_same_query_as_sent.yml +0 -114
  55. data/spec/support/cassettes/Facade/Events/emits_aggregate_events.yml +0 -193
  56. data/spec/support/cassettes/Facade/Events/emits_events_and_retrieves_them.yml +0 -100
  57. data/spec/support/cassettes/Facade/Events/emits_events_with_specified_priority.yml +0 -98
  58. data/spec/support/cassettes/Facade/Tags/adds_updates_and_detaches_tags.yml +0 -442
  59. data/tests/test_alerts.rb +0 -38
  60. data/tests/test_base.rb +0 -30
  61. data/tests/test_client.rb +0 -23
  62. data/tests/test_comments.rb +0 -39
  63. data/tests/test_dashes.rb +0 -85
  64. data/tests/test_embed.rb +0 -194
  65. data/tests/test_monitors.rb +0 -192
  66. data/tests/test_screenboard.rb +0 -90
  67. data/tests/test_search.rb +0 -20
  68. data/tests/test_snapshot.rb +0 -28
  69. data/tests/test_users.rb +0 -65
@@ -1,98 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://app.datadoghq.com/api/v1/events?api_key=<DATADOG_API_KEY>
6
- body:
7
- encoding: UTF-8
8
- string: '{"msg_text":"test message","date_happened":1460397393,"msg_title":"title","priority":"low","parent":null,"tags":[],"aggregation_key":"","alert_type":null,"event_type":null,"source_type_name":null,"title":"title","text":"test
9
- message","host":"dogbox-yannmahe","device":null}'
10
- headers:
11
- Accept-Encoding:
12
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
13
- Accept:
14
- - "*/*"
15
- User-Agent:
16
- - Ruby
17
- Content-Type:
18
- - application/json
19
- response:
20
- status:
21
- code: 202
22
- message: Accepted
23
- headers:
24
- Content-Type:
25
- - text/plain; charset=utf-8
26
- Date:
27
- - Mon, 11 Apr 2016 17:56:33 GMT
28
- Dd-Pool:
29
- - propjoe
30
- Strict-Transport-Security:
31
- - max-age=15724800;
32
- X-Content-Type-Options:
33
- - nosniff
34
- Content-Length:
35
- - '247'
36
- Connection:
37
- - keep-alive
38
- body:
39
- encoding: UTF-8
40
- string: '{"status":"ok","event":{"id":491273867291425124,"title":"title","text":"test
41
- message","date_happened":1460397393,"handle":null,"priority":"low","related_event_id":null,"tags":[],"url":"https://app.datadoghq.com/event/event?id=491273867291425124"}}'
42
- http_version:
43
- recorded_at: Mon, 11 Apr 2016 17:56:33 GMT
44
- - request:
45
- method: get
46
- uri: https://app.datadoghq.com/api/v1/events/491273867291425124?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
47
- body:
48
- encoding: US-ASCII
49
- string: ''
50
- headers:
51
- Accept-Encoding:
52
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
53
- Accept:
54
- - "*/*"
55
- User-Agent:
56
- - Ruby
57
- response:
58
- status:
59
- code: 200
60
- message: OK
61
- headers:
62
- Cache-Control:
63
- - no-cache
64
- Content-Type:
65
- - application/json
66
- Date:
67
- - Mon, 11 Apr 2016 17:56:41 GMT
68
- Dd-Pool:
69
- - dogweb_sameorig
70
- Pragma:
71
- - no-cache
72
- Set-Cookie:
73
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:41 GMT"; Max-Age=604800; Path=/
74
- Strict-Transport-Security:
75
- - max-age=15724800;
76
- Vary:
77
- - Accept-Encoding
78
- X-Content-Type-Options:
79
- - nosniff
80
- X-Dd-Debug:
81
- - 74ZP/FagkgUH/fXz7TfrZdZNnEK/HFHV0fuIAe/vcZE=
82
- X-Dd-Version:
83
- - '33.3404'
84
- X-Frame-Options:
85
- - SAMEORIGIN
86
- Content-Length:
87
- - '213'
88
- Connection:
89
- - keep-alive
90
- body:
91
- encoding: UTF-8
92
- string: '{"event": {"date_happened": 1460397393, "alert_type": "info", "resource":
93
- "/api/v1/events/491273867291425124", "title": "title", "url": "/event/event?event_id=491273867291425124",
94
- "text": "test message", "tags": [], "device_name": null, "priority": "low",
95
- "host": "dogbox-yannmahe", "id": 491273867291425124}}'
96
- http_version:
97
- recorded_at: Mon, 11 Apr 2016 17:56:41 GMT
98
- recorded_with: VCR 2.9.3
@@ -1,442 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://app.datadoghq.com/api/v1/series?api_key=<DATADOG_API_KEY>
6
- body:
7
- encoding: UTF-8
8
- string: '{"series":[{"metric":"test.tag.metric","points":[[1460397371,1.0]],"type":"gauge","host":"test.tag.host","device":null}]}'
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - "*/*"
14
- User-Agent:
15
- - Ruby
16
- Content-Type:
17
- - application/json
18
- response:
19
- status:
20
- code: 202
21
- message: Accepted
22
- headers:
23
- Content-Type:
24
- - text/json
25
- Date:
26
- - Mon, 11 Apr 2016 17:56:11 GMT
27
- Dd-Pool:
28
- - propjoe
29
- Strict-Transport-Security:
30
- - max-age=15724800;
31
- X-Content-Type-Options:
32
- - nosniff
33
- Content-Length:
34
- - '16'
35
- Connection:
36
- - keep-alive
37
- body:
38
- encoding: UTF-8
39
- string: '{"status": "ok"}'
40
- http_version:
41
- recorded_at: Mon, 11 Apr 2016 17:56:11 GMT
42
- - request:
43
- method: delete
44
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
45
- body:
46
- encoding: US-ASCII
47
- string: ''
48
- headers:
49
- Accept-Encoding:
50
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
51
- Accept:
52
- - "*/*"
53
- User-Agent:
54
- - Ruby
55
- response:
56
- status:
57
- code: 204
58
- message: No Content
59
- headers:
60
- Cache-Control:
61
- - no-cache
62
- Content-Length:
63
- - '4'
64
- Content-Type:
65
- - application/json
66
- Date:
67
- - Mon, 11 Apr 2016 17:56:21 GMT
68
- Dd-Pool:
69
- - dogweb_sameorig
70
- Pragma:
71
- - no-cache
72
- Set-Cookie:
73
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:21 GMT"; Max-Age=604800; Path=/
74
- Strict-Transport-Security:
75
- - max-age=15724800;
76
- X-Content-Type-Options:
77
- - nosniff
78
- X-Dd-Debug:
79
- - Q7aBYzHHllsXmnqYXTRnBui4yUFIlE4QkBCcKXhPzNs=
80
- X-Dd-Version:
81
- - '33.3404'
82
- X-Frame-Options:
83
- - SAMEORIGIN
84
- Connection:
85
- - keep-alive
86
- body:
87
- encoding: UTF-8
88
- string: ''
89
- http_version:
90
- recorded_at: Mon, 11 Apr 2016 17:56:21 GMT
91
- - request:
92
- method: get
93
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
94
- body:
95
- encoding: US-ASCII
96
- string: ''
97
- headers:
98
- Accept-Encoding:
99
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
100
- Accept:
101
- - "*/*"
102
- User-Agent:
103
- - Ruby
104
- response:
105
- status:
106
- code: 200
107
- message: OK
108
- headers:
109
- Cache-Control:
110
- - no-cache
111
- Content-Type:
112
- - application/json
113
- Date:
114
- - Mon, 11 Apr 2016 17:56:22 GMT
115
- Dd-Pool:
116
- - dogweb_sameorig
117
- Pragma:
118
- - no-cache
119
- Set-Cookie:
120
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:22 GMT"; Max-Age=604800; Path=/
121
- Strict-Transport-Security:
122
- - max-age=15724800;
123
- X-Content-Type-Options:
124
- - nosniff
125
- X-Dd-Debug:
126
- - dzXYMfoU4q3VT0cFBUpsrrkUExtYDwvMMuX3a9VAyzA=
127
- X-Dd-Version:
128
- - '33.3404'
129
- X-Frame-Options:
130
- - SAMEORIGIN
131
- Content-Length:
132
- - '12'
133
- Connection:
134
- - keep-alive
135
- body:
136
- encoding: UTF-8
137
- string: '{"tags": []}'
138
- http_version:
139
- recorded_at: Mon, 11 Apr 2016 17:56:22 GMT
140
- - request:
141
- method: post
142
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
143
- body:
144
- encoding: UTF-8
145
- string: '{"tags":["test.tag.1","test.tag.2"]}'
146
- headers:
147
- Accept-Encoding:
148
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
149
- Accept:
150
- - "*/*"
151
- User-Agent:
152
- - Ruby
153
- Content-Type:
154
- - application/json
155
- response:
156
- status:
157
- code: 201
158
- message: Created
159
- headers:
160
- Cache-Control:
161
- - no-cache
162
- Content-Type:
163
- - application/json
164
- Date:
165
- - Mon, 11 Apr 2016 17:56:22 GMT
166
- Dd-Pool:
167
- - dogweb_sameorig
168
- Pragma:
169
- - no-cache
170
- Set-Cookie:
171
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:22 GMT"; Max-Age=604800; Path=/
172
- Strict-Transport-Security:
173
- - max-age=15724800;
174
- X-Content-Type-Options:
175
- - nosniff
176
- X-Dd-Debug:
177
- - MIdc/CQwmTXk1Lah/1lXbujR7+lOMI0VokxaEpQGrUw=
178
- X-Dd-Version:
179
- - '33.3404'
180
- X-Frame-Options:
181
- - SAMEORIGIN
182
- Content-Length:
183
- - '63'
184
- Connection:
185
- - keep-alive
186
- body:
187
- encoding: UTF-8
188
- string: '{"host": "test.tag.host", "tags": ["test.tag.2", "test.tag.1"]}'
189
- http_version:
190
- recorded_at: Mon, 11 Apr 2016 17:56:22 GMT
191
- - request:
192
- method: get
193
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
194
- body:
195
- encoding: US-ASCII
196
- string: ''
197
- headers:
198
- Accept-Encoding:
199
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
200
- Accept:
201
- - "*/*"
202
- User-Agent:
203
- - Ruby
204
- response:
205
- status:
206
- code: 200
207
- message: OK
208
- headers:
209
- Cache-Control:
210
- - no-cache
211
- Content-Type:
212
- - application/json
213
- Date:
214
- - Mon, 11 Apr 2016 17:56:22 GMT
215
- Dd-Pool:
216
- - dogweb_sameorig
217
- Pragma:
218
- - no-cache
219
- Set-Cookie:
220
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:22 GMT"; Max-Age=604800; Path=/
221
- Strict-Transport-Security:
222
- - max-age=15724800;
223
- Vary:
224
- - Accept-Encoding
225
- X-Content-Type-Options:
226
- - nosniff
227
- X-Dd-Debug:
228
- - eI0fWTxl6lKLmNakO6G9P/2RveEEWg/lRpRy9/lv8MQ=
229
- X-Dd-Version:
230
- - '33.3404'
231
- X-Frame-Options:
232
- - SAMEORIGIN
233
- Content-Length:
234
- - '48'
235
- Connection:
236
- - keep-alive
237
- body:
238
- encoding: UTF-8
239
- string: '{"tags": ["test.tag.2", "test.tag.1"]}'
240
- http_version:
241
- recorded_at: Mon, 11 Apr 2016 17:56:22 GMT
242
- - request:
243
- method: post
244
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
245
- body:
246
- encoding: UTF-8
247
- string: '{"tags":["test.tag.3"]}'
248
- headers:
249
- Accept-Encoding:
250
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
251
- Accept:
252
- - "*/*"
253
- User-Agent:
254
- - Ruby
255
- Content-Type:
256
- - application/json
257
- response:
258
- status:
259
- code: 201
260
- message: Created
261
- headers:
262
- Cache-Control:
263
- - no-cache
264
- Content-Type:
265
- - application/json
266
- Date:
267
- - Mon, 11 Apr 2016 17:56:23 GMT
268
- Dd-Pool:
269
- - dogweb_sameorig
270
- Pragma:
271
- - no-cache
272
- Set-Cookie:
273
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:22 GMT"; Max-Age=604800; Path=/
274
- Strict-Transport-Security:
275
- - max-age=15724800;
276
- X-Content-Type-Options:
277
- - nosniff
278
- X-Dd-Debug:
279
- - RlyQtDX9W/oMpkQZZjcoqOBiatUP2GiWyxgzdIMrWuU=
280
- X-Dd-Version:
281
- - '33.3404'
282
- X-Frame-Options:
283
- - SAMEORIGIN
284
- Content-Length:
285
- - '77'
286
- Connection:
287
- - keep-alive
288
- body:
289
- encoding: UTF-8
290
- string: '{"host": "test.tag.host", "tags": ["test.tag.2", "test.tag.3", "test.tag.1"]}'
291
- http_version:
292
- recorded_at: Mon, 11 Apr 2016 17:56:23 GMT
293
- - request:
294
- method: get
295
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
296
- body:
297
- encoding: US-ASCII
298
- string: ''
299
- headers:
300
- Accept-Encoding:
301
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
302
- Accept:
303
- - "*/*"
304
- User-Agent:
305
- - Ruby
306
- response:
307
- status:
308
- code: 200
309
- message: OK
310
- headers:
311
- Cache-Control:
312
- - no-cache
313
- Content-Type:
314
- - application/json
315
- Date:
316
- - Mon, 11 Apr 2016 17:56:23 GMT
317
- Dd-Pool:
318
- - dogweb_sameorig
319
- Pragma:
320
- - no-cache
321
- Set-Cookie:
322
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:23 GMT"; Max-Age=604800; Path=/
323
- Strict-Transport-Security:
324
- - max-age=15724800;
325
- Vary:
326
- - Accept-Encoding
327
- X-Content-Type-Options:
328
- - nosniff
329
- X-Dd-Debug:
330
- - B2DpeiArkz14rllWI622s7wjvWckEq5WuxOA4oijqwI=
331
- X-Dd-Version:
332
- - '33.3404'
333
- X-Frame-Options:
334
- - SAMEORIGIN
335
- Content-Length:
336
- - '51'
337
- Connection:
338
- - keep-alive
339
- body:
340
- encoding: UTF-8
341
- string: '{"tags": ["test.tag.2", "test.tag.3", "test.tag.1"]}'
342
- http_version:
343
- recorded_at: Mon, 11 Apr 2016 17:56:23 GMT
344
- - request:
345
- method: delete
346
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
347
- body:
348
- encoding: US-ASCII
349
- string: ''
350
- headers:
351
- Accept-Encoding:
352
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
353
- Accept:
354
- - "*/*"
355
- User-Agent:
356
- - Ruby
357
- response:
358
- status:
359
- code: 204
360
- message: No Content
361
- headers:
362
- Cache-Control:
363
- - no-cache
364
- Content-Length:
365
- - '4'
366
- Content-Type:
367
- - application/json
368
- Date:
369
- - Mon, 11 Apr 2016 17:56:24 GMT
370
- Dd-Pool:
371
- - dogweb_sameorig
372
- Pragma:
373
- - no-cache
374
- Set-Cookie:
375
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:23 GMT"; Max-Age=604800; Path=/
376
- Strict-Transport-Security:
377
- - max-age=15724800;
378
- X-Content-Type-Options:
379
- - nosniff
380
- X-Dd-Debug:
381
- - u7dUbT/JdTcUwf46Xq6Rp9y7LQHfqCh/ybJrMEoYyOs=
382
- X-Dd-Version:
383
- - '33.3404'
384
- X-Frame-Options:
385
- - SAMEORIGIN
386
- Connection:
387
- - keep-alive
388
- body:
389
- encoding: UTF-8
390
- string: ''
391
- http_version:
392
- recorded_at: Mon, 11 Apr 2016 17:56:24 GMT
393
- - request:
394
- method: get
395
- uri: https://app.datadoghq.com/api/v1/tags/hosts/test.tag.host?api_key=<DATADOG_API_KEY>&application_key=<DATADOG_APP_KEY>
396
- body:
397
- encoding: US-ASCII
398
- string: ''
399
- headers:
400
- Accept-Encoding:
401
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
402
- Accept:
403
- - "*/*"
404
- User-Agent:
405
- - Ruby
406
- response:
407
- status:
408
- code: 200
409
- message: OK
410
- headers:
411
- Cache-Control:
412
- - no-cache
413
- Content-Type:
414
- - application/json
415
- Date:
416
- - Mon, 11 Apr 2016 17:56:24 GMT
417
- Dd-Pool:
418
- - dogweb_sameorig
419
- Pragma:
420
- - no-cache
421
- Set-Cookie:
422
- - DD-PSHARD=0; expires="Mon, 18-Apr-2016 17:56:24 GMT"; Max-Age=604800; Path=/
423
- Strict-Transport-Security:
424
- - max-age=15724800;
425
- X-Content-Type-Options:
426
- - nosniff
427
- X-Dd-Debug:
428
- - VVb9PTrXTexlsgMglysHoi+NfsNQ6yOwNcwZLsurLAw=
429
- X-Dd-Version:
430
- - '33.3404'
431
- X-Frame-Options:
432
- - SAMEORIGIN
433
- Content-Length:
434
- - '12'
435
- Connection:
436
- - keep-alive
437
- body:
438
- encoding: UTF-8
439
- string: '{"tags": []}'
440
- http_version:
441
- recorded_at: Mon, 11 Apr 2016 17:56:24 GMT
442
- recorded_with: VCR 2.9.3