wavefront-cli 3.3.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.md +21 -10
  3. data/README.md +6 -5
  4. data/lib/wavefront-cli/base.rb +10 -2
  5. data/lib/wavefront-cli/command_mixins/tag.rb +1 -1
  6. data/lib/wavefront-cli/commands/alert.rb +9 -13
  7. data/lib/wavefront-cli/commands/apitoken.rb +3 -4
  8. data/lib/wavefront-cli/commands/base.rb +13 -0
  9. data/lib/wavefront-cli/commands/cloudintegration.rb +9 -9
  10. data/lib/wavefront-cli/commands/dashboard.rb +11 -14
  11. data/lib/wavefront-cli/commands/derivedmetric.rb +10 -12
  12. data/lib/wavefront-cli/commands/event.rb +16 -17
  13. data/lib/wavefront-cli/commands/integration.rb +6 -7
  14. data/lib/wavefront-cli/commands/link.rb +9 -9
  15. data/lib/wavefront-cli/commands/message.rb +5 -6
  16. data/lib/wavefront-cli/commands/metric.rb +2 -3
  17. data/lib/wavefront-cli/commands/notificant.rb +13 -9
  18. data/lib/wavefront-cli/commands/proxy.rb +6 -7
  19. data/lib/wavefront-cli/commands/query.rb +1 -2
  20. data/lib/wavefront-cli/commands/savedsearch.rb +13 -9
  21. data/lib/wavefront-cli/commands/settings.rb +4 -4
  22. data/lib/wavefront-cli/commands/source.rb +4 -5
  23. data/lib/wavefront-cli/commands/user.rb +11 -11
  24. data/lib/wavefront-cli/commands/usergroup.rb +13 -10
  25. data/lib/wavefront-cli/commands/webhook.rb +8 -12
  26. data/lib/wavefront-cli/commands/window.rb +15 -15
  27. data/lib/wavefront-cli/event.rb +1 -1
  28. data/lib/wavefront-cli/settings.rb +1 -1
  29. data/lib/wavefront-cli/version.rb +1 -1
  30. data/spec/wavefront-cli/commands/base_spec.rb +1 -1
  31. data/spec/wavefront-cli/notificant_spec.rb +2 -1
  32. data/spec/wavefront-cli/user_spec.rb +1 -1
  33. data/spec/wavefront-cli/usergroup_spec.rb +2 -2
  34. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ce4081f6a736ace3019e5c4fc3cadcc91d04e028ea4f04a034250ccef7afc14
4
- data.tar.gz: 3c00162398ae62804cde46e1cfc7e058d953f22566cd72d63df799e78f0cbf69
3
+ metadata.gz: 5ef777d9892feec5a1f016e2a1129826735181bd3ce15a6a83942743606be0e9
4
+ data.tar.gz: dd49d2872f08535cf2dfe5d0f3780b80cdeea956827acfd817445819de7dcb78
5
5
  SHA512:
6
- metadata.gz: fc66b3ce0e7f6942516c79bbed8f93f97d57e4adc3b84f40770bf49a00d26f943e94007307edb5eb71542aaec023374acab623d0fbd712bcc5ed22cb7cf69501
7
- data.tar.gz: c5263da338dc6472e6beb7d9c221fa30036e8fcbc825ec7d39b4f1688fb75f65a3dd6b68f022c82885a4f906727cd5cd06e4ca90516830218958669cae73b512
6
+ metadata.gz: 91ecc6b341a68759e76e5ec95f694873cd9f8b88cd1bae3a40b2a354c9dd9952550f185c43211475fe146f2ab00446c61e364cef02c4bb1921d56f1ff0c173b1
7
+ data.tar.gz: 881eba75e3660ae2a0550f946c0324337e410340693821f0ce581a62ef6d29ce7fbb6437d97d9ba427ba4fa27a754b61c5ef9d75369885e1be01d62bf2a47d64
data/HISTORY.md CHANGED
@@ -1,16 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.1 (18/06/2019)
4
+ * `update` subcommand has been changed to `set`. (Breaking change.)
5
+ * `import` subcommand now accepts `--update` (`-u`) option, which
6
+ lets you overwrite an existing object with a JSON or YAML
7
+ description.
8
+ * Fix `tag searchpath` bug.
9
+
10
+ ## 4.0.0 (18/06/2019)
11
+
12
+ * Failed push to Gemfury. Does not exist.
13
+
3
14
  ## 3.3.0 (10/06/2019)
4
- * Support negation searches. Search for alerts with targets *not* containing
5
- `str` with `wf alert search target!~str`.
6
- * Add `tag pathsearch` command. Searches for tags whose hierarchical names
7
- begin with the given element(s).
8
- * Better printing of structured search results. For example `wf alert search
9
- tags=X`.
10
- * Support freetext searches. Use `wf <object> search freetext=string` and you
11
- will be given a list of the objects which match the search along with the
12
- matching keys. (Not values!) Adding `-l` presents all matching objects in
13
- full.
15
+ * Support negation searches. Search for alerts with targets *not*
16
+ containing `str` with `wf alert search target!~str`.
17
+ * Add `tag pathsearch` command. Searches for tags whose hierarchical
18
+ names begin with the given element(s).
19
+ * Better printing of structured search results. For example `wf
20
+ alert search tags=X`.
21
+ * Support freetext searches. Use `wf <object> search
22
+ freetext=string` and you will be given a list of the objects which
23
+ match the search along with the matching keys. (Not values!)
24
+ Adding `-l` presents all matching objects in full.
14
25
 
15
26
  ## 3.2.3 (24/05/2019)
16
27
  * Don't print erroneous pagination message when using `list --all`.
data/README.md CHANGED
@@ -40,10 +40,10 @@ Commands:
40
40
  integration view and manage Wavefront integrations
41
41
  link view and manage external links
42
42
  message read and mark user messages
43
- metric view metrics
43
+ metric get metric details
44
44
  notificant view and manage Wavefront alert targets
45
- proxy view and manage Wavefront proxies
46
- query query the Wavefront API
45
+ proxy view and manage proxies
46
+ query run Wavefront queries
47
47
  savedsearch view and manage saved searches
48
48
  settings view and manage system preferences
49
49
  source view and manage source tags and descriptions
@@ -174,7 +174,8 @@ sysdef.limited@gmail.com
174
174
  ```
175
175
 
176
176
  You could, of course, modify certain aspects of the exported data before
177
- re-importing.
177
+ re-importing. You can import an object over the top of an existing
178
+ one with `import --update`.
178
179
 
179
180
  ### Time Windows
180
181
 
@@ -204,7 +205,7 @@ the last ten minutes.
204
205
  Use the `query` subcommand with any timeseries expression.
205
206
 
206
207
  ```
207
- ./wf query "ts(cpu.*.pc.user, source=cube)" | more
208
+ $ wf query "ts(cpu.*.pc.user, source=cube)" | more
208
209
  name ts(cpu.*.pc.user, source=cube)
209
210
  query ts(cpu.*.pc.user, source=cube)
210
211
  timeseries
@@ -393,7 +393,15 @@ module WavefrontCli
393
393
  raise WavefrontCli::Exception::UnparseableInput
394
394
  end
395
395
 
396
- wf.create(prepped)
396
+ if options[:update]
397
+ import_update(raw)
398
+ else
399
+ wf.create(prepped)
400
+ end
401
+ end
402
+
403
+ def import_update(raw)
404
+ wf.update(raw['id'], raw, false)
397
405
  end
398
406
 
399
407
  def do_delete
@@ -419,7 +427,7 @@ module WavefrontCli
419
427
  wf.undelete(options[:'<id>'])
420
428
  end
421
429
 
422
- def do_update
430
+ def do_set
423
431
  cannot_noop!
424
432
  k, v = options[:'<key=value>'].split('=', 2)
425
433
  wf.update(options[:'<id>'], k => v)
@@ -28,7 +28,7 @@ module WavefrontCli
28
28
  require 'wavefront-sdk/search'
29
29
  wfs = Wavefront::Search.new(mk_creds, mk_opts)
30
30
 
31
- query = { key: 'tags',
31
+ query = { key: 'tagpath',
32
32
  value: options[:'<word>'],
33
33
  matchingMethod: 'TAGPATH',
34
34
  negated: false }
@@ -3,10 +3,6 @@ require_relative 'base'
3
3
  # Define the Alert command
4
4
  #
5
5
  class WavefrontCommandAlert < WavefrontCommandBase
6
- def description
7
- 'view and manage alerts'
8
- end
9
-
10
6
  def _commands
11
7
  ["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
12
8
  "firing #{CMN} [-o offset] [-L limit]",
@@ -18,9 +14,9 @@ class WavefrontCommandAlert < WavefrontCommandBase
18
14
  "history #{CMN} [-o offset] [-L limit] <id>",
19
15
  "clone #{CMN} [-v version] <id>",
20
16
  "latest #{CMN} <id>",
21
- "import #{CMN} <file>",
17
+ "import #{CMN} [-u] <file>",
22
18
  "snooze #{CMN} [-T time] <id>",
23
- "update #{CMN} <key=value> <id>",
19
+ "set #{CMN} <key=value> <id>",
24
20
  "unsnooze #{CMN} <id>",
25
21
  "search #{CMN} [-al] [-o offset] [-L limit] <condition>...",
26
22
  tag_commands,
@@ -34,14 +30,14 @@ class WavefrontCommandAlert < WavefrontCommandBase
34
30
 
35
31
  def _options
36
32
  [common_options,
37
- '-l, --long list alerts in detail',
38
- '-a, --all list all alerts',
39
- '-v, --version=INTEGER describe only this version of alert',
40
- '-o, --offset=n start from nth alert',
41
- '-L, --limit=COUNT number of alerts to list',
33
+ "-l, --long list #{things} in detail",
34
+ "-a, --all list all #{things}",
35
+ "-v, --version=INTEGER describe only this version of #{thing}",
36
+ "-o, --offset=n start from nth #{thing}",
37
+ "-L, --limit=COUNT number of #{things} to list",
42
38
  '-O, --fields=F1,F2,... only show given fields',
39
+ "-u, --update update an existing #{thing}",
43
40
  '-T, --time=SECONDS how long to snooze (default 3600)',
44
- '-b, --brief do not show alert names',
45
- '-f, --format=STRING output format']
41
+ "-b, --brief do not show #{thing} names"]
46
42
  end
47
43
  end
@@ -3,8 +3,8 @@ require_relative 'base'
3
3
  # Define the apitoken command.
4
4
  #
5
5
  class WavefrontCommandApitoken < WavefrontCommandBase
6
- def description
7
- 'view and manage API tokens'
6
+ def thing
7
+ 'API token'
8
8
  end
9
9
 
10
10
  def sdk_file
@@ -25,7 +25,6 @@ class WavefrontCommandApitoken < WavefrontCommandBase
25
25
 
26
26
  def _options
27
27
  [common_options,
28
- '-O, --fields=F1,F2,... only show given fields',
29
- '-f, --format=STRING output format']
28
+ '-O, --fields=F1,F2,... only show given fields']
30
29
  end
31
30
  end
@@ -6,6 +6,10 @@ CMN = '[-DnV] [-c file] [-P profile] [-E endpoint] [-t token] ' \
6
6
  # A base class which all command classes extend.
7
7
  #
8
8
  class WavefrontCommandBase
9
+ def description
10
+ "view and manage #{things}"
11
+ end
12
+
9
13
  # All commands have these options
10
14
  # @return [Array]
11
15
  #
@@ -15,6 +19,7 @@ class WavefrontCommandBase
15
19
  '-D, --debug enable debug mode',
16
20
  '-n, --noop do not perform API calls',
17
21
  '-V, --verbose be verbose',
22
+ '-f, --format=STRING output format',
18
23
  '-h, --help show this message']
19
24
  end
20
25
 
@@ -68,6 +73,14 @@ class WavefrontCommandBase
68
73
  self.class.name.sub(/WavefrontCommand/, '').downcase
69
74
  end
70
75
 
76
+ def thing
77
+ word
78
+ end
79
+
80
+ def things
81
+ thing + 's'
82
+ end
83
+
71
84
  # @return [String] the name of the SDK class which does the work
72
85
  # for this command.
73
86
  #
@@ -3,8 +3,8 @@ require_relative 'base'
3
3
  # Define the cloud integration command.
4
4
  #
5
5
  class WavefrontCommandCloudintegration < WavefrontCommandBase
6
- def description
7
- 'view and manage cloud integrations'
6
+ def thing
7
+ 'cloud integration'
8
8
  end
9
9
 
10
10
  def sdk_file
@@ -22,17 +22,17 @@ class WavefrontCommandCloudintegration < WavefrontCommandBase
22
22
  "undelete #{CMN} <id>",
23
23
  "enable #{CMN} <id>",
24
24
  "disable #{CMN} <id>",
25
- "import #{CMN} <file>",
25
+ "import #{CMN} [-u] <file>",
26
26
  "search #{CMN} [-al] [-o offset] [-L limit] <condition>..."]
27
27
  end
28
28
 
29
29
  def _options
30
30
  [common_options,
31
- '-l, --long list cloud integrations in detail',
32
- '-a, --all list all cloud integrations',
33
- '-o, --offset=n start from nth cloud integration',
34
- '-O, --fields=F1,F2,... only show given fields',
35
- '-L, --limit=COUNT number of cloud integrations to list',
36
- '-f, --format=STRING output format']
31
+ "-l, --long list #{things} in detail",
32
+ "-a, --all list all #{things}",
33
+ "-o, --offset=n start from nth #{thing}",
34
+ '-O, --fields=F1,F2,... only show given fields',
35
+ "-L, --limit=COUNT number of #{things} to list",
36
+ "-u, --update update an existing #{thing}"]
37
37
  end
38
38
  end
@@ -3,15 +3,11 @@ require_relative 'base'
3
3
  # Define the dashboard command.
4
4
  #
5
5
  class WavefrontCommandDashboard < WavefrontCommandBase
6
- def description
7
- 'view and manage dashboards'
8
- end
9
-
10
6
  def _commands
11
7
  ["list #{CMN} [-alN] [-O fields] [-o offset] [-L limit]",
12
8
  "describe #{CMN} [-v version] <id>",
13
- "import #{CMN} <file>",
14
- "update #{CMN} <key=value> <id>",
9
+ "import #{CMN} [-u] <file>",
10
+ "set #{CMN} <key=value> <id>",
15
11
  "delete #{CMN} <id>",
16
12
  "undelete #{CMN} <id>",
17
13
  "history #{CMN} [-o offset] [-L limit] <id>",
@@ -26,14 +22,15 @@ class WavefrontCommandDashboard < WavefrontCommandBase
26
22
 
27
23
  def _options
28
24
  [common_options,
29
- '-l, --long list dashboards in detail',
30
- '-a, --all list all dashboards',
31
- '-o, --offset=n start list from nth dashboard or revision',
25
+ "-l, --long list #{things} in detail",
26
+ "-a, --all list all #{things}",
27
+ "-o, --offset=n start list from nth #{thing} or revision",
28
+ "-L, --limit=COUNT number of #{things} or revisions to list",
32
29
  '-O, --fields=F1,F2,... only show given fields',
33
- '-L, --limit=COUNT number of dashboards or revisions to list',
34
- '-v, --version=INTEGER version of dashboard',
35
- '-b, --brief do not show dashboard names',
36
- '-N, --no-system do not show system-owned dashboards',
37
- '-f, --format=STRING output format']
30
+ "-u, --update update an existing #{thing}",
31
+ '-T, --time=SECONDS how long to snooze (default 3600)',
32
+ "-v, --version=INTEGER version of #{thing}",
33
+ "-b, --brief do not show #{thing} names",
34
+ "-N, --no-system do not show system-owned #{things}"]
38
35
  end
39
36
  end
@@ -3,8 +3,8 @@ require_relative 'base'
3
3
  # Define the derivedmetric command.
4
4
  #
5
5
  class WavefrontCommandDerivedmetric < WavefrontCommandBase
6
- def description
7
- 'view and manage derived metrics'
6
+ def thing
7
+ 'derived metric'
8
8
  end
9
9
 
10
10
  def sdk_file
@@ -20,8 +20,8 @@ class WavefrontCommandDerivedmetric < WavefrontCommandBase
20
20
  "describe #{CMN} [-v version] <id>",
21
21
  "create #{CMN} [-d description] [-T tag...] [-b] [-i interval] " \
22
22
  '[-r range] <name> <query>',
23
- "import #{CMN} <file>",
24
- "update #{CMN} <key=value> <id>",
23
+ "import #{CMN} [-u] <file>",
24
+ "set #{CMN} <key=value> <id>",
25
25
  "delete #{CMN} <id>",
26
26
  "undelete #{CMN} <id>",
27
27
  "history #{CMN} [-o offset] [-L limit] <id>",
@@ -31,20 +31,18 @@ class WavefrontCommandDerivedmetric < WavefrontCommandBase
31
31
 
32
32
  def _options
33
33
  [common_options,
34
- '-l, --long list derived metrics in detail',
35
- '-a, --all list all derived metrics',
36
- '-o, --offset=n start list from nth derived metrics or ' \
37
- 'revision',
34
+ "-l, --long list #{things} in detail",
35
+ "-a, --all list all #{things}",
36
+ "-v, --version=INTEGER describe only this version of #{thing}",
37
+ "-o, --offset=n start from nth #{thing} or revision",
38
+ "-L, --limit=COUNT number of #{things} or revisions to list",
38
39
  '-O, --fields=F1,F2,... only show given fields',
39
- '-L, --limit=COUNT number of derived metrics or revisions to ' \
40
- 'list',
41
- '-v, --version=INTEGER version of derived metrics',
42
40
  '-b, --obsolete include obsolete metrics',
43
41
  '-T, --ctag=STRING add customer tag',
44
42
  '-d, --desc=STRING additional information about query',
45
43
  '-i, --interval=INTEGER execute query every n minutes [default: 1]',
46
44
  '-r, --range=INTEGER include results in the last n minutes ' \
47
45
  '[default: 5]',
48
- '-f, --format=STRING output format']
46
+ "-u, --update update an existing #{thing}"]
49
47
  end
50
48
  end
@@ -4,7 +4,7 @@ require_relative 'base'
4
4
  #
5
5
  class WavefrontCommandEvent < WavefrontCommandBase
6
6
  def description
7
- 'open, close, view, and manage events'
7
+ "open, close, view, and manage #{things}"
8
8
  end
9
9
 
10
10
  def _commands
@@ -15,7 +15,7 @@ class WavefrontCommandEvent < WavefrontCommandBase
15
15
  '[-S severity] [-T type] [-H host...] [-g tag...] [-N] <event>',
16
16
  "close #{CMN} [<id>]",
17
17
  "delete #{CMN} <id>",
18
- "update #{CMN} <key=value> <id>",
18
+ "set #{CMN} <key=value> <id>",
19
19
  "search #{CMN} [-o offset] [-L limit] [-l] <condition>...",
20
20
  "wrap #{CMN} [-C command] [-d description] [-S severity] [-T type] " \
21
21
  '[-H host...] [-g tag...] <event>',
@@ -25,26 +25,25 @@ class WavefrontCommandEvent < WavefrontCommandBase
25
25
 
26
26
  def _options
27
27
  [common_options,
28
- '-l, --long list events in detail',
29
- '-o, --cursor=EVENT start listing from given event',
28
+ "-l, --long list #{things} in detail",
29
+ "-o, --cursor=EVENT start listing from given #{thing}",
30
30
  '-O, --fields=F1,F2,... only show given fields',
31
- '-L, --limit=COUNT number of events to list',
32
- '-s, --start=TIME time at which event begins',
33
- '-e, --end=TIME time at which event ends',
34
- '-S, --severity=SEVERITY severity of event',
35
- '-i, --instant create an instantaneous event',
36
- '-T, --type=TYPE type of event',
37
- '-d, --desc=STRING description of event',
38
- '-H, --host=STRING source to which event applies',
31
+ "-L, --limit=COUNT number of #{things} to list",
32
+ "-s, --start=TIME time at which #{thing} begins",
33
+ "-e, --end=TIME time at which #{thing} ends",
34
+ "-S, --severity=SEVERITY severity of #{thing}",
35
+ "-i, --instant create an instantaneous #{thing}",
36
+ "-T, --type=TYPE type of #{thing}",
37
+ "-d, --desc=STRING description of #{thing}",
38
+ "-H, --host=STRING source to which #{thing} applies",
39
39
  '-N, --nostate do not create a local file recording ' \
40
- 'the event',
41
- '-g, --evtag=TAG event tag',
42
- '-C, --command=COMMAND command to run',
43
- '-f, --format=STRING output format']
40
+ "the #{thing}",
41
+ "-g, --evtag=TAG #{thing} tag",
42
+ '-C, --command=COMMAND command to run']
44
43
  end
45
44
 
46
45
  def postscript
47
- "View events in detail using the 'query' command with the " \
46
+ "View #{things} in detail using the 'query' command with the " \
48
47
  "'events()' function."
49
48
  end
50
49
  end
@@ -1,10 +1,10 @@
1
1
  require_relative 'base'
2
2
 
3
- # Define the cloud integration command.
3
+ # Define the integration command.
4
4
  #
5
5
  class WavefrontCommandIntegration < WavefrontCommandBase
6
6
  def description
7
- 'view and manage Wavefront integrations'
7
+ "view and manage Wavefront #{things}"
8
8
  end
9
9
 
10
10
  def _commands
@@ -24,11 +24,10 @@ class WavefrontCommandIntegration < WavefrontCommandBase
24
24
 
25
25
  def _options
26
26
  [common_options,
27
- '-l, --long list cloud integrations in detail',
28
- '-a, --all list all cloud integrations',
29
- '-o, --offset=n start from nth cloud integration',
27
+ "-l, --long list #{things} in detail",
28
+ "-a, --all list all #{things}",
29
+ "-o, --offset=n start from nth #{thing}",
30
30
  '-O, --fields=F1,F2,... only show given fields',
31
- '-L, --limit=COUNT number of cloud integrations to list',
32
- '-f, --format=STRING output format']
31
+ "-L, --limit=COUNT number of #{things} to list"]
33
32
  end
34
33
  end
@@ -3,8 +3,8 @@ require_relative 'base'
3
3
  # Define the external link command.
4
4
  #
5
5
  class WavefrontCommandLink < WavefrontCommandBase
6
- def description
7
- 'view and manage external links'
6
+ def thing
7
+ 'external link'
8
8
  end
9
9
 
10
10
  def sdk_file
@@ -21,21 +21,21 @@ class WavefrontCommandLink < WavefrontCommandBase
21
21
  "create #{CMN} [-m regex] [-s regex] [-p str=regex...] <name> " \
22
22
  '<description> <template>',
23
23
  "delete #{CMN} <id>",
24
- "import #{CMN} <file>",
25
- "update #{CMN} <key=value> <id>",
24
+ "import #{CMN} [-u] <file>",
25
+ "set #{CMN} <key=value> <id>",
26
26
  "search #{CMN} [-al] [-o offset] [-L limit] <condition>..."]
27
27
  end
28
28
 
29
29
  def _options
30
30
  [common_options,
31
- '-l, --long list external links in detail',
32
- '-a, --all list all external links',
33
- '-o, --offset=n start from nth external link',
31
+ "-l, --long list #{things} in detail",
32
+ "-a, --all list all #{things}",
33
+ "-o, --offset=n start from nth #{thing}",
34
34
  '-O, --fields=F1,F2,... only show given fields',
35
- '-L, --limit=COUNT number of external link to list',
35
+ "-L, --limit=COUNT number of #{thing} to list",
36
36
  '-m, --metric-regex=REGEX metric filter regular expression',
37
37
  '-s, --source-regex=REGEX source filter regular expression',
38
38
  '-p, --point-regex=REGEX point filter regular expression',
39
- '-f, --format=STRING output format']
39
+ "-u, --update update an existing #{thing}"]
40
40
  end
41
41
  end
@@ -4,7 +4,7 @@ require_relative 'base'
4
4
  #
5
5
  class WavefrontCommandMessage < WavefrontCommandBase
6
6
  def description
7
- 'read and mark user messages'
7
+ "read and mark user #{things}"
8
8
  end
9
9
 
10
10
  def _commands
@@ -15,11 +15,10 @@ class WavefrontCommandMessage < WavefrontCommandBase
15
15
 
16
16
  def _options
17
17
  [common_options,
18
- '-l, --long list messages in detail',
19
- '-o, --offset=n start from nth message',
18
+ "-l, --long list #{things} in detail",
19
+ "-o, --offset=n start from nth #{thing}",
20
20
  '-O, --fields=F1,F2,... only show given fields',
21
- '-L, --limit=COUNT number of messages to list',
22
- '-a, --all list all messages, not just unread',
23
- '-f, --format=STRING output format']
21
+ "-L, --limit=COUNT number of #{things} to list",
22
+ "-a, --all list all #{things}, not just unread"]
24
23
  end
25
24
  end
@@ -4,7 +4,7 @@ require_relative 'base'
4
4
  #
5
5
  class WavefrontCommandMetric < WavefrontCommandBase
6
6
  def description
7
- 'view metrics'
7
+ "get #{thing} details"
8
8
  end
9
9
 
10
10
  def _commands
@@ -14,7 +14,6 @@ class WavefrontCommandMetric < WavefrontCommandBase
14
14
  def _options
15
15
  [common_options,
16
16
  '-o, --offset=STRING value to start from if results > 1000',
17
- '-g, --glob=STRING return sources matching this pattern',
18
- '-f, --format=STRING output format']
17
+ '-g, --glob=STRING return sources matching this pattern']
19
18
  end
20
19
  end
@@ -3,27 +3,31 @@ require_relative 'base'
3
3
  # Define the notificant command.
4
4
  #
5
5
  class WavefrontCommandNotificant < WavefrontCommandBase
6
+ def thing
7
+ 'alert target'
8
+ end
9
+
6
10
  def description
7
- 'view and manage Wavefront alert targets'
11
+ "view and manage Wavefront #{things}"
8
12
  end
9
13
 
10
14
  def _commands
11
15
  ["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
12
16
  "describe #{CMN} <id>",
13
- "import #{CMN} <file>",
17
+ "import #{CMN} [-u] <file>",
14
18
  "delete #{CMN} <id>",
15
19
  "test #{CMN} <id>",
16
- "update #{CMN} <key=value> <id>",
20
+ "set #{CMN} <key=value> <id>",
17
21
  "search #{CMN} [-al] [-o offset] [-L limit] <condition>..."]
18
22
  end
19
23
 
20
24
  def _options
21
25
  [common_options,
22
- '-l, --long list alert targets in detail',
23
- '-a, --all list all alert targets',
24
- '-o, --offset=n start from nth alert target',
25
- '-O, --fields=F1,F2,... only show given fields',
26
- '-f, --format=STRING output format',
27
- '-L, --limit=COUNT number of alert targets to list']
26
+ "-l, --long list #{things} in detail",
27
+ "-a, --all list all #{things}",
28
+ "-o, --offset=n start from nth #{thing}",
29
+ '-O, --fields=F1,F2,... only show given fields',
30
+ "-L, --limit=COUNT number of #{things} to list",
31
+ "-u, --update update an existing #{thing}"]
28
32
  end
29
33
  end
@@ -3,8 +3,8 @@ require_relative 'base'
3
3
  # Define the proxy command.
4
4
  #
5
5
  class WavefrontCommandProxy < WavefrontCommandBase
6
- def description
7
- 'view and manage Wavefront proxies'
6
+ def things
7
+ 'proxies'
8
8
  end
9
9
 
10
10
  def _commands
@@ -19,11 +19,10 @@ class WavefrontCommandProxy < WavefrontCommandBase
19
19
 
20
20
  def _options
21
21
  [common_options,
22
- '-l, --long list proxies in detail',
23
- '-a, --all list all proxies',
24
- '-o, --offset=n start from nth proxy',
22
+ "-l, --long list #{things} in detail",
23
+ "-a, --all list all #{things}",
24
+ "-o, --offset=n start from nth #{thing}",
25
25
  '-O, --fields=F1,F2,... only show given fields',
26
- '-f, --format=STRING output format',
27
- '-L, --limit=COUNT number of proxies to list']
26
+ "-L, --limit=COUNT number of #{things} to list"]
28
27
  end
29
28
  end
@@ -4,7 +4,7 @@ require_relative 'base'
4
4
  #
5
5
  class WavefrontCommandQuery < WavefrontCommandBase
6
6
  def description
7
- 'query the Wavefront API'
7
+ 'run Wavefront queries'
8
8
  end
9
9
 
10
10
  def _commands
@@ -31,7 +31,6 @@ class WavefrontCommandQuery < WavefrontCommandBase
31
31
  'points (mean, median, min, max, sum, count, last, first)',
32
32
  '-O, --obsolete include metrics unreported for > 4 weeks',
33
33
  '-H, --host=STRING host or source to query on',
34
- '-f, --format=STRING output format',
35
34
  '-F, --format-opts=STRING comma-separated options to pass to ' \
36
35
  'output formatter',
37
36
  '-k, --nospark do not show sparkline',
@@ -3,8 +3,12 @@ require_relative 'base'
3
3
  # Define the saved search command.
4
4
  #
5
5
  class WavefrontCommandSavedsearch < WavefrontCommandBase
6
- def description
7
- 'view and manage saved searches'
6
+ def thing
7
+ 'saved search'
8
+ end
9
+
10
+ def things
11
+ 'saved searches'
8
12
  end
9
13
 
10
14
  def sdk_file
@@ -19,17 +23,17 @@ class WavefrontCommandSavedsearch < WavefrontCommandBase
19
23
  ["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
20
24
  "describe #{CMN} <id>",
21
25
  "delete #{CMN} <id>",
22
- "import #{CMN} <file>",
26
+ "import #{CMN} [-u] <file>",
23
27
  "search #{CMN} [-al] [-o offset] [-L limit] <condition>..."]
24
28
  end
25
29
 
26
30
  def _options
27
31
  [common_options,
28
- '-l, --long list saved searches in detail',
29
- '-a, --all list all saved searches',
30
- '-o, --offset=n start from nth saved search',
31
- '-O, --fields=F1,F2,... only show given fields',
32
- '-L, --limit=COUNT number of saved searches to list',
33
- '-f, --format=STRING output format']
32
+ "-l, --long list #{things} in detail",
33
+ "-a, --all list all #{things}",
34
+ "-o, --offset=n start from nth #{thing}",
35
+ '-O, --fields=F1,F2,... only show given fields',
36
+ "-L, --limit=COUNT number of #{things} to list",
37
+ "-u, --update update an existing #{thing}"]
34
38
  end
35
39
  end
@@ -3,20 +3,20 @@ require_relative 'base'
3
3
  # Define the settings command.
4
4
  #
5
5
  class WavefrontCommandSettings < WavefrontCommandBase
6
- def description
7
- 'view and manage system preferences'
6
+ def thing
7
+ 'system preference'
8
8
  end
9
9
 
10
10
  def _commands
11
11
  ["list permissions #{CMN} [-l] [-O fields]",
12
12
  "show preferences #{CMN} [-l] [-O fields]",
13
- "update #{CMN} <key=value>...",
13
+ "set #{CMN} <key=value>...",
14
14
  "default usergroups #{CMN} [-l] [-O fields]"]
15
15
  end
16
16
 
17
17
  def _options
18
18
  [common_options,
19
- '-l, --long list derived metrics in detail',
19
+ "-l, --long list #{things} in detail",
20
20
  '-O, --fields=F1,F2,... only show given fields']
21
21
  end
22
22
  end
@@ -19,11 +19,10 @@ class WavefrontCommandSource < WavefrontCommandBase
19
19
 
20
20
  def _options
21
21
  [common_options,
22
- '-l, --long list sources in detail',
23
- '-o, --cursor=SOURCE start list given source',
22
+ "-l, --long list #{things} in detail",
23
+ "-o, --cursor=SOURCE start list given #{thing}",
24
24
  '-O, --fields=F1,F2,... only show given fields',
25
- '-L, --limit=COUNT number of sources to list',
26
- '-a, --all list all sources, including cluster',
27
- '-f, --format=STRING output format']
25
+ "-L, --limit=COUNT number of #{things} to list",
26
+ "-a, --all list all #{things}, including cluster"]
28
27
  end
29
28
  end
@@ -4,7 +4,7 @@ require_relative 'base'
4
4
  #
5
5
  class WavefrontCommandUser < WavefrontCommandBase
6
6
  def description
7
- 'view and manage Wavefront users'
7
+ "view and manage Wavefront #{things}"
8
8
  end
9
9
 
10
10
  # delete uses a different string because it accepts multiples.
@@ -16,9 +16,9 @@ class WavefrontCommandUser < WavefrontCommandBase
16
16
  "describe #{CMN} <id>",
