hawkular-client 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +2 -1
  4. data/.rubocop.yml +19 -6
  5. data/CHANGES.rdoc +13 -3
  6. data/README.rdoc +9 -3
  7. data/hawkularclient.gemspec +8 -4
  8. data/lib/alerts/alerts_api.rb +202 -32
  9. data/lib/hawkular.rb +35 -67
  10. data/lib/hawkular_all.rb +2 -0
  11. data/lib/inventory/inventory_api.rb +459 -130
  12. data/lib/metrics/metric_api.rb +14 -9
  13. data/lib/operations/operations_api.rb +247 -0
  14. data/lib/tokens/tokens_api.rb +33 -0
  15. data/lib/version.rb +1 -1
  16. data/spec/integration/alerts_spec.rb +272 -20
  17. data/spec/integration/hello-world-definitions.json +46 -0
  18. data/spec/integration/inventory_spec.rb +253 -89
  19. data/spec/integration/metric_spec.rb +36 -0
  20. data/spec/integration/operations_spec.rb +420 -0
  21. data/spec/integration/tokens_spec.rb +45 -0
  22. data/spec/resources/driver.jar +0 -0
  23. data/spec/resources/sample.war +0 -0
  24. data/spec/spec_helper.rb +30 -6
  25. data/spec/unit/base_spec.rb +22 -1
  26. data/spec/unit/canonical_path_spec.rb +92 -0
  27. data/spec/vcr/vcr_setup.rb +3 -4
  28. data/spec/vcr_cassettes/Alert/EndToEnd/Should_create_and_fire_a_trigger.yml +1187 -0
  29. data/spec/vcr_cassettes/Alert/Events/Should_list_events.yml +101 -0
  30. data/spec/vcr_cassettes/Alert/Events/Should_list_events_using_criteria.yml +79 -0
  31. data/spec/vcr_cassettes/Alert/Events/Should_not_list_events_using_criteria.yml +49 -0
  32. data/spec/vcr_cassettes/Alert/Triggers/Should_bulk_load_triggers.yml +225 -0
  33. data/spec/vcr_cassettes/Alert/Triggers/Should_create_a_basic_trigger_with_action.yml +355 -0
  34. data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action.yml +134 -0
  35. data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action_for_webhooks.yml +220 -0
  36. data/spec/vcr_cassettes/Alert/Triggers/Should_get_the_action_definitions.yml +218 -0
  37. data/spec/vcr_cassettes/Alert/Triggers/Should_not_create_an_action_for_unknown_plugin.yml +46 -0
  38. data/spec/vcr_cassettes/Alert/Triggers/Should_not_create_an_action_for_unknown_properties.yml +134 -0
  39. data/spec/vcr_cassettes/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +270 -0
  40. data/spec/vcr_cassettes/Inventory/Client_should_listen_on_various_inventory_events.json +47 -0
  41. data/spec/vcr_cassettes/Inventory/Client_should_listen_on_various_inventory_events.yml +191 -0
  42. data/spec/vcr_cassettes/Inventory/Helpers/generate_some_events_for_websocket.yml +507 -0
  43. data/spec/vcr_cassettes/Inventory/Should_List_datasources_with_no_props.yml +74 -69
  44. data/spec/vcr_cassettes/Inventory/{Should_list_types_without_feed.yml → Should_create_a_feed.yml} +29 -32
  45. data/spec/vcr_cassettes/Inventory/Should_create_a_feed_again.yml +211 -0
  46. data/spec/vcr_cassettes/Inventory/Should_create_a_resource_.yml +355 -0
  47. data/spec/vcr_cassettes/Inventory/Should_create_a_resource_with_metric.yml +786 -0
  48. data/spec/vcr_cassettes/Inventory/Should_create_a_resourcetype.yml +205 -0
  49. data/spec/vcr_cassettes/Inventory/Should_create_and_delete_feed.yml +201 -0
  50. data/spec/vcr_cassettes/Inventory/Should_create_and_get_a_resource.yml +419 -0
  51. data/spec/vcr_cassettes/Inventory/Should_list_URLs.yml +39 -27
  52. data/spec/vcr_cassettes/Inventory/Should_list_WildFlys.yml +37 -29
  53. data/spec/vcr_cassettes/Inventory/Should_list_WildFlys_with_props.yml +53 -45
  54. data/spec/vcr_cassettes/Inventory/Should_list_all_the_resource_types.yml +177 -0
  55. data/spec/vcr_cassettes/Inventory/Should_list_children_of_WildFly.yml +230 -56
  56. data/spec/vcr_cassettes/Inventory/Should_list_feeds.yml +27 -24
  57. data/spec/vcr_cassettes/Inventory/Should_list_heap_metrics_for_WildFlys.yml +586 -119
  58. data/spec/vcr_cassettes/Inventory/Should_list_metrics_for_WildFlys.yml +220 -59
  59. data/spec/vcr_cassettes/Inventory/Should_list_metrics_of_given_metric_type.yml +613 -0
  60. data/spec/vcr_cassettes/Inventory/Should_list_metrics_of_given_resource_type.yml +333 -0
  61. data/spec/vcr_cassettes/Inventory/Should_list_recursive_children_of_WildFly.yml +2064 -0
  62. data/spec/vcr_cassettes/Inventory/Should_list_relationships_of_WildFly.yml +460 -0
  63. data/spec/vcr_cassettes/Inventory/Should_list_types_with_bad_feed.yml +26 -25
  64. data/spec/vcr_cassettes/Inventory/Should_list_types_with_feed.yml +102 -36
  65. data/spec/vcr_cassettes/Inventory/Should_not_find_an_unknown_resource.yml +54 -0
  66. data/spec/vcr_cassettes/Inventory/Tenants/Should_Get_Tenant_For_Explicit_Credentials.yml +50 -0
  67. data/spec/vcr_cassettes/Inventory/Tenants/Should_Get_Tenant_For_Implicit_Credentials.yml +50 -0
  68. data/spec/vcr_cassettes/Operation/Helpers/get_tenant.yml +50 -0
  69. data/spec/vcr_cassettes/Operation/Operation/Add_JDBC_driver_should_add_the_driver.json +26 -0
  70. data/spec/vcr_cassettes/Operation/Operation/Add_datasource_should_be_doable.json +26 -0
  71. data/spec/vcr_cassettes/Operation/Operation/Add_deployment_should_be_doable.json +26 -0
  72. data/spec/vcr_cassettes/Operation/Operation/Redeploy_can_be_run_multiple_times_in_parallel.json +40 -0
  73. data/spec/vcr_cassettes/Operation/Operation/Redeploy_should_be_performed_and_eventually_respond_with_success.json +26 -0
  74. data/spec/vcr_cassettes/Operation/Operation/Redeploy_should_not_be_performed_if_resource_path_is_wrong.json +26 -0
  75. data/spec/vcr_cassettes/Operation/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +26 -0
  76. data/spec/vcr_cassettes/Operation/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +26 -0
  77. data/spec/vcr_cassettes/Operation/Operation/Remove_deployment_should_be_performed_and_eventually_respond_with_success.json +26 -0
  78. data/spec/vcr_cassettes/Operation/Operation/Undeploy_should_be_performed_and_eventually_respond_with_success.json +26 -0
  79. data/spec/vcr_cassettes/Operation/Operation/should_not_be_possible_to_perform_on_closed_client.json +12 -0
  80. data/spec/vcr_cassettes/Operation/Websocket_connection/should_be_established.json +9 -0
  81. data/spec/vcr_cassettes/Tokens/Should_be_able_to_create_a_new_token_for_an_actual_user.yml +57 -0
  82. data/spec/vcr_cassettes/Tokens/Should_be_able_to_list_the_available_tokens.yml +49 -0
  83. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_with_a_wrong_password.yml +56 -0
  84. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_without_a_password.yml +55 -0
  85. metadata +175 -11
  86. data/lib/metrics/version.rb +0 -7
