wavefront-cli 2.10.0 → 2.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d12064132ca2cdf1520ff601c8ad3797adfcf0adf306f258bf27e7cf596748f0
4
- data.tar.gz: 57e656c7b47e5c477e1b7ff3efd410b9aa659f83b00a3e730909fc36726d0079
3
+ metadata.gz: fc20c9708088b0919282067c07688154bed7f7a2b2b37697eda633c6a9ffa95f
4
+ data.tar.gz: fb2c599eba984f008ba7d750b651ccef0b5cf49732e0a427ba50edcb8af4fff8
5
5
  SHA512:
6
- metadata.gz: 07f9bd142969a90d45e604abc9ef64ce166bcddcc031115bdb8a2ea0db96d299f21b654e03ec0b1a237462d8ac785c6423d34c0436fb77be8b8b8596a62fc4fc
7
- data.tar.gz: cd92759ebce2f7df4ba85d7340d0c6683a082bb7e46daae33191638164fb9417cce27f3a96924773f623338ab98c2befe85b9702f145c97991737797cedc2a35
6
+ metadata.gz: 73a3bc9afce21f9b6f3cdac570483f5155b3ba7b3b6b3f84ac3acebe83aeb927c28f1bc00a416a225b64ec8ff8bac42f16c2aef348a88c06a90c83a872383e31
7
+ data.tar.gz: 6ef1736948858597ae347aa1cbf9c3d71c4855b317076209fbd7e0a9cca216514df74a31663f2096b735b63693322244a06744e2e8d54b5ecaef68946d88f02e
data/HISTORY.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 2.10.0
3
+ ## 2.11.0 (24/10/2018)
4
+ * Add `proxy versions` subcommand. Lists proxies and their versions,
5
+ newest to oldest.
6
+
7
+ ## 2.10.1 (22/10/2018)
8
+ * Fix bug seen when listing events with `-s` AND `-L`.
9
+
10
+ ## 2.10.0 (22/10/2018)
4
11
  * Most `list` subcommands accept `-a / --all`, and will show all
5
12
  objects of the given type, with no pagination. (Exceptions are
6
13
  `user`, which never paginated because the API doesn't, and
@@ -13,7 +13,8 @@ class WavefrontCommandProxy < WavefrontCommandBase
13
13
  "delete #{CMN} <id>",
14
14
  "undelete #{CMN} <id>",
15
15
  "rename #{CMN} <id> <name>",
16
- "search #{CMN} [-al] [-f format] [-o offset] [-L limit] <condition>..."]
16
+ "search #{CMN} [-al] [-f format] [-o offset] [-L limit] <condition>...",
17
+ "versions #{CMN}"]
17
18
  end
18
19
 
19
20
  def _options
@@ -9,5 +9,9 @@ module WavefrontDisplay
9
9
  readable_time(:lastCheckInTime)
10
10
  long_output
11
11
  end
12
+
13
+ def do_versions
14
+ multicolumn(:id, :version, :name)
15
+ end
12
16
  end
13
17
  end
@@ -5,11 +5,23 @@ module WavefrontCli
5
5
  # CLI coverage for the v2 'proxy' API.
6
6
  #
7
7
  class Proxy < WavefrontCli::Base
8
+ def no_api_response
9
+ %w[do_versions]
10
+ end
11
+
8
12
  def do_rename
9
13
  wf_string?(options[:'<name>'])
10
14
  wf.rename(options[:'<id>'], options[:'<name>'])
11
15
  end
12
16
 
17
+ def do_versions
18
+ raw = wf.list(0, :all).response.items.map do |i|
19
+ { id: i.id, version: i.version, name: i.name }
20
+ end
21
+
22
+ raw.sort_by { |p| Gem::Version.new(p[:version]) }.reverse
23
+ end
24
+
13
25
  def extra_validation
14
26
  return unless options[:'<name>']
15
27
  begin
@@ -1 +1 @@
1
- WF_CLI_VERSION = '2.10.0'.freeze
1
+ WF_CLI_VERSION = '2.11.0'.freeze
data/spec/spec_helper.rb CHANGED
@@ -47,9 +47,24 @@ def permutations
47
47
  e: ENDPOINT }]]
48
48
  end
49
49
 
50
- # Match a command to the final API call it should produce, applying options in
51
- # as many combinations as possible, and ensuring the requisite display methods
52
- # are called.
50
+ # Object returned by cmd_to_call. Has just enough methods to satisy
51
+ # the SDK
52
+ #
53
+ class DummyResponse
54
+ def more_items?
55
+ false
56
+ end
57
+
58
+ def response
59
+ Map.new(items: [])
60
+ end
61
+ end
62
+
63
+ CANNED_RESPONSE = DummyResponse.new
64
+
65
+ # Match a command to the final API call it should produce, applying
66
+ # options in as many combinations as possible, and ensuring the
67
+ # requisite display methods are called.
53
68
  #
54
69
  # @param cmd [String] command line args to supply to the Wavefront
55
70
  # command
@@ -89,7 +104,7 @@ def cmd_to_call(word, args, call, sdk_class = nil)
89
104
  require "wavefront-sdk/#{sdk_class.name.split('::').last.downcase}"
90
105
  Spy.on_instance_method(
91
106
  Object.const_get('Wavefront::ApiCaller'), :respond
92
- ).and_return({})
107
+ ).and_return(CANNED_RESPONSE)
93
108
 
94
109
  d = Spy.on_instance_method(sdk_class, :display)
95
110
  WavefrontCliController.new(cmd.split)
@@ -8,10 +8,11 @@ require_relative '../spec_helper'
8
8
  require_relative "../../lib/wavefront-cli/#{word}"
9
9
 
10
10
  describe "#{word} command" do
11
- missing_creds(word, ['list', "describe #{id}", "delete #{id}",
11
+ missing_creds(word, ['list', 'versions', "describe #{id}", "delete #{id}",
12
12
  "undelete #{id}", "rename #{id} newname"])
13
13
  list_tests(word)
14
14
  cmd_to_call(word, "describe #{id}", path: "/api/v2/#{word}/#{id}")
15
+ cmd_to_call(word, 'versions', path: "/api/v2/#{word}?limit=999&offset=0")
15
16
  cmd_to_call(word, "rename #{id} newname",
16
17
  method: :put,
17
18
  path: "/api/v2/#{word}/#{id}",
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.require_paths = %w[lib]
24
24
 
25
25
  gem.add_runtime_dependency 'docopt', '~> 0.6.0'
26
- gem.add_runtime_dependency 'wavefront-sdk', '~> 2.0', '>= 2.0.1'
26
+ gem.add_runtime_dependency 'wavefront-sdk', '~> 2.0', '>= 2.0.3'
27
27
 
28
28
  gem.add_development_dependency 'bundler', '~> 1.3'
29
29
  gem.add_development_dependency 'minitest', '~> 5.11', '>= 5.11.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: 2.10.0
4
+ version: 2.11.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: 2018-10-22 00:00:00.000000000 Z
11
+ date: 2018-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '2.0'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 2.0.1
36
+ version: 2.0.3
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.0'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.1
46
+ version: 2.0.3
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement