wavefront-cli 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/Gemfile +1 -1
- data/README.md +21 -21
- data/Rakefile +2 -2
- data/bin/{wavefront → wf} +6 -2
- data/lib/wavefront-cli/alert.rb +7 -6
- data/lib/wavefront-cli/base.rb +27 -6
- data/lib/wavefront-cli/commands/alert.rb +2 -1
- data/lib/wavefront-cli/commands/base.rb +54 -29
- data/lib/wavefront-cli/commands/dashboard.rb +1 -0
- data/lib/wavefront-cli/commands/event.rb +7 -3
- data/lib/wavefront-cli/commands/integration.rb +2 -1
- data/lib/wavefront-cli/commands/link.rb +2 -2
- data/lib/wavefront-cli/commands/proxy.rb +2 -1
- data/lib/wavefront-cli/commands/savedsearch.rb +2 -1
- data/lib/wavefront-cli/commands/source.rb +3 -2
- data/lib/wavefront-cli/commands/webhook.rb +2 -1
- data/lib/wavefront-cli/commands/window.rb +2 -1
- data/lib/wavefront-cli/commands/write.rb +10 -6
- data/lib/wavefront-cli/constants.rb +1 -1
- data/lib/wavefront-cli/controller.rb +6 -4
- data/lib/wavefront-cli/dashboard.rb +6 -6
- data/lib/wavefront-cli/display/alert.rb +8 -4
- data/lib/wavefront-cli/display/base.rb +115 -170
- data/lib/wavefront-cli/display/cloudintegration.rb +2 -2
- data/lib/wavefront-cli/display/event.rb +1 -1
- data/lib/wavefront-cli/display/maintenancewindow.rb +1 -1
- data/lib/wavefront-cli/display/metric.rb +6 -7
- data/lib/wavefront-cli/display/printer/base.rb +24 -0
- data/lib/wavefront-cli/display/printer/long.rb +186 -0
- data/lib/wavefront-cli/display/printer/terse.rb +55 -0
- data/lib/wavefront-cli/display/query.rb +1 -2
- data/lib/wavefront-cli/display/savedsearch.rb +1 -1
- data/lib/wavefront-cli/display/source.rb +7 -3
- data/lib/wavefront-cli/display/webhook.rb +3 -4
- data/lib/wavefront-cli/event.rb +62 -23
- data/lib/wavefront-cli/exception.rb +1 -1
- data/lib/wavefront-cli/opt_handler.rb +6 -6
- data/lib/wavefront-cli/query.rb +5 -6
- data/lib/wavefront-cli/source.rb +5 -1
- data/lib/wavefront-cli/string.rb +59 -0
- data/lib/wavefront-cli/version.rb +1 -1
- data/lib/wavefront-cli/write.rb +4 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/wavefront-cli/alert_spec.rb +16 -5
- data/spec/wavefront-cli/base_spec.rb +5 -2
- data/spec/wavefront-cli/cli_help_spec.rb +7 -5
- data/spec/wavefront-cli/cloudintegration_spec.rb +9 -0
- data/spec/wavefront-cli/commands/alert_spec.rb +16 -0
- data/spec/wavefront-cli/commands/base_spec.rb +133 -0
- data/spec/wavefront-cli/commands/dashboard_spec.rb +16 -0
- data/spec/wavefront-cli/commands/event_spec.rb +17 -0
- data/spec/wavefront-cli/commands/integration_spec.rb +21 -0
- data/spec/wavefront-cli/commands/link_spec.rb +21 -0
- data/spec/wavefront-cli/commands/message_spec.rb +16 -0
- data/spec/wavefront-cli/commands/metric_spec.rb +16 -0
- data/spec/wavefront-cli/commands/proxy_spec.rb +16 -0
- data/spec/wavefront-cli/commands/query_spec.rb +16 -0
- data/spec/wavefront-cli/commands/spec_helper.rb +4 -0
- data/spec/wavefront-cli/commands/webhook_spec.rb +16 -0
- data/spec/wavefront-cli/commands/window_spec.rb +21 -0
- data/spec/wavefront-cli/commands/write_spec.rb +17 -0
- data/spec/wavefront-cli/dashboard_spec.rb +14 -4
- data/spec/wavefront-cli/display/base_spec.rb +162 -0
- data/spec/wavefront-cli/display/printer/base_spec.rb +20 -0
- data/spec/wavefront-cli/display/printer/long_spec.rb +137 -0
- data/spec/wavefront-cli/display/printer/terse_spec.rb +46 -0
- data/spec/wavefront-cli/display/spec_helper.rb +5 -0
- data/spec/wavefront-cli/event_spec.rb +9 -0
- data/spec/wavefront-cli/externallink_spec.rb +9 -0
- data/spec/wavefront-cli/maintanancewindow_spec.rb +10 -0
- data/spec/wavefront-cli/proxy_spec.rb +9 -0
- data/spec/wavefront-cli/savedsearch_spec.rb +9 -0
- data/spec/wavefront-cli/source_spec.rb +13 -1
- data/spec/wavefront-cli/string_spec.rb +51 -0
- data/spec/wavefront-cli/user_spec.rb +2 -2
- data/spec/wavefront-cli/webhook_spec.rb +9 -0
- data/wavefront-cli.gemspec +5 -5
- metadata +59 -22
- data/Gemfile.lock +0 -65
@@ -0,0 +1,137 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../../../../lib/wavefront-cli/display/printer/long'
|
4
|
+
require_relative '../spec_helper'
|
5
|
+
|
6
|
+
class WavefrontDisplayPrinterLong < MiniTest::Test
|
7
|
+
attr_reader :wf
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@wf = WavefrontDisplayPrinter::Long.new({})
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_mk_line_1
|
14
|
+
wf.instance_variable_set(:@kw, 5)
|
15
|
+
wf.instance_variable_set(:@indent_str, '')
|
16
|
+
assert_equal(' value', wf.mk_line('', 'value'))
|
17
|
+
assert_equal(' value', wf.mk_line(nil, 'value'))
|
18
|
+
assert_equal('key value', wf.mk_line('key', 'value'))
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_mk_line_2
|
22
|
+
wf = WavefrontDisplayPrinter::Long.new({})
|
23
|
+
wf.mk_indent(2)
|
24
|
+
wf.instance_variable_set(:@kw, 5)
|
25
|
+
assert_equal(' value', wf.mk_line('', 'value'))
|
26
|
+
assert_equal(' value', wf.mk_line(nil, 'value'))
|
27
|
+
assert_equal(' key value', wf.mk_line('key', 'value'))
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_mk_indent
|
31
|
+
wf.mk_indent(2)
|
32
|
+
assert_equal(wf.instance_variable_get(:@indent_str), ' ')
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_preen_fields
|
36
|
+
assert_equal(wf.preen_fields({k1: 1, k2: 2}, [:k1]), {k1: 1})
|
37
|
+
assert_equal(wf.preen_fields({k1: 1, k2: 2}), {k1: 1, k2: 2})
|
38
|
+
assert_equal(wf.preen_fields({k1: 1, k2: 2}, [:k3]), {})
|
39
|
+
assert_equal(wf.preen_fields({k1: 1, k2: 2}, [:k1, :k2]),
|
40
|
+
{k1: 1, k2: 2})
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_preen_value
|
44
|
+
assert_equal(wf.preen_value('test'), 'test')
|
45
|
+
assert_equal(wf.preen_value('<b>test</b>'), 'test')
|
46
|
+
assert_equal(wf.preen_value('<b>test</b> <i>test</i>'), 'test test')
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_blank?
|
50
|
+
assert wf.blank?('')
|
51
|
+
assert wf.blank?([])
|
52
|
+
assert wf.blank?({})
|
53
|
+
refute wf.blank?('test')
|
54
|
+
refute wf.blank?(5)
|
55
|
+
refute wf.blank?([1, 2])
|
56
|
+
refute wf.blank?(a: 1)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_parse_line_1
|
60
|
+
assert_nil wf.parse_line(:k, [])
|
61
|
+
spy = Spy.on(wf, :add_hash)
|
62
|
+
wf.parse_line('key', { k1: 1, k2: 2})
|
63
|
+
assert spy.has_been_called_with?('key', { k1: 1, k2: 2})
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_parse_line_2
|
67
|
+
spy = Spy.on(wf, :add_array)
|
68
|
+
wf.parse_line('key', [1,2,3,4])
|
69
|
+
assert spy.has_been_called_with?('key', [1,2,3,4])
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_parse_line_3
|
73
|
+
spy = Spy.on(wf, :add_line)
|
74
|
+
wf.parse_line('key', 'value')
|
75
|
+
assert spy.has_been_called_with?('key', 'value')
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_add_array
|
79
|
+
spy = Spy.on(wf, :add_line)
|
80
|
+
wf.add_array('key', %w(value1 value2 value3 value4))
|
81
|
+
assert spy.has_been_called_with?('key', 'value1')
|
82
|
+
assert spy.has_been_called_with?(nil, 'value2')
|
83
|
+
assert spy.has_been_called_with?(nil, 'value3')
|
84
|
+
assert spy.has_been_called_with?(nil, 'value4')
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_add_hash_1
|
88
|
+
hash = { sk1: 'value1', sk2: 'value2' }
|
89
|
+
wf.instance_variable_set(:@kw, 10)
|
90
|
+
wf.instance_variable_set(:@indent_step, 2)
|
91
|
+
tc_spy = Spy.on(wf, :_two_columns)
|
92
|
+
hr_spy = Spy.on(wf, :add_rule)
|
93
|
+
wf.add_hash('key', hash)
|
94
|
+
assert tc_spy.has_been_called_with?([hash], 6)
|
95
|
+
refute hr_spy.has_been_called?
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_add_hash_2
|
99
|
+
hash = { sk1: 'value1', sk2: 'value2' }
|
100
|
+
wf.instance_variable_set(:@kw, 10)
|
101
|
+
wf.instance_variable_set(:@indent_step, 2)
|
102
|
+
tc_spy = Spy.on(wf, :_two_columns)
|
103
|
+
hr_spy = Spy.on(wf, :add_rule)
|
104
|
+
wf.add_hash('key', hash, 3, 1)
|
105
|
+
assert tc_spy.has_been_called_with?([hash], 6)
|
106
|
+
assert hr_spy.has_been_called?
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_add_hash_3
|
110
|
+
hash = { sk1: 'value1', sk2: 'value2' }
|
111
|
+
wf.instance_variable_set(:@kw, 10)
|
112
|
+
wf.instance_variable_set(:@indent_step, 2)
|
113
|
+
tc_spy = Spy.on(wf, :_two_columns)
|
114
|
+
hr_spy = Spy.on(wf, :add_rule)
|
115
|
+
wf.add_hash('key', hash, 3, 2)
|
116
|
+
assert tc_spy.has_been_called_with?([hash], 6)
|
117
|
+
refute hr_spy.has_been_called?
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_mk_line_1
|
121
|
+
wf.instance_variable_set(:@kw, 7)
|
122
|
+
wf.instance_variable_set(:@indent_str, ' ')
|
123
|
+
assert_equal(' key value', wf.mk_line('key', 'value'))
|
124
|
+
assert_equal(' value', wf.mk_line(nil, 'value'))
|
125
|
+
assert_equal(' value', wf.mk_line('', 'value'))
|
126
|
+
assert_equal(" key a long string which must be\n" \
|
127
|
+
' folded once',
|
128
|
+
wf.mk_line('key', 'a long string which must be ' \
|
129
|
+
'folded once', 40))
|
130
|
+
assert_equal(" key a very long string whose very length\n" \
|
131
|
+
" means that the method is going to\n" \
|
132
|
+
" have to fold it twice",
|
133
|
+
wf.mk_line('key', 'a very long string whose very ' \
|
134
|
+
'length means that the method is going to ' \
|
135
|
+
'have to fold it twice', 49))
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../../../../lib/wavefront-cli/display/printer/terse'
|
4
|
+
require_relative '../spec_helper'
|
5
|
+
|
6
|
+
TERSE_DATA = [{ id: 'id1', name: 'name1', fa: 1, fb: 2, fc: 3 },
|
7
|
+
{ id: 'id2', name: 'name2', fa: 11, fb: 21, fc: 31 }].freeze
|
8
|
+
|
9
|
+
# Test terse printer
|
10
|
+
#
|
11
|
+
class WavefrontDisplayPrinterTerse < MiniTest::Test
|
12
|
+
attr_reader :wf
|
13
|
+
|
14
|
+
def setup
|
15
|
+
@wf = WavefrontDisplayPrinter::Terse.new(TERSE_DATA, :id, :name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_format_string
|
19
|
+
assert_equal(wf.fmt_string, '%-3s %-5s')
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_longest_keys
|
23
|
+
assert_equal(wf.longest_keys, id: 3, name: 5)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_prep_output_1
|
27
|
+
x = wf.prep_output
|
28
|
+
assert_equal(x[0], 'id1 name1')
|
29
|
+
assert_equal(x[1], 'id2 name2')
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_prep_output_2
|
33
|
+
wf.instance_variable_set(:@fmt_string, '%-10s %-100s')
|
34
|
+
wf.instance_variable_set(:@keys, %i[name fb])
|
35
|
+
x = wf.prep_output
|
36
|
+
assert_equal(x[0], 'name1 2')
|
37
|
+
assert_equal(x[1], 'name2 21')
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_prep_output_3
|
41
|
+
wf.instance_variable_set(:@keys, %i[name nokey])
|
42
|
+
x = wf.prep_output
|
43
|
+
assert_equal(x[0], 'name1')
|
44
|
+
assert_equal(x[1], 'name2')
|
45
|
+
end
|
46
|
+
end
|
@@ -16,4 +16,13 @@ describe "#{word} command" do
|
|
16
16
|
cmd_to_call(word, "close #{id}",
|
17
17
|
method: :post, path: "/api/v2/#{word}/#{id}/close")
|
18
18
|
tag_tests(word, id, bad_id)
|
19
|
+
cmd_to_call(word, "search -o 11 id=#{id}",
|
20
|
+
{ method: :post, path: "/api/v2/search/#{word}",
|
21
|
+
body: { limit: 10,
|
22
|
+
offset: "11",
|
23
|
+
query: [{key: 'id',
|
24
|
+
value: id,
|
25
|
+
matchingMethod: 'EXACT'}],
|
26
|
+
sort: {field: 'id', ascending: true}},
|
27
|
+
headers: JSON_POST_HEADERS })
|
19
28
|
end
|
@@ -15,4 +15,13 @@ describe "#{word} command" do
|
|
15
15
|
cmd_to_call(word, "delete #{id}",
|
16
16
|
{ method: :delete, path: "/api/v2/extlink/#{id}" }, k)
|
17
17
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}"])
|
18
|
+
cmd_to_call(word, "search -L 100 id~#{id}",
|
19
|
+
{ method: :post, path: "/api/v2/search/externallink",
|
20
|
+
body: { limit: "100",
|
21
|
+
offset: 0,
|
22
|
+
query: [{key: 'id',
|
23
|
+
value: id,
|
24
|
+
matchingMethod: 'CONTAINS'}],
|
25
|
+
sort: {field: 'id', ascending: true}},
|
26
|
+
headers: JSON_POST_HEADERS }, WavefrontCli::ExternalLink)
|
18
27
|
end
|
@@ -16,4 +16,14 @@ describe "#{word} command" do
|
|
16
16
|
cmd_to_call(word, "delete #{id}",
|
17
17
|
{ method: :delete, path: "/api/v2/maintenancewindow/#{id}" }, k)
|
18
18
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}"])
|
19
|
+
cmd_to_call(word, "search -o 100 id=#{id}",
|
20
|
+
{ method: :post, path: "/api/v2/search/maintenancewindow",
|
21
|
+
body: { limit: 10,
|
22
|
+
offset: "100",
|
23
|
+
query: [{key: 'id',
|
24
|
+
value: id,
|
25
|
+
matchingMethod: 'EXACT'}],
|
26
|
+
sort: {field: 'id', ascending: true}},
|
27
|
+
headers: JSON_POST_HEADERS },
|
28
|
+
WavefrontCli::MaintenanceWindow)
|
19
29
|
end
|
@@ -23,4 +23,13 @@ describe "#{word} command" do
|
|
23
23
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}",
|
24
24
|
"undelete #{bad_id}", "rename #{bad_id} newname"])
|
25
25
|
invalid_something(word, ["rename #{id} '(>_<)'"], 'proxy name')
|
26
|
+
cmd_to_call(word, "search -o 10 id=#{id}",
|
27
|
+
{ method: :post, path: "/api/v2/search/#{word}",
|
28
|
+
body: { limit: 10,
|
29
|
+
offset: "10",
|
30
|
+
query: [{key: 'id',
|
31
|
+
value: id,
|
32
|
+
matchingMethod: 'EXACT'}],
|
33
|
+
sort: {field: 'id', ascending: true}},
|
34
|
+
headers: JSON_POST_HEADERS })
|
26
35
|
end
|
@@ -15,4 +15,13 @@ describe "#{word} command" do
|
|
15
15
|
cmd_to_call(word, "delete #{id}",
|
16
16
|
{ method: :delete, path: "/api/v2/#{word}/#{id}" }, k)
|
17
17
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}"])
|
18
|
+
cmd_to_call(word, "search -L 100 id~#{id}",
|
19
|
+
{ method: :post, path: "/api/v2/search/savedsearch",
|
20
|
+
body: { limit: "100",
|
21
|
+
offset: 0,
|
22
|
+
query: [{key: 'id',
|
23
|
+
value: id,
|
24
|
+
matchingMethod: 'CONTAINS'}],
|
25
|
+
sort: {field: 'id', ascending: true}},
|
26
|
+
headers: JSON_POST_HEADERS }, WavefrontCli::SavedSearch)
|
18
27
|
end
|
@@ -9,10 +9,22 @@ require_relative "../../lib/wavefront-cli/#{word}"
|
|
9
9
|
|
10
10
|
describe "#{word} command" do
|
11
11
|
missing_creds(word, ['list', "describe #{id}", "clear #{id}"])
|
12
|
-
|
12
|
+
cmd_to_call(word, 'list', path: "/api/v2/#{word}")
|
13
|
+
cmd_to_call(word, 'list -L 50', path: "/api/v2/#{word}?limit=50")
|
14
|
+
cmd_to_call(word, 'list -L 100 -o mysource',
|
15
|
+
path: "/api/v2/#{word}?cursor=mysource&limit=100")
|
13
16
|
cmd_to_call(word, "describe #{id}", path: "/api/v2/#{word}/#{id}")
|
14
17
|
cmd_to_call(word, "clear #{id}",
|
15
18
|
method: :delete, path: "/api/v2/#{word}/#{id}")
|
16
19
|
invalid_ids(word, ["describe #{bad_id}", "clear #{bad_id}"])
|
17
20
|
tag_tests(word, id, bad_id)
|
21
|
+
cmd_to_call(word, "search -f json id^#{id}",
|
22
|
+
{ method: :post, path: "/api/v2/search/#{word}",
|
23
|
+
body: { limit: 10,
|
24
|
+
offset: 0,
|
25
|
+
query: [{key: 'id',
|
26
|
+
value: id,
|
27
|
+
matchingMethod: 'STARTSWITH'}],
|
28
|
+
sort: {field: 'id', ascending: true}},
|
29
|
+
headers: JSON_POST_HEADERS })
|
18
30
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../spec_helper'
|
4
|
+
require_relative '../../lib/wavefront-cli/string'
|
5
|
+
require_relative '../../lib/wavefront-cli/commands/base'
|
6
|
+
|
7
|
+
# Test extensions to string class
|
8
|
+
#
|
9
|
+
class StringTest < MiniTest::Test
|
10
|
+
def test_cmd_fold
|
11
|
+
str = "command subcommand #{CMN} [-a alpha] [-b beta] [-c gamma] <id>"
|
12
|
+
assert_equal(str.cmd_fold,
|
13
|
+
'command subcommand [-DnV] [-c file] [-P profile] ' \
|
14
|
+
"[-E endpoint]\n [-t token] [-a alpha] " \
|
15
|
+
'[-b beta] [-c gamma] <id>')
|
16
|
+
assert_equal(str.cmd_fold(240), str)
|
17
|
+
assert_equal(str.cmd_fold(50),
|
18
|
+
"command subcommand [-DnV] [-c file]\n [-P " \
|
19
|
+
"profile] [-E endpoint] [-t token]\n [-a " \
|
20
|
+
'alpha] [-b beta] [-c gamma] <id>')
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_fold_options
|
24
|
+
str = '-l, --longoption a long option with a quite long ' \
|
25
|
+
'description which needs folding'
|
26
|
+
|
27
|
+
assert_equal(str.opt_fold,
|
28
|
+
' -l, --longoption a long option with a quite ' \
|
29
|
+
"long description which\n needs folding\n")
|
30
|
+
assert_equal(str.opt_fold(50),
|
31
|
+
" -l, --longoption a long option with a\n " \
|
32
|
+
" quite long description which needs\n " \
|
33
|
+
" folding\n")
|
34
|
+
assert_equal(str.opt_fold(100), " #{str}\n")
|
35
|
+
end
|
36
|
+
|
37
|
+
#def test_fold_two_column_one_fold
|
38
|
+
#str = "a reasonably long string which must be folded just once"
|
39
|
+
#
|
40
|
+
#assert_equal(str.fold(40), "a reasonably long string which" \
|
41
|
+
#"\n must be folded just once")
|
42
|
+
#
|
43
|
+
##assert_equal(" key a very long string whose very length\n" \
|
44
|
+
#" means that the method is going to\n" \
|
45
|
+
#" have to fold it twice",
|
46
|
+
#
|
47
|
+
#wf.mk_line('key', 'a very long string whose very length means that the method is going to have to fold it twice', 40))
|
48
|
+
#
|
49
|
+
#
|
50
|
+
#end
|
51
|
+
end
|
@@ -4,13 +4,13 @@ id = 'someone@somewhere.com'
|
|
4
4
|
bad_id = '__BAD__'
|
5
5
|
word = 'user'
|
6
6
|
|
7
|
-
|
8
7
|
require_relative '../spec_helper'
|
9
8
|
require_relative "../../lib/wavefront-cli/#{word}"
|
10
9
|
|
11
10
|
describe "#{word} command" do
|
12
11
|
hdrs = JSON_POST_HEADERS.merge(
|
13
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
12
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
13
|
+
)
|
14
14
|
|
15
15
|
missing_creds(word, ['list', "describe #{id}", "delete #{id}"])
|
16
16
|
cmd_to_call(word, 'list', path: "/api/v2/#{word}")
|
@@ -14,4 +14,13 @@ describe "#{word} command" do
|
|
14
14
|
cmd_to_call(word, "delete #{id}", method: :delete,
|
15
15
|
path: "/api/v2/#{word}/#{id}")
|
16
16
|
invalid_ids(word, ["describe #{bad_id}", "delete #{bad_id}"])
|
17
|
+
cmd_to_call(word, "search -o 100 -L 100 id~#{id}",
|
18
|
+
{ method: :post, path: "/api/v2/search/#{word}",
|
19
|
+
body: { limit: "100",
|
20
|
+
offset: "100",
|
21
|
+
query: [{key: 'id',
|
22
|
+
value: id,
|
23
|
+
matchingMethod: 'CONTAINS'}],
|
24
|
+
sort: {field: 'id', ascending: true}},
|
25
|
+
headers: JSON_POST_HEADERS })
|
17
26
|
end
|
data/wavefront-cli.gemspec
CHANGED
@@ -18,18 +18,18 @@ Gem::Specification.new do |gem|
|
|
18
18
|
|
19
19
|
gem.bindir = 'bin'
|
20
20
|
gem.files = `git ls-files`.split("\n")
|
21
|
-
gem.executables = '
|
21
|
+
gem.executables = 'wf'
|
22
22
|
gem.test_files = gem.files.grep(/^spec/)
|
23
23
|
gem.require_paths = %w(lib)
|
24
24
|
|
25
|
-
gem.
|
26
|
-
gem.
|
25
|
+
gem.add_dependency 'docopt', '0.6.0'
|
26
|
+
gem.add_dependency 'wavefront-sdk', '>= 1.0.0'
|
27
27
|
|
28
28
|
gem.add_development_dependency 'bundler', '~> 1.3'
|
29
29
|
gem.add_development_dependency 'rake', '~> 12.0'
|
30
30
|
gem.add_development_dependency 'yard', '~> 0.9.5'
|
31
|
-
gem.add_development_dependency 'rubocop', '~> 0.
|
32
|
-
gem.add_development_dependency 'webmock', '~>
|
31
|
+
gem.add_development_dependency 'rubocop', '~> 0.49.1'
|
32
|
+
gem.add_development_dependency 'webmock', '~> 3.0'
|
33
33
|
gem.add_development_dependency 'minitest', '~> 5.8', '>= 5.8.0'
|
34
34
|
gem.add_development_dependency 'spy', '~> 0.4.0'
|
35
35
|
|
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: 0.0
|
4
|
+
version: 1.0.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: 2017-
|
11
|
+
date: 2017-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: wavefront-sdk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,34 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.49.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.49.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
-
- - ">="
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: 2.3.2
|
103
|
+
version: '3.0'
|
107
104
|
type: :development
|
108
105
|
prerelease: false
|
109
106
|
version_requirements: !ruby/object:Gem::Requirement
|
110
107
|
requirements:
|
111
108
|
- - "~>"
|
112
109
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: 2.3.2
|
110
|
+
version: '3.0'
|
117
111
|
- !ruby/object:Gem::Dependency
|
118
112
|
name: minitest
|
119
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +145,7 @@ dependencies:
|
|
151
145
|
description: 'CLI for Wavefront (wavefront.com) API v2 '
|
152
146
|
email: slackboy@gmail.com
|
153
147
|
executables:
|
154
|
-
-
|
148
|
+
- wf
|
155
149
|
extensions: []
|
156
150
|
extra_rdoc_files: []
|
157
151
|
files:
|
@@ -159,10 +153,9 @@ files:
|
|
159
153
|
- ".gitignore"
|
160
154
|
- ".travis.yml"
|
161
155
|
- Gemfile
|
162
|
-
- Gemfile.lock
|
163
156
|
- README.md
|
164
157
|
- Rakefile
|
165
|
-
- bin/
|
158
|
+
- bin/wf
|
166
159
|
- lib/wavefront-cli/alert.rb
|
167
160
|
- lib/wavefront-cli/base.rb
|
168
161
|
- lib/wavefront-cli/cloudintegration.rb
|
@@ -194,6 +187,9 @@ files:
|
|
194
187
|
- lib/wavefront-cli/display/maintenancewindow.rb
|
195
188
|
- lib/wavefront-cli/display/message.rb
|
196
189
|
- lib/wavefront-cli/display/metric.rb
|
190
|
+
- lib/wavefront-cli/display/printer/base.rb
|
191
|
+
- lib/wavefront-cli/display/printer/long.rb
|
192
|
+
- lib/wavefront-cli/display/printer/terse.rb
|
197
193
|
- lib/wavefront-cli/display/proxy.rb
|
198
194
|
- lib/wavefront-cli/display/query.rb
|
199
195
|
- lib/wavefront-cli/display/savedsearch.rb
|
@@ -212,6 +208,7 @@ files:
|
|
212
208
|
- lib/wavefront-cli/query.rb
|
213
209
|
- lib/wavefront-cli/savedsearch.rb
|
214
210
|
- lib/wavefront-cli/source.rb
|
211
|
+
- lib/wavefront-cli/string.rb
|
215
212
|
- lib/wavefront-cli/user.rb
|
216
213
|
- lib/wavefront-cli/version.rb
|
217
214
|
- lib/wavefront-cli/webhook.rb
|
@@ -221,7 +218,26 @@ files:
|
|
221
218
|
- spec/wavefront-cli/base_spec.rb
|
222
219
|
- spec/wavefront-cli/cli_help_spec.rb
|
223
220
|
- spec/wavefront-cli/cloudintegration_spec.rb
|
221
|
+
- spec/wavefront-cli/commands/alert_spec.rb
|
222
|
+
- spec/wavefront-cli/commands/base_spec.rb
|
223
|
+
- spec/wavefront-cli/commands/dashboard_spec.rb
|
224
|
+
- spec/wavefront-cli/commands/event_spec.rb
|
225
|
+
- spec/wavefront-cli/commands/integration_spec.rb
|
226
|
+
- spec/wavefront-cli/commands/link_spec.rb
|
227
|
+
- spec/wavefront-cli/commands/message_spec.rb
|
228
|
+
- spec/wavefront-cli/commands/metric_spec.rb
|
229
|
+
- spec/wavefront-cli/commands/proxy_spec.rb
|
230
|
+
- spec/wavefront-cli/commands/query_spec.rb
|
231
|
+
- spec/wavefront-cli/commands/spec_helper.rb
|
232
|
+
- spec/wavefront-cli/commands/webhook_spec.rb
|
233
|
+
- spec/wavefront-cli/commands/window_spec.rb
|
234
|
+
- spec/wavefront-cli/commands/write_spec.rb
|
224
235
|
- spec/wavefront-cli/dashboard_spec.rb
|
236
|
+
- spec/wavefront-cli/display/base_spec.rb
|
237
|
+
- spec/wavefront-cli/display/printer/base_spec.rb
|
238
|
+
- spec/wavefront-cli/display/printer/long_spec.rb
|
239
|
+
- spec/wavefront-cli/display/printer/terse_spec.rb
|
240
|
+
- spec/wavefront-cli/display/spec_helper.rb
|
225
241
|
- spec/wavefront-cli/event_spec.rb
|
226
242
|
- spec/wavefront-cli/externallink_spec.rb
|
227
243
|
- spec/wavefront-cli/maintanancewindow_spec.rb
|
@@ -232,6 +248,7 @@ files:
|
|
232
248
|
- spec/wavefront-cli/resources/conf.yaml
|
233
249
|
- spec/wavefront-cli/savedsearch_spec.rb
|
234
250
|
- spec/wavefront-cli/source_spec.rb
|
251
|
+
- spec/wavefront-cli/string_spec.rb
|
235
252
|
- spec/wavefront-cli/user_spec.rb
|
236
253
|
- spec/wavefront-cli/webhook_spec.rb
|
237
254
|
- wavefront-cli.gemspec
|
@@ -255,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
272
|
version: '0'
|
256
273
|
requirements: []
|
257
274
|
rubyforge_project:
|
258
|
-
rubygems_version: 2.5
|
275
|
+
rubygems_version: 2.4.5
|
259
276
|
signing_key:
|
260
277
|
specification_version: 4
|
261
278
|
summary: CLI for Wavefront API v2
|
@@ -265,7 +282,26 @@ test_files:
|
|
265
282
|
- spec/wavefront-cli/base_spec.rb
|
266
283
|
- spec/wavefront-cli/cli_help_spec.rb
|
267
284
|
- spec/wavefront-cli/cloudintegration_spec.rb
|
285
|
+
- spec/wavefront-cli/commands/alert_spec.rb
|
286
|
+
- spec/wavefront-cli/commands/base_spec.rb
|
287
|
+
- spec/wavefront-cli/commands/dashboard_spec.rb
|
288
|
+
- spec/wavefront-cli/commands/event_spec.rb
|
289
|
+
- spec/wavefront-cli/commands/integration_spec.rb
|
290
|
+
- spec/wavefront-cli/commands/link_spec.rb
|
291
|
+
- spec/wavefront-cli/commands/message_spec.rb
|
292
|
+
- spec/wavefront-cli/commands/metric_spec.rb
|
293
|
+
- spec/wavefront-cli/commands/proxy_spec.rb
|
294
|
+
- spec/wavefront-cli/commands/query_spec.rb
|
295
|
+
- spec/wavefront-cli/commands/spec_helper.rb
|
296
|
+
- spec/wavefront-cli/commands/webhook_spec.rb
|
297
|
+
- spec/wavefront-cli/commands/window_spec.rb
|
298
|
+
- spec/wavefront-cli/commands/write_spec.rb
|
268
299
|
- spec/wavefront-cli/dashboard_spec.rb
|
300
|
+
- spec/wavefront-cli/display/base_spec.rb
|
301
|
+
- spec/wavefront-cli/display/printer/base_spec.rb
|
302
|
+
- spec/wavefront-cli/display/printer/long_spec.rb
|
303
|
+
- spec/wavefront-cli/display/printer/terse_spec.rb
|
304
|
+
- spec/wavefront-cli/display/spec_helper.rb
|
269
305
|
- spec/wavefront-cli/event_spec.rb
|
270
306
|
- spec/wavefront-cli/externallink_spec.rb
|
271
307
|
- spec/wavefront-cli/maintanancewindow_spec.rb
|
@@ -276,5 +312,6 @@ test_files:
|
|
276
312
|
- spec/wavefront-cli/resources/conf.yaml
|
277
313
|
- spec/wavefront-cli/savedsearch_spec.rb
|
278
314
|
- spec/wavefront-cli/source_spec.rb
|
315
|
+
- spec/wavefront-cli/string_spec.rb
|
279
316
|
- spec/wavefront-cli/user_spec.rb
|
280
317
|
- spec/wavefront-cli/webhook_spec.rb
|
data/Gemfile.lock
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
wavefront-cli (0.0.5)
|
5
|
-
docopt (= 0.5.0)
|
6
|
-
wavefront-sdk (~> 0.1.5)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
addressable (2.5.1)
|
12
|
-
public_suffix (~> 2.0, >= 2.0.2)
|
13
|
-
ast (2.3.0)
|
14
|
-
crack (0.4.3)
|
15
|
-
safe_yaml (~> 1.0.0)
|
16
|
-
docopt (0.5.0)
|
17
|
-
faraday (0.12.1)
|
18
|
-
multipart-post (>= 1.2, < 3)
|
19
|
-
hashdiff (0.3.2)
|
20
|
-
inifile (3.0.0)
|
21
|
-
map (6.6.0)
|
22
|
-
minitest (5.8.5)
|
23
|
-
multipart-post (2.0.0)
|
24
|
-
parser (2.4.0.0)
|
25
|
-
ast (~> 2.2)
|
26
|
-
powerpack (0.1.1)
|
27
|
-
public_suffix (2.0.5)
|
28
|
-
rainbow (2.2.1)
|
29
|
-
rake (12.0.0)
|
30
|
-
rubocop (0.47.1)
|
31
|
-
parser (>= 2.3.3.1, < 3.0)
|
32
|
-
powerpack (~> 0.1)
|
33
|
-
rainbow (>= 1.99.1, < 3.0)
|
34
|
-
ruby-progressbar (~> 1.7)
|
35
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
36
|
-
ruby-progressbar (1.8.1)
|
37
|
-
safe_yaml (1.0.4)
|
38
|
-
spy (0.4.5)
|
39
|
-
unicode-display_width (1.1.3)
|
40
|
-
wavefront-sdk (0.1.5)
|
41
|
-
addressable (~> 2.4)
|
42
|
-
faraday (>= 0.12.1, < 0.13)
|
43
|
-
inifile (>= 3.0.0)
|
44
|
-
map (~> 6.6.0)
|
45
|
-
webmock (2.3.2)
|
46
|
-
addressable (>= 2.3.6)
|
47
|
-
crack (>= 0.3.2)
|
48
|
-
hashdiff
|
49
|
-
yard (0.9.5)
|
50
|
-
|
51
|
-
PLATFORMS
|
52
|
-
ruby
|
53
|
-
|
54
|
-
DEPENDENCIES
|
55
|
-
bundler (~> 1.3)
|
56
|
-
minitest (~> 5.8, >= 5.8.0)
|
57
|
-
rake (~> 12.0)
|
58
|
-
rubocop (~> 0.47.0)
|
59
|
-
spy (~> 0.4.0)
|
60
|
-
wavefront-cli!
|
61
|
-
webmock (~> 2.3, >= 2.3.2)
|
62
|
-
yard (~> 0.9.5)
|
63
|
-
|
64
|
-
BUNDLED WITH
|
65
|
-
1.14.6
|