17
17
  "create #{CMN} [-e] [-m permission...] [-g group...] <id>",
18
18
  "invite #{CMN} [-m permission...] [-g group...] <id>",
19
- "update #{CMN} <key=value> <id>",
19
+ "set #{CMN} <key=value> <id>",
20
20
  "delete #{CMN} <user>...",
21
- "import #{CMN} <file>",
21
+ "import #{CMN} [-u] <file>",
22
22
  "groups #{CMN} <id>",
23
23
  "join #{CMN} <id> <group>...",
24
24
  "leave #{CMN} <id> <group>...",
@@ -29,14 +29,14 @@ class WavefrontCommandUser < WavefrontCommandBase
29
29
 
30
30
  def _options
31
31
  [common_options,
32
- '-l, --long list users in detail',
33
- '-o, --offset=n start from nth user',
34
- '-L, --limit=COUNT number of users to list',
35
- '-O, --fields=F1,F2,... only show given fields',
36
- '-e, --email send e-mail to user on account creation',
37
- '-m, --permission=STRING give user this permission',
38
- '-g, --group=STRING add user to this user group',
39
- '-f, --format=STRING output format']
32
+ "-l, --long list #{things} in detail",
33
+ "-o, --offset=n start from nth #{thing}",
34
+ "-L, --limit=COUNT number of #{things} to list",
35
+ '-O, --fields=F1,F2,... only show given fields',
36
+ "-u, --update update an existing #{thing}",
37
+ "-e, --email send e-mail to #{thing} on account creation",
38
+ "-m, --permission=STRING give #{thing} this permission",
39
+ "-g, --group=STRING add #{thing} to this user group"]
40
40
  end
41
41
 
42
42
  def postscript
@@ -3,8 +3,12 @@ require_relative 'base'
3
3
  # Define the usergroup command.
4
4
  #
5
5
  class WavefrontCommandUsergroup < WavefrontCommandBase
6
+ def thing
7
+ 'user group'
8
+ end
9
+
6
10
  def description
7
- 'view and manage Wavefront user groups'
11
+ "view and manage Wavefront #{things}"
8
12
  end
9
13
 
10
14
  def sdk_class
@@ -20,8 +24,8 @@ class WavefrontCommandUsergroup < WavefrontCommandBase
20
24
  "describe #{CMN} <id>",
21
25
  "create #{CMN} [-p permission...] <name>",
22
26
  "delete #{CMN} <id>",
23
- "import #{CMN} <file>",
24
- "update #{CMN} <key=value> <id>",
27
+ "import #{CMN} [-u] <file>",
28
+ "set #{CMN} <key=value> <id>",
25
29
  "users #{CMN} <id>",
26
30
  "permissions #{CMN} <id>",
27
31
  "add user #{CMN} <id> <user>...",
@@ -33,13 +37,12 @@ class WavefrontCommandUsergroup < WavefrontCommandBase
33
37
 
34
38
  def _options
35
39
  [common_options,
36
- '-l, --long list users in detail',
37
- '-o, --offset=n start from nth user group',
38
- '-L, --limit=COUNT number of user group to list',
39
- '-O, --fields=F1,F2,... only show given fields',
40
- '-p, --permission=STRING Wavefront permission',
41
- '-u, --user=STRING user name',
42
- '-f, --format=STRING output format']
40
+ "-l, --long list #{things} in detail",
41
+ "-o, --offset=n start from nth #{thing}",
42
+ "-L, --limit=COUNT number of #{things} to list",
43
+ '-O, --fields=F1,F2,... only show given fields',
44
+ "-u, --update update an existing #{thing}",
45
+ '-p, --permission=STRING Wavefront permission']
43
46
  end
44
47
 
45
48
  def postscript
@@ -3,26 +3,22 @@ require_relative 'base'
3
3
  # Define the webhook command.
4
4
  #
5
5
  class WavefrontCommandWebhook < WavefrontCommandBase
6
- def description
7
- 'view and manage webhooks'
8
- end
9
-
10
6
  def _commands
11
7
  ["list #{CMN} [-al] [-O fields] [-o offset] [-L limit]",
12
8
  "describe #{CMN} <id>",
13
9
  "delete #{CMN} <id>",
14
- "import #{CMN} <file>",
15
- "update #{CMN} <key=value> <id>",
10
+ "import #{CMN} [-u] <file>",
11
+ "set #{CMN} <key=value> <id>",
16
12
  "search #{CMN} [-al] [-o offset] [-L limit] <condition>..."]
17
13
  end
18
14
 
19
15
  def _options
20
16
  [common_options,
21
- '-l, --long list webhooks in detail',
22
- '-a, --all list all webhooks',
23
- '-o, --offset=n start list from nth webhook',
24
- '-O, --fields=F1,F2,... only show given fields',
25
- '-L, --limit=COUNT number of webhooks to list',
26
- '-f, --format=STRING output format']
17
+ "-l, --long list #{things} in detail",
18
+ "-a, --all list all #{things}",
19
+ "-o, --offset=n start list from nth #{thing}",
20
+ '-O, --fields=F1,F2,... only show given fields',
21
+ "-L, --limit=COUNT number of #{things} to list",
22
+ "-u, --update update an existing #{thing}"]
27
23
  end
28
24
  end
@@ -3,8 +3,8 @@ require_relative 'base'
3
3
  # Define the maintenance window command.
4
4
  #
5
5
  class WavefrontCommandWindow < WavefrontCommandBase
6
- def description
7
- 'view and manage maintenance windows'
6
+ def thing
7
+ 'maintenance window'
8
8
  end