@@ -0,0 +1,220 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/webhook
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Expires:
24
+ - '0'
25
+ Cache-Control:
26
+ - no-cache, no-store, must-revalidate
27
+ X-Powered-By:
28
+ - Undertow/1
29
+ Server:
30
+ - WildFly/10
31
+ Pragma:
32
+ - no-cache
33
+ Date:
34
+ - Mon, 14 Mar 2016 10:53:41 GMT
35
+ Connection:
36
+ - keep-alive
37
+ Content-Type:
38
+ - application/json
39
+ Content-Length:
40
+ - '16'
41
+ body:
42
+ encoding: ASCII-8BIT
43
+ string: '["method","url"]'
44
+ http_version:
45
+ recorded_at: Mon, 14 Mar 2016 10:53:41 GMT
46
+ - request:
47
+ method: get
48
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/webhook
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ Accept:
54
+ - application/json
55
+ Accept-Encoding:
56
+ - gzip, deflate
57
+ Content-Type:
58
+ - application/json
59
+ User-Agent:
60
+ - Ruby
61
+ response:
62
+ status:
63
+ code: 200
64
+ message: OK
65
+ headers:
66
+ Expires:
67
+ - '0'
68
+ Cache-Control:
69
+ - no-cache, no-store, must-revalidate
70
+ X-Powered-By:
71
+ - Undertow/1
72
+ Server:
73
+ - WildFly/10
74
+ Pragma:
75
+ - no-cache
76
+ Date:
77
+ - Mon, 14 Mar 2016 10:53:42 GMT
78
+ Connection:
79
+ - keep-alive
80
+ Content-Type:
81
+ - application/json
82
+ Content-Length:
83
+ - '16'
84
+ body:
85
+ encoding: ASCII-8BIT
86
+ string: '["method","url"]'
87
+ http_version:
88
+ recorded_at: Mon, 14 Mar 2016 10:53:42 GMT
89
+ - request:
90
+ method: post
91
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/actions
92
+ body:
93
+ encoding: UTF-8
94
+ string: '{"actionId":"my-id1","actionPlugin":"webhook","properties":{"url":"http://localhost:8080/bla","method":"POST"}}'
95
+ headers:
96
+ Accept:
97
+ - application/json
98
+ Accept-Encoding:
99
+ - gzip, deflate
100
+ Content-Type:
101
+ - application/json
102
+ Content-Length:
103
+ - '111'
104
+ User-Agent:
105
+ - Ruby
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: OK
110
+ headers:
111
+ Expires:
112
+ - '0'
113
+ Cache-Control:
114
+ - no-cache, no-store, must-revalidate
115
+ X-Powered-By:
116
+ - Undertow/1
117
+ Server:
118
+ - WildFly/10
119
+ Pragma:
120
+ - no-cache
121
+ Date:
122
+ - Mon, 14 Mar 2016 10:53:42 GMT
123
+ Connection:
124
+ - keep-alive
125
+ Content-Type:
126
+ - application/json
127
+ Content-Length:
128
+ - '161'
129
+ body:
130
+ encoding: ASCII-8BIT
131
+ string: '{"tenantId":"28026b36-8fe4-4332-84c8-524e173a68bf","actionPlugin":"webhook","actionId":"my-id1","properties":{"url":"http://localhost:8080/bla","method":"POST"}}'
132
+ http_version:
133
+ recorded_at: Mon, 14 Mar 2016 10:53:42 GMT
134
+ - request:
135
+ method: get
136
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/actions/webhook/my-id1
137
+ body:
138
+ encoding: US-ASCII
139
+ string: ''
140
+ headers:
141
+ Accept:
142
+ - application/json
143
+ Accept-Encoding:
144
+ - gzip, deflate
145
+ Content-Type:
146
+ - application/json
147
+ User-Agent:
148
+ - Ruby
149
+ response:
150
+ status:
151
+ code: 200
152
+ message: OK
153
+ headers:
154
+ Expires:
155
+ - '0'
156
+ Cache-Control:
157
+ - no-cache, no-store, must-revalidate
158
+ X-Powered-By:
159
+ - Undertow/1
160
+ Server:
161
+ - WildFly/10
162
+ Pragma:
163
+ - no-cache
164
+ Date:
165
+ - Mon, 14 Mar 2016 10:53:42 GMT
166
+ Connection:
167
+ - keep-alive
168
+ Content-Type:
169
+ - application/json
170
+ Content-Length:
171
+ - '161'
172
+ body:
173
+ encoding: ASCII-8BIT
174
+ string: '{"tenantId":"28026b36-8fe4-4332-84c8-524e173a68bf","actionPlugin":"webhook","actionId":"my-id1","properties":{"url":"http://localhost:8080/bla","method":"POST"}}'
175
+ http_version:
176
+ recorded_at: Mon, 14 Mar 2016 10:53:42 GMT
177
+ - request:
178
+ method: delete
179
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/actions/webhook/my-id1
180
+ body:
181
+ encoding: US-ASCII
182
+ string: ''
183
+ headers:
184
+ Accept:
185
+ - application/json
186
+ Accept-Encoding:
187
+ - gzip, deflate
188
+ Content-Type:
189
+ - application/json
190
+ User-Agent:
191
+ - Ruby
192
+ response:
193
+ status:
194
+ code: 200
195
+ message: OK
196
+ headers:
197
+ Expires:
198
+ - '0'
199
+ Cache-Control:
200
+ - no-cache, no-store, must-revalidate
201
+ X-Powered-By:
202
+ - Undertow/1
203
+ Server:
204
+ - WildFly/10
205
+ Pragma:
206
+ - no-cache
207
+ Date:
208
+ - Mon, 14 Mar 2016 10:53:42 GMT
209
+ Connection:
210
+ - keep-alive
211
+ Content-Type:
212
+ - application/json
213
+ Content-Length:
214
+ - '0'
215
+ body:
216
+ encoding: UTF-8
217
+ string: ''
218
+ http_version:
219
+ recorded_at: Mon, 14 Mar 2016 10:53:42 GMT
220
+ recorded_with: VCR 3.0.0
@@ -0,0 +1,218 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Expires:
24
+ - '0'
25
+ Cache-Control:
26
+ - no-cache, no-store, must-revalidate
27
+ X-Powered-By:
28
+ - Undertow/1
29
+ Server:
30
+ - WildFly/10
31
+ Pragma:
32
+ - no-cache
33
+ Date:
34
+ - Mon, 14 Mar 2016 10:36:20 GMT
35
+ Connection:
36
+ - keep-alive
37
+ Content-Type:
38
+ - application/json
39
+ Content-Length:
40
+ - '19'
41
+ body:
42
+ encoding: ASCII-8BIT
43
+ string: '["email","webhook"]'
44
+ http_version:
45
+ recorded_at: Mon, 14 Mar 2016 10:36:20 GMT
46
+ - request:
47
+ method: get
48
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/email
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ''
52
+ headers:
53
+ Accept:
54
+ - application/json
55
+ Accept-Encoding:
56
+ - gzip, deflate
57
+ Content-Type:
58
+ - application/json
59
+ User-Agent:
60
+ - Ruby
61
+ response:
62
+ status:
63
+ code: 200
64
+ message: OK
65
+ headers:
66
+ Expires:
67
+ - '0'
68
+ Cache-Control:
69
+ - no-cache, no-store, must-revalidate
70
+ X-Powered-By:
71
+ - Undertow/1
72
+ Server:
73
+ - WildFly/10
74
+ Pragma:
75
+ - no-cache
76
+ Date:
77
+ - Mon, 14 Mar 2016 10:36:20 GMT
78
+ Connection:
79
+ - keep-alive
80
+ Content-Type:
81
+ - application/json
82
+ Content-Length:
83
+ - '87'
84
+ body:
85
+ encoding: ASCII-8BIT
86
+ string: '["cc","from","from-name","template.hawkular.url","template.html","template.plain","to"]'
87
+ http_version:
88
+ recorded_at: Mon, 14 Mar 2016 10:36:20 GMT
89
+ - request:
90
+ method: get
91
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/webhook
92
+ body:
93
+ encoding: US-ASCII
94
+ string: ''
95
+ headers:
96
+ Accept:
97
+ - application/json
98
+ Accept-Encoding:
99
+ - gzip, deflate
100
+ Content-Type:
101
+ - application/json
102
+ User-Agent:
103
+ - Ruby
104
+ response:
105
+ status:
106
+ code: 200
107
+ message: OK
108
+ headers:
109
+ Expires:
110
+ - '0'
111
+ Cache-Control:
112
+ - no-cache, no-store, must-revalidate
113
+ X-Powered-By:
114
+ - Undertow/1
115
+ Server:
116
+ - WildFly/10
117
+ Pragma:
118
+ - no-cache
119
+ Date:
120
+ - Mon, 14 Mar 2016 10:36:20 GMT
121
+ Connection:
122
+ - keep-alive
123
+ Content-Type:
124
+ - application/json
125
+ Content-Length:
126
+ - '16'
127
+ body:
128
+ encoding: ASCII-8BIT
129
+ string: '["method","url"]'
130
+ http_version:
131
+ recorded_at: Mon, 14 Mar 2016 10:36:20 GMT
132
+ - request:
133
+ method: get
134
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/email
135
+ body:
136
+ encoding: US-ASCII
137
+ string: ''
138
+ headers:
139
+ Accept:
140
+ - application/json
141
+ Accept-Encoding:
142
+ - gzip, deflate
143
+ Content-Type:
144
+ - application/json
145
+ User-Agent:
146
+ - Ruby
147
+ response:
148
+ status:
149
+ code: 200
150
+ message: OK
151
+ headers:
152
+ Expires:
153
+ - '0'
154
+ Cache-Control:
155
+ - no-cache, no-store, must-revalidate
156
+ X-Powered-By:
157
+ - Undertow/1
158
+ Server:
159
+ - WildFly/10
160
+ Pragma:
161
+ - no-cache
162
+ Date:
163
+ - Mon, 14 Mar 2016 10:36:21 GMT
164
+ Connection:
165
+ - keep-alive
166
+ Content-Type:
167
+ - application/json
168
+ Content-Length:
169
+ - '87'
170
+ body:
171
+ encoding: ASCII-8BIT
172
+ string: '["cc","from","from-name","template.hawkular.url","template.html","template.plain","to"]'
173
+ http_version:
174
+ recorded_at: Mon, 14 Mar 2016 10:36:21 GMT
175
+ - request:
176
+ method: get
177
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/-does-not-exist-
178
+ body:
179
+ encoding: US-ASCII
180
+ string: ''
181
+ headers:
182
+ Accept:
183
+ - application/json
184
+ Accept-Encoding:
185
+ - gzip, deflate
186
+ Content-Type:
187
+ - application/json
188
+ User-Agent:
189
+ - Ruby
190
+ response:
191
+ status:
192
+ code: 404
193
+ message: Not Found
194
+ headers:
195
+ Expires:
196
+ - '0'
197
+ Cache-Control:
198
+ - no-cache, no-store, must-revalidate
199
+ X-Powered-By:
200
+ - Undertow/1
201
+ Server:
202
+ - WildFly/10
203
+ Pragma:
204
+ - no-cache
205
+ Date:
206
+ - Mon, 14 Mar 2016 10:36:21 GMT
207
+ Connection:
208
+ - keep-alive
209
+ Content-Type:
210
+ - application/json
211
+ Content-Length:
212
+ - '55'
213
+ body:
214
+ encoding: ASCII-8BIT
215
+ string: '{"errorMsg":"actionPlugin: -does-not-exist- not found"}'
216
+ http_version:
217
+ recorded_at: Mon, 14 Mar 2016 10:36:21 GMT
218
+ recorded_with: VCR 3.0.0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/-does-not-exist
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 404
21
+ message: Not Found
22
+ headers:
23
+ Expires:
24
+ - '0'
25
+ Cache-Control:
26
+ - no-cache, no-store, must-revalidate
27
+ X-Powered-By:
28
+ - Undertow/1
29
+ Server:
30
+ - WildFly/10
31
+ Pragma:
32
+ - no-cache
33
+ Date:
34
+ - Mon, 14 Mar 2016 10:53:41 GMT
35
+ Connection:
36
+ - keep-alive
37
+ Content-Type:
38
+ - application/json
39
+ Content-Length:
40
+ - '54'
41
+ body:
42
+ encoding: ASCII-8BIT
43
+ string: '{"errorMsg":"actionPlugin: -does-not-exist not found"}'
44
+ http_version:
45
+ recorded_at: Mon, 14 Mar 2016 10:53:41 GMT
46
+ recorded_with: VCR 3.0.0