wavefront-cli 4.2.1 → 4.3.0
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/.codeclimate.yml +1 -0
- data/.rubocop.yml +1 -14
- data/.travis.yml +4 -4
- data/Gemfile +2 -0
- data/HISTORY.md +82 -60
- data/Rakefile +2 -0
- data/bin/wf +1 -0
- data/lib/wavefront-cli/alert.rb +13 -5
- data/lib/wavefront-cli/apitoken.rb +2 -0
- data/lib/wavefront-cli/base.rb +95 -47
- data/lib/wavefront-cli/cloudintegration.rb +6 -0
- data/lib/wavefront-cli/command_mixins/acl.rb +6 -1
- data/lib/wavefront-cli/command_mixins/tag.rb +2 -0
- data/lib/wavefront-cli/commands/.rubocop.yml +3 -4
- data/lib/wavefront-cli/commands/alert.rb +2 -1
- data/lib/wavefront-cli/commands/apitoken.rb +6 -0
- data/lib/wavefront-cli/commands/base.rb +30 -21
- data/lib/wavefront-cli/commands/cloudintegration.rb +2 -0
- data/lib/wavefront-cli/commands/config.rb +2 -0
- data/lib/wavefront-cli/commands/dashboard.rb +2 -0
- data/lib/wavefront-cli/commands/derivedmetric.rb +2 -0
- data/lib/wavefront-cli/commands/event.rb +3 -1
- data/lib/wavefront-cli/commands/integration.rb +2 -1
- data/lib/wavefront-cli/commands/link.rb +2 -0
- data/lib/wavefront-cli/commands/message.rb +2 -0
- data/lib/wavefront-cli/commands/metric.rb +2 -0
- data/lib/wavefront-cli/commands/notificant.rb +2 -0
- data/lib/wavefront-cli/commands/proxy.rb +2 -0
- data/lib/wavefront-cli/commands/query.rb +2 -0
- data/lib/wavefront-cli/commands/savedsearch.rb +2 -0
- data/lib/wavefront-cli/commands/serviceaccount.rb +58 -0
- data/lib/wavefront-cli/commands/settings.rb +2 -0
- data/lib/wavefront-cli/commands/source.rb +3 -1
- data/lib/wavefront-cli/commands/user.rb +4 -1
- data/lib/wavefront-cli/commands/usergroup.rb +3 -0
- data/lib/wavefront-cli/commands/webhook.rb +2 -0
- data/lib/wavefront-cli/commands/window.rb +2 -0
- data/lib/wavefront-cli/commands/write.rb +2 -0
- data/lib/wavefront-cli/config.rb +23 -12
- data/lib/wavefront-cli/constants.rb +10 -4
- data/lib/wavefront-cli/controller.rb +53 -22
- data/lib/wavefront-cli/dashboard.rb +3 -0
- data/lib/wavefront-cli/derivedmetric.rb +12 -11
- data/lib/wavefront-cli/display/alert.rb +7 -4
- data/lib/wavefront-cli/display/apitoken.rb +2 -0
- data/lib/wavefront-cli/display/base.rb +34 -8
- data/lib/wavefront-cli/display/cloudintegration.rb +4 -2
- data/lib/wavefront-cli/display/dashboard.rb +2 -0
- data/lib/wavefront-cli/display/derivedmetric.rb +2 -0
- data/lib/wavefront-cli/display/distribution.rb +2 -0
- data/lib/wavefront-cli/display/event.rb +2 -0
- data/lib/wavefront-cli/display/externallink.rb +2 -0
- data/lib/wavefront-cli/display/integration.rb +2 -0
- data/lib/wavefront-cli/display/maintenancewindow.rb +2 -0
- data/lib/wavefront-cli/display/message.rb +7 -3
- data/lib/wavefront-cli/display/metric.rb +3 -1
- data/lib/wavefront-cli/display/notificant.rb +3 -1
- data/lib/wavefront-cli/display/printer/long.rb +36 -11
- data/lib/wavefront-cli/display/printer/sparkline.rb +3 -0
- data/lib/wavefront-cli/display/printer/terse.rb +6 -1
- data/lib/wavefront-cli/display/proxy.rb +2 -0
- data/lib/wavefront-cli/display/query.rb +35 -24
- data/lib/wavefront-cli/display/savedsearch.rb +2 -0
- data/lib/wavefront-cli/display/serviceaccount.rb +60 -0
- data/lib/wavefront-cli/display/settings.rb +2 -0
- data/lib/wavefront-cli/display/source.rb +18 -4
- data/lib/wavefront-cli/display/user.rb +56 -10
- data/lib/wavefront-cli/display/usergroup.rb +25 -19
- data/lib/wavefront-cli/display/webhook.rb +2 -0
- data/lib/wavefront-cli/display/write.rb +6 -2
- data/lib/wavefront-cli/event.rb +83 -62
- data/lib/wavefront-cli/exception.rb +3 -0
- data/lib/wavefront-cli/externallink.rb +6 -4
- data/lib/wavefront-cli/integration.rb +2 -0
- data/lib/wavefront-cli/maintenancewindow.rb +28 -17
- data/lib/wavefront-cli/message.rb +4 -0
- data/lib/wavefront-cli/metric.rb +4 -1
- data/lib/wavefront-cli/notificant.rb +2 -0
- data/lib/wavefront-cli/opt_handler.rb +2 -0
- data/lib/wavefront-cli/output/base.rb +8 -3
- data/lib/wavefront-cli/output/csv.rb +2 -0
- data/lib/wavefront-cli/output/csv/base.rb +2 -0
- data/lib/wavefront-cli/output/csv/query.rb +14 -7
- data/lib/wavefront-cli/output/hcl.rb +2 -0
- data/lib/wavefront-cli/output/hcl/alert.rb +2 -0
- data/lib/wavefront-cli/output/hcl/base.rb +10 -4
- data/lib/wavefront-cli/output/hcl/dashboard.rb +17 -8
- data/lib/wavefront-cli/output/hcl/notificant.rb +2 -0
- data/lib/wavefront-cli/output/hcl/stdlib/array.rb +2 -0
- data/lib/wavefront-cli/output/hcl/stdlib/string.rb +2 -0
- data/lib/wavefront-cli/output/json.rb +2 -0
- data/lib/wavefront-cli/output/ruby.rb +2 -0
- data/lib/wavefront-cli/output/wavefront.rb +2 -0
- data/lib/wavefront-cli/output/wavefront/query.rb +7 -4
- data/lib/wavefront-cli/output/yaml.rb +2 -0
- data/lib/wavefront-cli/proxy.rb +15 -3
- data/lib/wavefront-cli/query.rb +14 -12
- data/lib/wavefront-cli/savedsearch.rb +2 -0
- data/lib/wavefront-cli/serviceaccount.rb +179 -0
- data/lib/wavefront-cli/settings.rb +2 -0
- data/lib/wavefront-cli/source.rb +2 -0
- data/lib/wavefront-cli/stdlib/array.rb +3 -0
- data/lib/wavefront-cli/stdlib/string.rb +17 -11
- data/lib/wavefront-cli/user.rb +10 -4
- data/lib/wavefront-cli/usergroup.rb +4 -2
- data/lib/wavefront-cli/version.rb +3 -1
- data/lib/wavefront-cli/webhook.rb +2 -0
- data/lib/wavefront-cli/write.rb +80 -46
- data/spec/.rubocop.yml +3 -16
- data/spec/constants.rb +21 -0
- data/spec/spec_helper.rb +8 -422
- data/spec/support/command_base.rb +82 -0
- data/spec/support/minitest_assertions.rb +262 -0
- data/spec/support/output_tester.rb +32 -0
- data/spec/support/supported_commands.rb +19 -0
- data/spec/test_mixins/acl.rb +169 -0
- data/spec/test_mixins/delete.rb +25 -0
- data/spec/test_mixins/deleteundelete.rb +106 -0
- data/spec/test_mixins/describe.rb +24 -0
- data/spec/test_mixins/dump.rb +43 -0
- data/spec/test_mixins/general.rb +11 -0
- data/spec/test_mixins/history.rb +35 -0
- data/spec/test_mixins/import.rb +65 -0
- data/spec/test_mixins/list.rb +29 -0
- data/spec/test_mixins/search.rb +98 -0
- data/spec/test_mixins/set.rb +47 -0
- data/spec/test_mixins/tag.rb +99 -0
- data/spec/wavefront-cli/alert_spec.rb +288 -111
- data/spec/wavefront-cli/apitoken_spec.rb +53 -24
- data/spec/wavefront-cli/base_spec.rb +9 -27
- data/spec/wavefront-cli/cloudintegration_spec.rb +65 -29
- data/spec/wavefront-cli/commands/alert_spec.rb +1 -0
- data/spec/wavefront-cli/commands/base_spec.rb +15 -13
- data/spec/wavefront-cli/commands/cloudintegration_spec.rb +1 -0
- data/spec/wavefront-cli/commands/config_spec.rb +3 -0
- data/spec/wavefront-cli/commands/dashboard_spec.rb +1 -0
- data/spec/wavefront-cli/commands/derivedmetric_spec.rb +1 -0
- data/spec/wavefront-cli/commands/event_spec.rb +1 -0
- data/spec/wavefront-cli/commands/link_spec.rb +1 -0
- data/spec/wavefront-cli/commands/message_spec.rb +1 -0
- data/spec/wavefront-cli/commands/metric_spec.rb +1 -0
- data/spec/wavefront-cli/commands/proxy_spec.rb +1 -0
- data/spec/wavefront-cli/commands/query_spec.rb +1 -0
- data/spec/wavefront-cli/commands/webhook_spec.rb +1 -0
- data/spec/wavefront-cli/commands/window_spec.rb +1 -0
- data/spec/wavefront-cli/commands/write_spec.rb +1 -0
- data/spec/wavefront-cli/config_spec.rb +25 -14
- data/spec/wavefront-cli/controller_spec.rb +13 -3
- data/spec/wavefront-cli/dashboard_spec.rb +125 -76
- data/spec/wavefront-cli/derivedmetric_spec.rb +83 -67
- data/spec/wavefront-cli/display/base_spec.rb +5 -7
- data/spec/wavefront-cli/display/printer/long_spec.rb +20 -16
- data/spec/wavefront-cli/display/printer/terse_spec.rb +5 -4
- data/spec/wavefront-cli/event_spec.rb +360 -18
- data/spec/wavefront-cli/externallink_spec.rb +92 -58
- data/spec/wavefront-cli/integration_spec.rb +129 -31
- data/spec/wavefront-cli/maintenancewindow_spec.rb +270 -32
- data/spec/wavefront-cli/message_spec.rb +73 -30
- data/spec/wavefront-cli/metric_spec.rb +60 -22
- data/spec/wavefront-cli/notificant_spec.rb +45 -32
- data/spec/wavefront-cli/opt_handler_spec.rb +4 -1
- data/spec/wavefront-cli/output/csv/query_spec.rb +21 -19
- data/spec/wavefront-cli/output/csv_spec.rb +5 -2
- data/spec/wavefront-cli/output/hcl_spec.rb +5 -2
- data/spec/wavefront-cli/output/helpers.rb +18 -0
- data/spec/wavefront-cli/output/json_spec.rb +3 -1
- data/spec/wavefront-cli/output/ruby_spec.rb +3 -1
- data/spec/wavefront-cli/output/wavefront/query_spec.rb +3 -1
- data/spec/wavefront-cli/output/wavefront_spec.rb +6 -4
- data/spec/wavefront-cli/output/yaml_spec.rb +3 -1
- data/spec/wavefront-cli/proxy_spec.rb +49 -27
- data/spec/wavefront-cli/query_spec.rb +174 -92
- data/spec/wavefront-cli/resources/responses/query.json +1 -0
- data/spec/wavefront-cli/resources/updates/alert.json +15 -0
- data/spec/wavefront-cli/resources/updates/dashboard.json +1 -0
- data/spec/wavefront-cli/savedsearch_spec.rb +35 -18
- data/spec/wavefront-cli/serviceaccount_spec.rb +399 -0
- data/spec/wavefront-cli/settings_spec.rb +42 -11
- data/spec/wavefront-cli/source_spec.rb +120 -23
- data/spec/wavefront-cli/stdlib/array_spec.rb +2 -1
- data/spec/wavefront-cli/stdlib/string_spec.rb +9 -6
- data/spec/wavefront-cli/user_spec.rb +278 -108
- data/spec/wavefront-cli/usergroup_spec.rb +152 -102
- data/spec/wavefront-cli/webhook_spec.rb +30 -15
- data/spec/wavefront-cli/write_spec.rb +25 -1
- data/wavefront-cli.gemspec +5 -3
- metadata +65 -21
- data/spec/wavefront-cli/commands/spec_helper.rb +0 -3
- data/spec/wavefront-cli/display/spec_helper.rb +0 -3
|
@@ -1,104 +1,154 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative '../support/command_base'
|
|
5
|
+
require_relative '../../lib/wavefront-cli/usergroup'
|
|
6
|
+
|
|
7
|
+
# Ensure 'usergroup' commands produce the correct API calls.
|
|
8
|
+
#
|
|
9
|
+
class UserGroupEndToEndTest < EndToEndTest
|
|
10
|
+
include WavefrontCliTest::List
|
|
11
|
+
include WavefrontCliTest::Describe
|
|
12
|
+
include WavefrontCliTest::Dump
|
|
13
|
+
include WavefrontCliTest::Set
|
|
14
|
+
include WavefrontCliTest::Delete
|
|
15
|
+
include WavefrontCliTest::Search
|
|
16
|
+
|
|
17
|
+
def test_create
|
|
18
|
+
quietly do
|
|
19
|
+
assert_cmd_posts("create #{groupname}",
|
|
20
|
+
'/api/v2/usergroup',
|
|
21
|
+
name: groupname, permissions: [])
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
assert_abort_on_missing_creds("create #{groupname}")
|
|
25
|
+
assert_usage('create')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_create_with_privileges
|
|
29
|
+
quietly do
|
|
30
|
+
assert_cmd_posts("create -p #{privileges[0]} -p #{privileges[1]} " \
|
|
31
|
+
"#{groupname}",
|
|
32
|
+
'/api/v2/usergroup',
|
|
33
|
+
name: groupname, permissions: privileges)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_users
|
|
38
|
+
assert_repeated_output("No users in group '#{id}'.") do
|
|
39
|
+
assert_cmd_gets("users #{id}", "/api/v2/usergroup/#{id}")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
assert_abort_on_missing_creds("users #{id}")
|
|
43
|
+
assert_invalid_id("users #{invalid_id}")
|
|
44
|
+
assert_usage('users')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def test_permissions
|
|
48
|
+
assert_repeated_output("Group '#{id}' has no permissions.") do
|
|
49
|
+
assert_cmd_gets("permissions #{id}", "/api/v2/usergroup/#{id}")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
assert_abort_on_missing_creds("permissions #{id}")
|
|
53
|
+
assert_invalid_id("permissions #{invalid_id}")
|
|
54
|
+
assert_usage('permissions')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def test_add_user
|
|
58
|
+
assert_repeated_output("Added '#{users[0]}' to '#{id}'.") do
|
|
59
|
+
assert_cmd_posts("add user #{id} #{users[0]}",
|
|
60
|
+
"/api/v2/usergroup/#{id}/addUsers",
|
|
61
|
+
[users[0]].to_json)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
assert_abort_on_missing_creds("add user #{id} #{users[0]}")
|
|
65
|
+
assert_invalid_id("add user #{invalid_id} #{users[0]}")
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# assert_repeated_output can't cope with line wrapping, and suppressing it
|
|
69
|
+
# breaks other tests. Hence the `quietly` in the next three tests.
|
|
70
|
+
#
|
|
71
|
+
def test_add_multiple_users
|
|
72
|
+
quietly do
|
|
73
|
+
assert_cmd_posts("add user #{id} #{users[0]} #{users[1]}",
|
|
74
|
+
"/api/v2/usergroup/#{id}/addUsers",
|
|
75
|
+
users.to_json)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_remove_user
|
|
80
|
+
quietly do
|
|
81
|
+
assert_cmd_posts("remove user #{id} #{users[0]}",
|
|
82
|
+
"/api/v2/usergroup/#{id}/removeUsers",
|
|
83
|
+
[users[0]].to_json)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
assert_abort_on_missing_creds("remove user #{id} #{users[0]}")
|
|
87
|
+
assert_invalid_id("remove user #{invalid_id} #{users[0]}")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def test_remove_multiple_users
|
|
91
|
+
quietly do
|
|
92
|
+
assert_cmd_posts("remove user #{id} #{users[0]} #{users[1]}",
|
|
93
|
+
"/api/v2/usergroup/#{id}/removeUsers",
|
|
94
|
+
users.to_json)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_grant
|
|
99
|
+
assert_repeated_output(
|
|
100
|
+
"Granted '#{privileges[1]}' permission to '#{id}'."
|
|
101
|
+
) do
|
|
102
|
+
assert_cmd_posts("grant #{privileges[1]} to #{id}",
|
|
103
|
+
"/api/v2/usergroup/grant/#{privileges[1]}",
|
|
104
|
+
[id].to_json)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
assert_abort_on_missing_creds("grant #{privileges[1]} to #{id}")
|
|
108
|
+
assert_invalid_id("grant #{privileges[1]} to #{invalid_id}")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def test_revoke
|
|
112
|
+
assert_repeated_output(
|
|
113
|
+
"Revoked '#{privileges[0]}' permission from '#{id}'."
|
|
114
|
+
) do
|
|
115
|
+
assert_cmd_posts("revoke #{privileges[0]} from #{id}",
|
|
116
|
+
"/api/v2/usergroup/revoke/#{privileges[0]}",
|
|
117
|
+
[id].to_json)
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
private
|
|
122
|
+
|
|
123
|
+
def id
|
|
124
|
+
'2659191e-aad4-4302-a94e-9667e1517127'
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def invalid_id
|
|
128
|
+
'__BAD__'
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def cmd_word
|
|
132
|
+
'usergroup'
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def sdk_class_name
|
|
136
|
+
'UserGroup'
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def friendly_name
|
|
140
|
+
'user group'
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def groupname
|
|
144
|
+
'testgroup'
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def privileges
|
|
148
|
+
%w[alerts_management events_management]
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def users
|
|
152
|
+
%w[someone@somewhere.com other@elsewhere.com]
|
|
153
|
+
end
|
|
104
154
|
end
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
word = 'webhook'
|
|
4
|
+
require_relative '../support/command_base'
|
|
5
|
+
require_relative '../../lib/wavefront-cli/webhook'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
# Ensure 'webhook' commands produce the correct API calls.
|
|
8
|
+
#
|
|
9
|
+
class WebhookEndToEndTest < EndToEndTest
|
|
10
|
+
include WavefrontCliTest::Delete
|
|
11
|
+
include WavefrontCliTest::Describe
|
|
12
|
+
include WavefrontCliTest::Dump
|
|
13
|
+
# include WavefrontCliTest::Import
|
|
14
|
+
include WavefrontCliTest::List
|
|
15
|
+
include WavefrontCliTest::Search
|
|
16
|
+
include WavefrontCliTest::Set
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def id
|
|
21
|
+
'9095WaGklE8Gy3M1'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def invalid_id
|
|
25
|
+
'__BAD__'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def cmd_word
|
|
29
|
+
'webhook'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def set_key
|
|
33
|
+
'title'
|
|
34
|
+
end
|
|
20
35
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
require 'minitest/autorun'
|
|
4
5
|
require_relative '../../lib/wavefront-cli/write'
|
|
5
6
|
|
|
6
7
|
# Test base writer
|
|
@@ -101,30 +102,53 @@ class WavefrontCliWriteTest < MiniTest::Test
|
|
|
101
102
|
%w[v mv vm tmv mtv mvT msvT tmvT].each do |str|
|
|
102
103
|
assert wf.valid_format?(str)
|
|
103
104
|
end
|
|
105
|
+
end
|
|
104
106
|
|
|
107
|
+
def test_invalid_format_v_and_d
|
|
105
108
|
e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
|
|
106
109
|
wf.valid_format?('mvd')
|
|
107
110
|
end
|
|
111
|
+
|
|
108
112
|
assert_equal("'v' and 'd' are mutually exclusive", e.message)
|
|
113
|
+
end
|
|
109
114
|
|
|
115
|
+
def test_invalid_format_no_v_or_d
|
|
110
116
|
e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
|
|
111
117
|
wf.valid_format?('mtT')
|
|
112
118
|
end
|
|
119
|
+
|
|
113
120
|
assert_equal("format string must include 'v' or 'd'", e.message)
|
|
121
|
+
end
|
|
114
122
|
|
|
123
|
+
def test_invalid_format_invalid_char
|
|
115
124
|
e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
|
|
116
125
|
wf.valid_format?('mxvT')
|
|
117
126
|
end
|
|
127
|
+
|
|
118
128
|
assert_equal('unsupported field in format string', e.message)
|
|
129
|
+
end
|
|
119
130
|
|
|
131
|
+
def test_invalid_format_repeated_char
|
|
120
132
|
e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
|
|
121
133
|
wf.valid_format?('mvvT')
|
|
122
134
|
end
|
|
135
|
+
|
|
136
|
+
assert_equal('repeated field in format string', e.message)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def test_invalid_format_duplicated_char
|
|
140
|
+
e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
|
|
141
|
+
wf.valid_format?('vmvTv')
|
|
142
|
+
end
|
|
143
|
+
|
|
123
144
|
assert_equal('repeated field in format string', e.message)
|
|
145
|
+
end
|
|
124
146
|
|
|
147
|
+
def test_invalid_format_big_t_in_middle
|
|
125
148
|
e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
|
|
126
149
|
wf.valid_format?('mTv')
|
|
127
150
|
end
|
|
151
|
+
|
|
128
152
|
assert_equal("if used, 'T' must come at end of format string",
|
|
129
153
|
e.message)
|
|
130
154
|
end
|
data/wavefront-cli.gemspec
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'pathname'
|
|
2
4
|
require 'date'
|
|
3
5
|
|
|
@@ -24,13 +26,13 @@ Gem::Specification.new do |gem|
|
|
|
24
26
|
|
|
25
27
|
gem.add_runtime_dependency 'docopt', '~> 0.6.0'
|
|
26
28
|
gem.add_runtime_dependency 'inifile', '~> 3.0'
|
|
27
|
-
gem.add_runtime_dependency 'wavefront-sdk', '~> 3.
|
|
29
|
+
gem.add_runtime_dependency 'wavefront-sdk', '~> 3.5', '>= 3.5.0'
|
|
28
30
|
|
|
29
31
|
gem.add_development_dependency 'minitest', '~> 5.11', '>= 5.11.0'
|
|
30
32
|
gem.add_development_dependency 'rake', '~> 12.0'
|
|
31
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
|
33
|
+
gem.add_development_dependency 'rubocop', '~> 0.74.0'
|
|
32
34
|
gem.add_development_dependency 'spy', '~> 1.0.0'
|
|
33
|
-
gem.add_development_dependency 'webmock', '~> 3.
|
|
35
|
+
gem.add_development_dependency 'webmock', '~> 3.7'
|
|
34
36
|
gem.add_development_dependency 'yard', '~> 0.9.5'
|
|
35
37
|
|
|
36
38
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wavefront-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Fisher
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-09-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: docopt
|
|
@@ -44,40 +44,40 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '3.
|
|
47
|
+
version: '3.5'
|
|
48
48
|
- - ">="
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 3.
|
|
50
|
+
version: 3.5.0
|
|
51
51
|
type: :runtime
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
|
55
55
|
- - "~>"
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: '3.
|
|
57
|
+
version: '3.5'
|
|
58
58
|
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 3.
|
|
60
|
+
version: 3.5.0
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: minitest
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: 5.11.0
|
|
68
65
|
- - "~>"
|
|
69
66
|
- !ruby/object:Gem::Version
|
|
70
67
|
version: '5.11'
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: 5.11.0
|
|
71
71
|
type: :development
|
|
72
72
|
prerelease: false
|
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
|
74
74
|
requirements:
|
|
75
|
-
- - ">="
|
|
76
|
-
- !ruby/object:Gem::Version
|
|
77
|
-
version: 5.11.0
|
|
78
75
|
- - "~>"
|
|
79
76
|
- !ruby/object:Gem::Version
|
|
80
77
|
version: '5.11'
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: 5.11.0
|
|
81
81
|
- !ruby/object:Gem::Dependency
|
|
82
82
|
name: rake
|
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -98,14 +98,14 @@ dependencies:
|
|
|
98
98
|
requirements:
|
|
99
99
|
- - "~>"
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: 0.
|
|
101
|
+
version: 0.74.0
|
|
102
102
|
type: :development
|
|
103
103
|
prerelease: false
|
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
|
106
106
|
- - "~>"
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: 0.
|
|
108
|
+
version: 0.74.0
|
|
109
109
|
- !ruby/object:Gem::Dependency
|
|
110
110
|
name: spy
|
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -126,14 +126,14 @@ dependencies:
|
|
|
126
126
|
requirements:
|
|
127
127
|
- - "~>"
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: '3.
|
|
129
|
+
version: '3.7'
|
|
130
130
|
type: :development
|
|
131
131
|
prerelease: false
|
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
|
133
133
|
requirements:
|
|
134
134
|
- - "~>"
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
|
-
version: '3.
|
|
136
|
+
version: '3.7'
|
|
137
137
|
- !ruby/object:Gem::Dependency
|
|
138
138
|
name: yard
|
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -188,6 +188,7 @@ files:
|
|
|
188
188
|
- lib/wavefront-cli/commands/proxy.rb
|
|
189
189
|
- lib/wavefront-cli/commands/query.rb
|
|
190
190
|
- lib/wavefront-cli/commands/savedsearch.rb
|
|
191
|
+
- lib/wavefront-cli/commands/serviceaccount.rb
|
|
191
192
|
- lib/wavefront-cli/commands/settings.rb
|
|
192
193
|
- lib/wavefront-cli/commands/source.rb
|
|
193
194
|
- lib/wavefront-cli/commands/user.rb
|
|
@@ -220,6 +221,7 @@ files:
|
|
|
220
221
|
- lib/wavefront-cli/display/proxy.rb
|
|
221
222
|
- lib/wavefront-cli/display/query.rb
|
|
222
223
|
- lib/wavefront-cli/display/savedsearch.rb
|
|
224
|
+
- lib/wavefront-cli/display/serviceaccount.rb
|
|
223
225
|
- lib/wavefront-cli/display/settings.rb
|
|
224
226
|
- lib/wavefront-cli/display/source.rb
|
|
225
227
|
- lib/wavefront-cli/display/user.rb
|
|
@@ -254,6 +256,7 @@ files:
|
|
|
254
256
|
- lib/wavefront-cli/proxy.rb
|
|
255
257
|
- lib/wavefront-cli/query.rb
|
|
256
258
|
- lib/wavefront-cli/savedsearch.rb
|
|
259
|
+
- lib/wavefront-cli/serviceaccount.rb
|
|
257
260
|
- lib/wavefront-cli/settings.rb
|
|
258
261
|
- lib/wavefront-cli/source.rb
|
|
259
262
|
- lib/wavefront-cli/stdlib/array.rb
|
|
@@ -264,7 +267,24 @@ files:
|
|
|
264
267
|
- lib/wavefront-cli/webhook.rb
|
|
265
268
|
- lib/wavefront-cli/write.rb
|
|
266
269
|
- spec/.rubocop.yml
|
|
270
|
+
- spec/constants.rb
|
|
267
271
|
- spec/spec_helper.rb
|
|
272
|
+
- spec/support/command_base.rb
|
|
273
|
+
- spec/support/minitest_assertions.rb
|
|
274
|
+
- spec/support/output_tester.rb
|
|
275
|
+
- spec/support/supported_commands.rb
|
|
276
|
+
- spec/test_mixins/acl.rb
|
|
277
|
+
- spec/test_mixins/delete.rb
|
|
278
|
+
- spec/test_mixins/deleteundelete.rb
|
|
279
|
+
- spec/test_mixins/describe.rb
|
|
280
|
+
- spec/test_mixins/dump.rb
|
|
281
|
+
- spec/test_mixins/general.rb
|
|
282
|
+
- spec/test_mixins/history.rb
|
|
283
|
+
- spec/test_mixins/import.rb
|
|
284
|
+
- spec/test_mixins/list.rb
|
|
285
|
+
- spec/test_mixins/search.rb
|
|
286
|
+
- spec/test_mixins/set.rb
|
|
287
|
+
- spec/test_mixins/tag.rb
|
|
268
288
|
- spec/wavefront-cli/alert_spec.rb
|
|
269
289
|
- spec/wavefront-cli/apitoken_spec.rb
|
|
270
290
|
- spec/wavefront-cli/base_spec.rb
|
|
@@ -281,7 +301,6 @@ files:
|
|
|
281
301
|
- spec/wavefront-cli/commands/metric_spec.rb
|
|
282
302
|
- spec/wavefront-cli/commands/proxy_spec.rb
|
|
283
303
|
- spec/wavefront-cli/commands/query_spec.rb
|
|
284
|
-
- spec/wavefront-cli/commands/spec_helper.rb
|
|
285
304
|
- spec/wavefront-cli/commands/webhook_spec.rb
|
|
286
305
|
- spec/wavefront-cli/commands/window_spec.rb
|
|
287
306
|
- spec/wavefront-cli/commands/write_spec.rb
|
|
@@ -292,7 +311,6 @@ files:
|
|
|
292
311
|
- spec/wavefront-cli/display/base_spec.rb
|
|
293
312
|
- spec/wavefront-cli/display/printer/long_spec.rb
|
|
294
313
|
- spec/wavefront-cli/display/printer/terse_spec.rb
|
|
295
|
-
- spec/wavefront-cli/display/spec_helper.rb
|
|
296
314
|
- spec/wavefront-cli/event_spec.rb
|
|
297
315
|
- spec/wavefront-cli/externallink_spec.rb
|
|
298
316
|
- spec/wavefront-cli/integration_spec.rb
|
|
@@ -304,6 +322,7 @@ files:
|
|
|
304
322
|
- spec/wavefront-cli/output/csv/query_spec.rb
|
|
305
323
|
- spec/wavefront-cli/output/csv_spec.rb
|
|
306
324
|
- spec/wavefront-cli/output/hcl_spec.rb
|
|
325
|
+
- spec/wavefront-cli/output/helpers.rb
|
|
307
326
|
- spec/wavefront-cli/output/json_spec.rb
|
|
308
327
|
- spec/wavefront-cli/output/ruby_spec.rb
|
|
309
328
|
- spec/wavefront-cli/output/wavefront/query_spec.rb
|
|
@@ -336,6 +355,7 @@ files:
|
|
|
336
355
|
- spec/wavefront-cli/resources/responses/notificant-list.json
|
|
337
356
|
- spec/wavefront-cli/resources/responses/proxy-list.json
|
|
338
357
|
- spec/wavefront-cli/resources/responses/query-cpu.json
|
|
358
|
+
- spec/wavefront-cli/resources/responses/query.json
|
|
339
359
|
- spec/wavefront-cli/resources/responses/savedsearch-list.json
|
|
340
360
|
- spec/wavefront-cli/resources/responses/user-list.json
|
|
341
361
|
- spec/wavefront-cli/resources/responses/usergroup-list.json
|
|
@@ -343,8 +363,11 @@ files:
|
|
|
343
363
|
- spec/wavefront-cli/resources/responses/window-list.json
|
|
344
364
|
- spec/wavefront-cli/resources/sample_query_response.json
|
|
345
365
|
- spec/wavefront-cli/resources/sample_raw_query_response.json
|
|
366
|
+
- spec/wavefront-cli/resources/updates/alert.json
|
|
367
|
+
- spec/wavefront-cli/resources/updates/dashboard.json
|
|
346
368
|
- spec/wavefront-cli/resources/wavefront.conf
|
|
347
369
|
- spec/wavefront-cli/savedsearch_spec.rb
|
|
370
|
+
- spec/wavefront-cli/serviceaccount_spec.rb
|
|
348
371
|
- spec/wavefront-cli/settings_spec.rb
|
|
349
372
|
- spec/wavefront-cli/source_spec.rb
|
|
350
373
|
- spec/wavefront-cli/stdlib/array_spec.rb
|
|
@@ -373,13 +396,31 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
373
396
|
- !ruby/object:Gem::Version
|
|
374
397
|
version: '0'
|
|
375
398
|
requirements: []
|
|
376
|
-
|
|
399
|
+
rubyforge_project:
|
|
400
|
+
rubygems_version: 2.7.7
|
|
377
401
|
signing_key:
|
|
378
402
|
specification_version: 4
|
|
379
403
|
summary: CLI for Wavefront API v2
|
|
380
404
|
test_files:
|
|
381
405
|
- spec/.rubocop.yml
|
|
406
|
+
- spec/constants.rb
|
|
382
407
|
- spec/spec_helper.rb
|
|
408
|
+
- spec/support/command_base.rb
|
|
409
|
+
- spec/support/minitest_assertions.rb
|
|
410
|
+
- spec/support/output_tester.rb
|
|
411
|
+
- spec/support/supported_commands.rb
|
|
412
|
+
- spec/test_mixins/acl.rb
|
|
413
|
+
- spec/test_mixins/delete.rb
|
|
414
|
+
- spec/test_mixins/deleteundelete.rb
|
|
415
|
+
- spec/test_mixins/describe.rb
|
|
416
|
+
- spec/test_mixins/dump.rb
|
|
417
|
+
- spec/test_mixins/general.rb
|
|
418
|
+
- spec/test_mixins/history.rb
|
|
419
|
+
- spec/test_mixins/import.rb
|
|
420
|
+
- spec/test_mixins/list.rb
|
|
421
|
+
- spec/test_mixins/search.rb
|
|
422
|
+
- spec/test_mixins/set.rb
|
|
423
|
+
- spec/test_mixins/tag.rb
|
|
383
424
|
- spec/wavefront-cli/alert_spec.rb
|
|
384
425
|
- spec/wavefront-cli/apitoken_spec.rb
|
|
385
426
|
- spec/wavefront-cli/base_spec.rb
|
|
@@ -396,7 +437,6 @@ test_files:
|
|
|
396
437
|
- spec/wavefront-cli/commands/metric_spec.rb
|
|
397
438
|
- spec/wavefront-cli/commands/proxy_spec.rb
|
|
398
439
|
- spec/wavefront-cli/commands/query_spec.rb
|
|
399
|
-
- spec/wavefront-cli/commands/spec_helper.rb
|
|
400
440
|
- spec/wavefront-cli/commands/webhook_spec.rb
|
|
401
441
|
- spec/wavefront-cli/commands/window_spec.rb
|
|
402
442
|
- spec/wavefront-cli/commands/write_spec.rb
|
|
@@ -407,7 +447,6 @@ test_files:
|
|
|
407
447
|
- spec/wavefront-cli/display/base_spec.rb
|
|
408
448
|
- spec/wavefront-cli/display/printer/long_spec.rb
|
|
409
449
|
- spec/wavefront-cli/display/printer/terse_spec.rb
|
|
410
|
-
- spec/wavefront-cli/display/spec_helper.rb
|
|
411
450
|
- spec/wavefront-cli/event_spec.rb
|
|
412
451
|
- spec/wavefront-cli/externallink_spec.rb
|
|
413
452
|
- spec/wavefront-cli/integration_spec.rb
|
|
@@ -419,6 +458,7 @@ test_files:
|
|
|
419
458
|
- spec/wavefront-cli/output/csv/query_spec.rb
|
|
420
459
|
- spec/wavefront-cli/output/csv_spec.rb
|
|
421
460
|
- spec/wavefront-cli/output/hcl_spec.rb
|
|
461
|
+
- spec/wavefront-cli/output/helpers.rb
|
|
422
462
|
- spec/wavefront-cli/output/json_spec.rb
|
|
423
463
|
- spec/wavefront-cli/output/ruby_spec.rb
|
|
424
464
|
- spec/wavefront-cli/output/wavefront/query_spec.rb
|
|
@@ -451,6 +491,7 @@ test_files:
|
|
|
451
491
|
- spec/wavefront-cli/resources/responses/notificant-list.json
|
|
452
492
|
- spec/wavefront-cli/resources/responses/proxy-list.json
|
|
453
493
|
- spec/wavefront-cli/resources/responses/query-cpu.json
|
|
494
|
+
- spec/wavefront-cli/resources/responses/query.json
|
|
454
495
|
- spec/wavefront-cli/resources/responses/savedsearch-list.json
|
|
455
496
|
- spec/wavefront-cli/resources/responses/user-list.json
|
|
456
497
|
- spec/wavefront-cli/resources/responses/usergroup-list.json
|
|
@@ -458,8 +499,11 @@ test_files:
|
|
|
458
499
|
- spec/wavefront-cli/resources/responses/window-list.json
|
|
459
500
|
- spec/wavefront-cli/resources/sample_query_response.json
|
|
460
501
|
- spec/wavefront-cli/resources/sample_raw_query_response.json
|
|
502
|
+
- spec/wavefront-cli/resources/updates/alert.json
|
|
503
|
+
- spec/wavefront-cli/resources/updates/dashboard.json
|
|
461
504
|
- spec/wavefront-cli/resources/wavefront.conf
|
|
462
505
|
- spec/wavefront-cli/savedsearch_spec.rb
|
|
506
|
+
- spec/wavefront-cli/serviceaccount_spec.rb
|
|
463
507
|
- spec/wavefront-cli/settings_spec.rb
|
|
464
508
|
- spec/wavefront-cli/source_spec.rb
|
|
465
509
|
- spec/wavefront-cli/stdlib/array_spec.rb
|