9
9
 
10
10
  def sdk_file
@@ -23,8 +23,8 @@ class WavefrontCommandWindow < WavefrontCommandBase
23
23
  "close #{CMN} <id>",
24
24
  "extend #{CMN} (by|to) <time> <id>",
25
25
  "delete #{CMN} <id>",
26
- "import #{CMN} <file>",
27
- "update #{CMN} <key=value> <id>",
26
+ "import #{CMN} [-u] <file>",
27
+ "set #{CMN} <key=value> <id>",
28
28
  "search #{CMN} [-al] [-o offset] [-L limit] <condition>...",
29
29
  "ongoing #{CMN}",
30
30
  "pending #{CMN} [<hours>]"]
@@ -32,17 +32,17 @@ class WavefrontCommandWindow < WavefrontCommandBase
32
32
 
33
33
  def _options
34
34
  [common_options,
35
- '-l, --long list maintenance windows in detail',
36
- '-a, --all list all maintenance windows',
37
- '-o, --offset=n start from nth maintenance window',
35
+ "-l, --long list #{things} in detail",
36
+ "-a, --all list all #{things}",
37
+ "-o, --offset=n start from nth #{thing}",
38
38
  '-O, --fields=F1,F2,... only show given fields',
39
- '-L, --limit=COUNT number of maintenance windows to list',
40
- '-d, --desc=STRING reason for maintenance window',
41
- '-s, --start=TIME time at which window begins',
42
- '-e, --end=TIME time at which window ends',
43
- '-A, --atag=STRING alert tag to which window applies',
44
- '-H, --host=STRING host to which window applies',
45
- '-T, --htag=STRING host tag to which window applies',
46
- '-f, --format=STRING output format']
39
+ "-L, --limit=COUNT number of #{things} to list",
40
+ "-u, --update update an existing #{thing}",
41
+ "-d, --desc=STRING reason for #{thing}",
42
+ "-s, --start=TIME time at which #{thing} begins",
43
+ "-e, --end=TIME time at which #{thing} ends",
44
+ "-A, --atag=STRING alert tag to which #{thing} applies",
45
+ "-H, --host=STRING host to which #{thing} applies",
46
+ "-T, --htag=STRING host tag to which #{thing} applies"]
47
47
  end
48
48
  end
@@ -27,7 +27,7 @@ module WavefrontCli
27
27
  options[:cursor] || nil)
28
28
  end
29
29
 
30
- def do_update
30
+ def do_set
31
31
  k, v = options[:'<key=value>'].split('=')
32
32
  wf.update(options[:'<id>'], k => v)
33
33
  end
@@ -17,7 +17,7 @@ module WavefrontCli
17
17
  wf.default_user_groups
18
18
  end
19
19
 
20
- def do_update
20
+ def do_set
21
21
  body = options[:'<key=value>'].each_with_object({}) do |o, a|
22
22
  k, v = o.split('=', 2)
23
23
  next unless v && !v.empty?
@@ -1 +1 @@
1
- WF_CLI_VERSION = '3.3.0'.freeze
1
+ WF_CLI_VERSION = '4.0.1'.freeze
@@ -13,7 +13,7 @@ class WavefrontCommmandBaseTest < MiniTest::Test
13
13
 
14
14
  def setup
15
15
  @wf = WavefrontCommandBase.new
16
- @col_width = 18 # has to be manually set for each class
16
+ @col_width = 19 # has to be manually set for each class
17
17
  end
18
18
 
19
19
  def word
@@ -17,7 +17,8 @@ describe "#{word} command" do
17
17
  invalid_ids(word, ["describe #{bad_id}",
18
18
  "delete #{bad_id}",
19
19
  "test #{bad_id}",
20
- "update #{bad_id} key=value"])
20
+ "set #{bad_id} key=value"])
21
+ list_tests(word)
21
22
  cmd_to_call(word, "describe #{id}", path: "/api/v2/#{word}/#{id}")
22
23
  list_tests(word)
23
24
  search_tests(word, id)
@@ -20,7 +20,7 @@ describe "#{word} command" do
20
20
  "delete #{id}",
21
21
  "create #{id}",
22
22
  "invite #{id}",
23
- "update key=val #{id}",
23
+ "set key=val #{id}",
24
24
  'import file',
25
25
  "groups #{id}",
26
26
  "join #{id} #{gid1}",
@@ -20,7 +20,7 @@ describe "#{word} command" do
20
20
  "create #{name}",
21
21
  "delete #{gid1}",
22
22
  'import file',
23
- "update key=val #{gid1}",
23
+ "set key=val #{gid1}",
24
24
  "users #{gid1}",
25
25
  "permissions #{gid1}",
26
26
  "add user #{gid1} #{uid1} #{uid2}",
@@ -88,7 +88,7 @@ describe "#{word} command" do
88
88
 
89
89
  invalid_ids(word, ["describe #{bad_id}",
90
90
  "delete #{bad_id}",
91
- "update key=val #{bad_id}",
91
+ "set key=val #{bad_id}",
92
92
  "users #{bad_id}",
93
93
  "permissions #{bad_id}",
94
94
  "add user #{bad_id} #{uid1} #{uid2}",
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: 3.3.0
4
+ version: 4.0.1
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-06-11 00:00:00.000000000 Z
11
+ date: 2019-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -373,7 +373,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
373
373
  - !ruby/object:Gem::Version
374
374
  version: '0'
375
375
  requirements: []
376
- rubygems_version: 3.0.3
376
+ rubygems_version: 3.0.4
377
377
  signing_key:
378
378
  specification_version: 4
379
379
  summary: CLI for Wavefront API v2