brightbox-cli 2.11.1 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +53 -0
  4. data/Gemfile.lock +23 -19
  5. data/Jenkinsfile +7 -18
  6. data/Rakefile +2 -12
  7. data/brightbox-cli.gemspec +3 -3
  8. data/lib/brightbox-cli/api.rb +1 -1
  9. data/lib/brightbox-cli/cloud_ips.rb +1 -1
  10. data/lib/brightbox-cli/collaboration.rb +1 -1
  11. data/lib/brightbox-cli/commands/firewall/policies-update.rb +1 -1
  12. data/lib/brightbox-cli/commands/lbs/create.rb +5 -0
  13. data/lib/brightbox-cli/commands/lbs/show.rb +1 -0
  14. data/lib/brightbox-cli/commands/lbs/update.rb +7 -0
  15. data/lib/brightbox-cli/commands/token.rb +16 -1
  16. data/lib/brightbox-cli/load_balancers.rb +1 -0
  17. data/lib/brightbox-cli/version.rb +1 -1
  18. data/spec/commands/cloudips/update_spec.rb +65 -0
  19. data/spec/commands/lbs/create_spec.rb +31 -0
  20. data/spec/commands/lbs/update_spec.rb +32 -0
  21. data/spec/commands/sql/instances/create_spec.rb +26 -0
  22. data/spec/support/shared/collaborating_accounts_context.rb +3 -3
  23. data/spec/unit/brightbox/account/all_spec.rb +2 -2
  24. data/spec/unit/brightbox/account/get_spec.rb +2 -2
  25. data/spec/unit/brightbox/api/conn_spec.rb +1 -1
  26. data/spec/unit/brightbox/collaborating_account_spec.rb +1 -1
  27. data/spec/unit/brightbox/connection_manager/fetch_connection_spec.rb +1 -1
  28. data/spec/unit/brightbox/database_server/cloud_ips_spec.rb +1 -1
  29. data/spec/unit/brightbox/database_server/maintenance_window_spec.rb +1 -1
  30. data/spec/unit/brightbox/user_collaboration/get_for_account_spec.rb +1 -1
  31. data/spec/unit/brightbox/user_collaboration/remove_spec.rb +1 -1
  32. metadata +8 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ae61bb6692d3ca464e62b876cd95de2776807b395a359f7cf1f790173340fb3
4
- data.tar.gz: 13426b8f9d2063c4634aea8a1758394ff2e9860cd5d4db848666d5d056eecda1
3
+ metadata.gz: c00fe9b9159d0df304bc91413fe0110a76efda76cf0685af77a5cf49506b43fa
4
+ data.tar.gz: a6484bd3ac805cad060686e19434f0a962c28fad1c2676df2c745f1d940abd0f
5
5
  SHA512:
6
- metadata.gz: 8712275a21474e90fad2faee6b27cb7ce18ac36fc4b96af2fd3fd9261567fd7a11f58a122e6c5b5423420c2dc50c3178923c5ab3127f402b603d89d1cc59936c
7
- data.tar.gz: aeebdf7e4daa6fe5279e192bd62238dbc5222c57939f499e54169497774b343b6091989b2b367b9151e3139e9ebf725f4bf14d7f4a6ef133a438be4a7e6a4429
6
+ metadata.gz: fc691b5fabc3fb9191ec9e8518161d30ed2c8d88b2a291f83482f174be65aee5d1fe304dc2437e8fafc94cb5df5b18e9967d871704c6c24546d30b2b212bff61
7
+ data.tar.gz: ef35d51c5ff89422276886fbcd5a31c71131997433a06701e79bbc2c7f448ec203e5ada7887fa57370f1697aee79c89f11d155adc784e334e47ad6351ece5c32
@@ -2,7 +2,6 @@ language: ruby
2
2
  sudo: false
3
3
 
4
4
  rvm:
5
- - 1.9
6
5
  - 2.0
7
6
  - 2.1
8
7
  - 2.2
@@ -1,3 +1,56 @@
1
+ ### v3.1.0 / 2020-11-17
2
+
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v3.0.1...v3.1.0)
4
+
5
+ Changes:
6
+
7
+ * Update `fog-brightbox` to v1.2.0
8
+ * Add `lbs` option for `--min-ssl-ver` to specify the minimum TLS/SSL protocol
9
+ that should be acceptable for use with the load balancer
10
+
11
+ ### v3.0.1 / 2020-07-01
12
+
13
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v3.0.0...v3.0.1)
14
+
15
+ Bug fixes:
16
+
17
+ * Fix `cloudips update --name` to correctly set blank names
18
+
19
+ ### v3.0.0 / 2020-07-01
20
+
21
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.12.0...v3.0.0)
22
+
23
+ Backwards incompatible changes:
24
+
25
+ * Dropped support for Ruby 1.9
26
+
27
+ Changes:
28
+
29
+ * Update `fog-brightbox` to v1.1.0
30
+ * Update `rake` to v12.3.3 to resolve CVE-2020-8130
31
+ * Update `rspec` to v3.9 to avoid issue when updating `rake`
32
+
33
+ Bug fixes:
34
+
35
+ * Creating an SQL instance from an existing snapshot has been fixed following
36
+ the update for `fog-brightbox v1.1.0`
37
+
38
+ ### v2.12.0 / 2020-01-28
39
+
40
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.11.2...v2.12.0)
41
+
42
+ Enhancements:
43
+
44
+ * Adds `token create` to always attempt to reauthenticate and display a token.
45
+
46
+ ### v2.11.2 / 2020-01-07
47
+
48
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.11.1...v2.11.2)
49
+
50
+ Bug fixes:
51
+
52
+ * Update `excon` to v0.71.0 to fix security issue.
53
+
1
54
  ### v2.11.1 / 2019-10-29
2
55
 
3
56
  [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.11.0...v2.11.1)
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (2.11.1)
4
+ brightbox-cli (3.1.0)
5
5
  dry-inflector (< 0.2)
6
- fog-brightbox (>= 0.16.0, < 1.0)
6
+ fog-brightbox (>= 1.2.0)
7
7
  fog-core (< 2.0)
8
8
  gli (~> 2.12.0)
9
9
  highline (~> 1.6.0)
@@ -16,18 +16,17 @@ GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
18
  addressable (2.3.8)
19
- builder (3.2.3)
19
+ builder (3.2.4)
20
20
  coderay (1.0.9)
21
21
  crack (0.4.2)
22
22
  safe_yaml (~> 1.0.0)
23
- diff-lcs (1.2.5)
23
+ diff-lcs (1.4.3)
24
24
  dry-inflector (0.1.2)
25
- excon (0.62.0)
26
- fog-brightbox (0.16.1)
25
+ excon (0.78.0)
26
+ fog-brightbox (1.2.0)
27
27
  dry-inflector
28
- fog-core
28
+ fog-core (>= 1.45, < 3.0)
29
29
  fog-json
30
- mime-types
31
30
  fog-core (1.45.0)
32
31
  builder
33
32
  excon (~> 0.58)
@@ -53,15 +52,20 @@ GEM
53
52
  pry-remote (0.1.8)
54
53
  pry (~> 0.9)
55
54
  slop (~> 3.0)
56
- rake (10.1.0)
57
- rspec (2.99.0)
58
- rspec-core (~> 2.99.0)
59
- rspec-expectations (~> 2.99.0)
60
- rspec-mocks (~> 2.99.0)
61
- rspec-core (2.99.1)
62
- rspec-expectations (2.99.1)
63
- diff-lcs (>= 1.1.3, < 2.0)
64
- rspec-mocks (2.99.1)
55
+ rake (12.3.3)
56
+ rspec (3.9.0)
57
+ rspec-core (~> 3.9.0)
58
+ rspec-expectations (~> 3.9.0)
59
+ rspec-mocks (~> 3.9.0)
60
+ rspec-core (3.9.2)
61
+ rspec-support (~> 3.9.3)
62
+ rspec-expectations (3.9.2)
63
+ diff-lcs (>= 1.2.0, < 2.0)
64
+ rspec-support (~> 3.9.0)
65
+ rspec-mocks (3.9.1)
66
+ diff-lcs (>= 1.2.0, < 2.0)
67
+ rspec-support (~> 3.9.0)
68
+ rspec-support (3.9.3)
65
69
  safe_yaml (1.0.4)
66
70
  slop (3.4.5)
67
71
  vcr (2.5.0)
@@ -77,9 +81,9 @@ DEPENDENCIES
77
81
  mocha
78
82
  pry-remote
79
83
  rake
80
- rspec (~> 2.99)
84
+ rspec
81
85
  vcr (~> 2.5)
82
86
  webmock
83
87
 
84
88
  BUNDLED WITH
85
- 1.16.6
89
+ 1.17.3
@@ -9,17 +9,6 @@ pipeline {
9
9
  stages {
10
10
  stage("Run tests") {
11
11
  parallel {
12
- stage("Ruby 1.9.3") {
13
- agent {
14
- docker {
15
- image 'ruby:1.9.3'
16
- }
17
- }
18
- steps {
19
- sh 'BUNDLE_APP_CONFIG=/tmp/bundle.config BUNDLE_DISABLE_SHARED_GEMS=true bundle install --deployment'
20
- sh 'BUNDLE_APP_CONFIG=/tmp/bundle.config bundle exec rake test'
21
- }
22
- }
23
12
  stage("Ruby 2.0") {
24
13
  agent {
25
14
  docker {
@@ -28,7 +17,7 @@ pipeline {
28
17
  }
29
18
  steps {
30
19
  sh 'bundle install --deployment'
31
- sh 'bundle exec rake test'
20
+ sh 'bundle exec rake spec'
32
21
  }
33
22
  }
34
23
  stage("Ruby 2.1") {
@@ -39,7 +28,7 @@ pipeline {
39
28
  }
40
29
  steps {
41
30
  sh 'bundle install --deployment'
42
- sh 'bundle exec rake test'
31
+ sh 'bundle exec rake spec'
43
32
  }
44
33
  }
45
34
  stage("Ruby 2.2") {
@@ -50,7 +39,7 @@ pipeline {
50
39
  }
51
40
  steps {
52
41
  sh 'bundle install --deployment'
53
- sh 'bundle exec rake test'
42
+ sh 'bundle exec rake spec'
54
43
  }
55
44
  }
56
45
  stage("Ruby 2.3") {
@@ -61,7 +50,7 @@ pipeline {
61
50
  }
62
51
  steps {
63
52
  sh 'bundle install --deployment'
64
- sh 'bundle exec rake test'
53
+ sh 'bundle exec rake spec'
65
54
  }
66
55
  }
67
56
  stage("Ruby 2.4") {
@@ -72,7 +61,7 @@ pipeline {
72
61
  }
73
62
  steps {
74
63
  sh 'bundle install --deployment'
75
- sh 'bundle exec rake test'
64
+ sh 'bundle exec rake spec'
76
65
  }
77
66
  }
78
67
  stage("Ruby 2.5") {
@@ -83,7 +72,7 @@ pipeline {
83
72
  }
84
73
  steps {
85
74
  sh 'bundle install --deployment'
86
- sh 'bundle exec rake test'
75
+ sh 'bundle exec rake spec'
87
76
  }
88
77
  }
89
78
  stage("Ruby 2.6") {
@@ -94,7 +83,7 @@ pipeline {
94
83
  }
95
84
  steps {
96
85
  sh 'bundle install --deployment'
97
- sh 'bundle exec rake test'
86
+ sh 'bundle exec rake spec'
98
87
  }
99
88
  }
100
89
  }
data/Rakefile CHANGED
@@ -1,16 +1,6 @@
1
- require "bundler"
2
1
  require "rspec/core/rake_task"
3
2
 
4
- bbcloud_path = File.expand_path("./lib", File.dirname(__FILE__))
5
- $LOAD_PATH.unshift(bbcloud_path)
6
-
7
- task :default => [:test]
8
-
9
3
  Bundler::GemHelper.install_tasks
4
+ RSpec::Core::RakeTask.new(:spec)
10
5
 
11
- RSpec::Core::RakeTask.new
12
-
13
- desc "Runs all tests (rspec and cucumber)"
14
- task :test do
15
- Rake::Task["spec"].invoke
16
- end
6
+ task :default => :spec
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.description = %q(Scripts to interact with the Brightbox cloud API)
13
13
  s.license = "MIT"
14
14
 
15
- s.required_ruby_version = ">= 1.9.3"
15
+ s.required_ruby_version = ">= 2.0"
16
16
 
17
17
  s.rubyforge_project = "brightbox-cli"
18
18
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
22
22
  s.require_paths = ["lib"]
23
23
 
24
- s.add_dependency "fog-brightbox", ">= 0.16.0", "< 1.0"
24
+ s.add_dependency "fog-brightbox", ">= 1.2.0"
25
25
  s.add_dependency "fog-core", "< 2.0"
26
26
  s.add_dependency "gli", "~> 2.12.0"
27
27
  s.add_dependency "i18n", "~> 0.6.0"
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.add_development_dependency "mocha"
37
37
  s.add_development_dependency "pry-remote"
38
38
  s.add_development_dependency "rake"
39
- s.add_development_dependency "rspec", "~> 2.99"
39
+ s.add_development_dependency "rspec"
40
40
  s.add_development_dependency "vcr", "~> 2.5"
41
41
  s.add_development_dependency "webmock"
42
42
 
@@ -16,7 +16,7 @@ module Brightbox
16
16
  # Returns the current connection to the Brightbox API, creating a new
17
17
  # {ConnectionManager} and connection if necessary.
18
18
  #
19
- # @return [Fog::Compute::Brightbox::Real]
19
+ # @return [Fog::Brightbox::Compute::Real]
20
20
  #
21
21
  def self.conn
22
22
  if @@connection_manager
@@ -75,7 +75,7 @@ module Brightbox
75
75
  params[:reverse_dns] = ""
76
76
  end
77
77
 
78
- if options[:n] && !options[:name].empty?
78
+ if options[:n] && !options[:n].nil?
79
79
  params[:name] = options[:n]
80
80
  end
81
81
 
@@ -9,7 +9,7 @@ module Brightbox
9
9
  def self.invite(email, role)
10
10
  options = { :email => email, :role => role }
11
11
  data = conn.create_collaboration(options)
12
- model = Fog::Compute::Brightbox::Collaboration.new(data)
12
+ model = Fog::Brightbox::Compute::Collaboration.new(data)
13
13
  new(model)
14
14
  end
15
15
 
@@ -36,7 +36,7 @@ module Brightbox
36
36
  # with a request, before updating the model
37
37
  data = FirewallPolicy.conn.update_firewall_policy(policy_id, params)
38
38
 
39
- model = Fog::Compute::Brightbox::FirewallPolicy.new(data)
39
+ model = Fog::Brightbox::Compute::FirewallPolicy.new(data)
40
40
  policy = FirewallPolicy.new(model)
41
41
 
42
42
  render_table([policy], global_options)
@@ -52,6 +52,10 @@ module Brightbox
52
52
  c.desc "Filepath to the private key used to sign SSL certificate (OpenSSL supported formats)."
53
53
  c.flag ["ssl-key"]
54
54
 
55
+ c.desc "Sets the minimum version of TLS/SSL to support in the format 'TLSv1.x'"
56
+ c.default_value "TLSv1.2"
57
+ c.flag ["ssl-min-ver"]
58
+
55
59
  c.desc "Enable SSL v3 support"
56
60
  c.switch ["sslv3"]
57
61
 
@@ -118,6 +122,7 @@ module Brightbox
118
122
  :listeners => listeners,
119
123
  :certificate_pem => ssl_cert,
120
124
  :certificate_private_key => ssl_key,
125
+ :ssl_minimum_version => options["ssl-min-ver"],
121
126
  :sslv3 => options["sslv3"],
122
127
  :nodes => nodes)
123
128
  render_table([lb], global_options)
@@ -18,6 +18,7 @@ module Brightbox
18
18
  :created_at,
19
19
  :deleted_at,
20
20
  :policy,
21
+ :ssl_minimum_version,
21
22
  :ssl_issuer,
22
23
  :ssl_subject,
23
24
  :ssl_valid_from,
@@ -45,6 +45,9 @@ module Brightbox
45
45
  c.desc "Filepath to the private key used to sign SSL certificate (OpenSSL supported formats)."
46
46
  c.flag ["ssl-key"]
47
47
 
48
+ c.desc "Sets the minimum version of TLS/SSL to support in the format 'TLSv1.x'"
49
+ c.flag ["ssl-min-ver"]
50
+
48
51
  c.desc "Clears SSL details from the load balancer."
49
52
  c.switch ["remove-ssl"], :negatable => false
50
53
 
@@ -128,6 +131,10 @@ module Brightbox
128
131
  lbopts[:certificate_private_key] = ""
129
132
  end
130
133
 
134
+ if options["ssl-min-ver"]
135
+ lbopts[:ssl_minimum_version] = options["ssl-min-ver"] unless options["ssl-min-ver"].nil?
136
+ end
137
+
131
138
  lbopts.nilify_blanks
132
139
 
133
140
  lb = LoadBalancer.find lb_id
@@ -10,10 +10,25 @@ module Brightbox
10
10
  c.default_value "text"
11
11
  c.flag [:format]
12
12
 
13
- c.action do |global_options, options, args|
13
+ c.action do |_, options, _|
14
+ token = Token.show(Brightbox.config, options)
15
+ $stdout.puts token.format(options[:format] || "text")
16
+ end
17
+ end
18
+
19
+ cmd.desc "Create new OAuth2 Bearer token"
20
+ cmd.command [:create] do |c|
21
+ c.desc "Either 'text', 'token', 'json' or 'curl'"
22
+ c.arg_name "format"
23
+ c.default_value "text"
24
+ c.flag [:format]
25
+
26
+ c.action do |_, options, _|
27
+ config.reauthenticate
14
28
  token = Token.show(Brightbox.config, options)
15
29
  $stdout.puts token.format(options[:format])
16
30
  end
17
31
  end
32
+
18
33
  end
19
34
  end
@@ -12,6 +12,7 @@ module Brightbox
12
12
  def to_row
13
13
  attributes.merge(
14
14
  :locked => locked?,
15
+ :ssl_minimum_version => ssl_minimum_version,
15
16
  :ssl_issuer => certificate_issuer,
16
17
  :ssl_subject => certificate_subject,
17
18
  :ssl_valid_from => certificate_valid_from,
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "2.11.1" unless defined?(Brightbox::VERSION)
2
+ VERSION = "3.1.0" unless defined?(Brightbox::VERSION)
3
3
  end
@@ -7,6 +7,13 @@ describe "brightbox cloudips" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
+ before do
11
+ config_from_contents(USER_APP_CONFIG_CONTENTS)
12
+
13
+ stub_request(:post, "http://api.brightbox.dev/token").
14
+ to_return(status: 200, body: JSON.dump(access_token: "ACCESS-TOKEN", refresh_token: "REFRESH-TOKEN"))
15
+ end
16
+
10
17
  context "" do
11
18
  let(:argv) { %w(cloudips update) }
12
19
 
@@ -14,5 +21,63 @@ describe "brightbox cloudips" do
14
21
  expect { output }.to_not raise_error
15
22
  end
16
23
  end
24
+
25
+ context "when name is updated" do
26
+ let(:argv) { ["cloudips", "update", "--name=#{new_name}", "cip-12345"] }
27
+
28
+ let(:json_response) do
29
+ <<-EOS
30
+ {
31
+ "id":"cip-12345",
32
+ "name":"#{new_name}"
33
+ }
34
+ EOS
35
+ end
36
+
37
+ context "--name 'New name'" do
38
+ let(:new_name) { "New name" }
39
+ let(:expected_args) { ["cip-12345", { :name => new_name }] }
40
+
41
+ before do
42
+ stub_request(:put, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
43
+ .with(:headers => { "Content-Type" => "application/json" },
44
+ :body => hash_including("name" => "New name"))
45
+ .and_return(:status => 200, :body => json_response)
46
+
47
+ stub_request(:get, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
48
+ .with(:headers => { "Content-Type" => "application/json" })
49
+ .and_return(:status => 200, :body => json_response)
50
+ end
51
+
52
+ it "puts new name in update" do
53
+ expect(Brightbox::CloudIP.conn).to receive(:update_cloud_ip).with(*expected_args).and_call_original
54
+ expect(stderr).to eq("")
55
+ expect(stdout).to include("cip-12345")
56
+ expect(stdout).to include("New name")
57
+ end
58
+ end
59
+
60
+ context "--name ''" do
61
+ let(:new_name) { "" }
62
+ let(:expected_args) { ["cip-12345", { :name => "" }] }
63
+
64
+ before do
65
+ stub_request(:put, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
66
+ .with(:headers => { "Content-Type" => "application/json" },
67
+ :body => hash_including("name" => ""))
68
+ .and_return(:status => 200, :body => json_response)
69
+
70
+ stub_request(:get, "http://api.brightbox.dev/1.0/cloud_ips/cip-12345?account_id=acc-12345")
71
+ .with(:headers => { "Content-Type" => "application/json" })
72
+ .and_return(:status => 200, :body => json_response)
73
+ end
74
+
75
+ it "puts new name in update" do
76
+ expect(Brightbox::CloudIP.conn).to receive(:update_cloud_ip).with(*expected_args).and_call_original
77
+ expect(stderr).to eq("")
78
+ expect(stdout).to include("cip-12345")
79
+ end
80
+ end
81
+ end
17
82
  end
18
83
  end
@@ -7,6 +7,11 @@ describe "brightbox lbs" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
+ before do
11
+ config = config_from_contents(USER_APP_CONFIG_CONTENTS)
12
+ cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
13
+ end
14
+
10
15
  context "" do
11
16
  let(:argv) { %w(lbs create) }
12
17
 
@@ -14,5 +19,31 @@ describe "brightbox lbs" do
14
19
  expect { output }.to_not raise_error
15
20
  end
16
21
  end
22
+
23
+ context "--ssl-min-ver=TLSv1.0" do
24
+ let(:argv) { ["lbs", "create", "--ssl-min-ver", "TLSv1.0", "srv-12345"] }
25
+ let(:expected_args) { { ssl_minimum_version: "TLSv1.0" } }
26
+
27
+ let(:json_response) do
28
+ <<-EOS
29
+ {
30
+ "id":"lba-12345",
31
+ "ssl_minimum_version":"TLSv1.0"
32
+ }
33
+ EOS
34
+ end
35
+
36
+ before do
37
+ stub_request(:post, "http://api.brightbox.dev/1.0/load_balancers?account_id=acc-12345")
38
+ .with(:body => hash_including("ssl_minimum_version" => "TLSv1.0"))
39
+ .to_return(:status => 202, :body => json_response)
40
+ end
41
+
42
+ it "includes ssl_minimum_version in response" do
43
+ expect(Brightbox::LoadBalancer).to receive(:create).with(hash_including(expected_args)).and_call_original
44
+ expect(stderr).to eq("Creating a new load balancer\n")
45
+ expect(stdout).to include("lba-12345")
46
+ end
47
+ end
17
48
  end
18
49
  end
@@ -7,6 +7,11 @@ describe "brightbox lbs" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
+ before do
11
+ config = config_from_contents(USER_APP_CONFIG_CONTENTS)
12
+ cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
13
+ end
14
+
10
15
  context "" do
11
16
  let(:argv) { %w(lbs update) }
12
17
 
@@ -14,5 +19,32 @@ describe "brightbox lbs" do
14
19
  expect { output }.to_not raise_error
15
20
  end
16
21
  end
22
+
23
+ context "--ssl-min-ver=TLSv1.0" do
24
+ let(:argv) { ["lbs", "update", "--ssl-min-ver", "TLSv1.0", "lba-12345"] }
25
+
26
+ let(:json_response) do
27
+ <<-EOS
28
+ {
29
+ "id":"lba-12345",
30
+ "ssl_minimum_version":"TLSv1.0"
31
+ }
32
+ EOS
33
+ end
34
+
35
+ before do
36
+ stub_request(:get, "http://api.brightbox.dev/1.0/load_balancers/lba-12345?account_id=acc-12345")
37
+ .to_return(:status => 200, :body => '{"id":"lba-12345"}')
38
+
39
+ stub_request(:put, "http://api.brightbox.dev/1.0/load_balancers/lba-12345?account_id=acc-12345")
40
+ .with(:body => hash_including("ssl_minimum_version" => "TLSv1.0"))
41
+ .to_return(:status => 202, :body => json_response)
42
+ end
43
+
44
+ it "includes ssl_minimum_version in response" do
45
+ expect(stderr).to eq("Updating load balancer lba-12345\n")
46
+ expect(stdout).to include("lba-12345")
47
+ end
48
+ end
17
49
  end
18
50
  end
@@ -104,6 +104,32 @@ describe "brightbox sql instances" do
104
104
  end
105
105
  end
106
106
 
107
+ context "--snapshot=dbi-1493j" do
108
+ let(:argv) { ["sql", "instances", "create", "--snapshot=dbi-1493j"] }
109
+ let(:expected_args) { { :snapshot_id => "dbi-1493j" } }
110
+
111
+ let(:json_response) do
112
+ <<-EOS
113
+ {
114
+ "id":"dbs-12345"
115
+ }
116
+ EOS
117
+ end
118
+
119
+ before do
120
+ stub_request(:post, "http://api.brightbox.dev/1.0/database_servers?account_id=acc-12345")
121
+ .with(:headers => { "Content-Type" => "application/json" },
122
+ :body => hash_including("snapshot" => "dbi-1493j"))
123
+ .and_return(:status => 202, :body => json_response)
124
+ end
125
+
126
+ it "includes schedule fields in response" do
127
+ expect(Brightbox::DatabaseServer).to receive(:create).with(expected_args).and_call_original
128
+ expect(stdout).to include("id: dbs-12345")
129
+ expect(stderr).to eql("")
130
+ end
131
+ end
132
+
107
133
  context "--snapshots-schedule='0 12 * * 4'" do
108
134
  let(:argv) { ["sql", "instances", "create", "--snapshots-schedule=0 12 * * 4"] }
109
135
  let(:expected_args) { { :snapshots_schedule => "0 12 * * 4" } }
@@ -19,7 +19,7 @@ shared_context "collaborating accounts" do
19
19
  "load_balancers_limit" => 5,
20
20
  "load_balancers_used" => 0
21
21
  }
22
- Fog::Compute::Brightbox::Account.new(data)
22
+ Fog::Brightbox::Compute::Account.new(data)
23
23
  end
24
24
 
25
25
  # As returned from conn.user_collaborations.all
@@ -35,7 +35,7 @@ shared_context "collaborating accounts" do
35
35
  "status" => "active"
36
36
  }
37
37
  }
38
- Fog::Compute::Brightbox::UserCollaboration.new(data)
38
+ Fog::Brightbox::Compute::UserCollaboration.new(data)
39
39
  end
40
40
 
41
41
  # As returned from conn.user_collaborations.all
@@ -51,6 +51,6 @@ shared_context "collaborating accounts" do
51
51
  "status" => "active"
52
52
  }
53
53
  }
54
- Fog::Compute::Brightbox::UserCollaboration.new(data)
54
+ Fog::Brightbox::Compute::UserCollaboration.new(data)
55
55
  end
56
56
  end
@@ -13,7 +13,7 @@ describe Brightbox::Account do
13
13
  expect(Brightbox::Account.all).to be_kind_of(Array)
14
14
 
15
15
  Brightbox::Account.all.each do |account|
16
- expect(account).to be_kind_of(Fog::Compute::Brightbox::Account)
16
+ expect(account).to be_kind_of(Fog::Brightbox::Compute::Account)
17
17
  end
18
18
  end
19
19
 
@@ -31,7 +31,7 @@ describe Brightbox::Account do
31
31
  expect(Brightbox::Account.all).to be_kind_of(Array)
32
32
 
33
33
  Brightbox::Account.all.each do |account|
34
- expect(account).to be_kind_of(Fog::Compute::Brightbox::Account)
34
+ expect(account).to be_kind_of(Fog::Brightbox::Compute::Account)
35
35
  end
36
36
  end
37
37
 
@@ -18,7 +18,7 @@ describe Brightbox::Account do
18
18
  end
19
19
 
20
20
  it "returns requested account" do
21
- expect(@account).to be_kind_of(Fog::Compute::Brightbox::Account)
21
+ expect(@account).to be_kind_of(Fog::Brightbox::Compute::Account)
22
22
  expect(@account.id).to eql(@account_id)
23
23
  end
24
24
 
@@ -46,7 +46,7 @@ describe Brightbox::Account do
46
46
  end
47
47
 
48
48
  it "returns the client's owning account" do
49
- expect(@account).to be_kind_of(Fog::Compute::Brightbox::Account)
49
+ expect(@account).to be_kind_of(Fog::Brightbox::Compute::Account)
50
50
  expect(@account.id).to eql(@account_id)
51
51
  end
52
52
 
@@ -7,7 +7,7 @@ describe Brightbox::Api, ".conn" do
7
7
 
8
8
  context "when account is not required", vcr: true do
9
9
  it "returns a 'real' fog compute instance" do
10
- expect(Brightbox::Api.conn).to be_instance_of(Fog::Compute::Brightbox::Real)
10
+ expect(Brightbox::Api.conn).to be_instance_of(Fog::Brightbox::Compute::Real)
11
11
  end
12
12
  end
13
13
  end
@@ -5,7 +5,7 @@ describe Brightbox::CollaboratingAccount do
5
5
  data = {
6
6
  "id" => "acc-12345"
7
7
  }
8
- account_model = Fog::Compute::Brightbox::Account.new(data)
8
+ account_model = Fog::Brightbox::Compute::Account.new(data)
9
9
  Brightbox::CollaboratingAccount.new(account_model)
10
10
  end
11
11
 
@@ -19,7 +19,7 @@ describe Brightbox::ConnectionManager, "#fetch_connection" do
19
19
 
20
20
  context "when not requesting a scoped connection" do
21
21
  it "returns a fog compute instance" do
22
- expect(connection_manager.fetch_connection(false)).to be_kind_of(Fog::Compute::Brightbox::Real)
22
+ expect(connection_manager.fetch_connection(false)).to be_kind_of(Fog::Brightbox::Compute::Real)
23
23
  end
24
24
 
25
25
  it "returns a connection without account scope" do
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "fog/brightbox/models/compute/database_server"
3
3
 
4
4
  describe Brightbox::DatabaseServer, "#cloud_ips" do
5
- let(:fog_model) { Fog::Compute::Brightbox::DatabaseServer.new(fog_settings) }
5
+ let(:fog_model) { Fog::Brightbox::Compute::DatabaseServer.new(fog_settings) }
6
6
  let(:dbs) { described_class.new(fog_model) }
7
7
 
8
8
  context "when attribute is missing" do
@@ -4,7 +4,7 @@ require "fog/brightbox/models/compute/database_server"
4
4
  describe Brightbox::DatabaseServer do
5
5
 
6
6
  describe "#maintenance_window" do
7
- let(:fog_model) { Fog::Compute::Brightbox::DatabaseServer.new(fog_settings) }
7
+ let(:fog_model) { Fog::Brightbox::Compute::DatabaseServer.new(fog_settings) }
8
8
  let(:dbs) { Brightbox::DatabaseServer.new(fog_model) }
9
9
 
10
10
  context "when default values" do
@@ -141,7 +141,7 @@ describe Brightbox::UserCollaboration do
141
141
  # Collection#load is private in fog so we can't just pass our collection
142
142
  # into get the correct object initialised.
143
143
  api_response_data.map do |datum|
144
- Fog::Compute::Brightbox::UserCollaboration.new(datum)
144
+ Fog::Brightbox::Compute::UserCollaboration.new(datum)
145
145
  end
146
146
  end
147
147
  end
@@ -52,6 +52,6 @@ describe Brightbox::UserCollaboration do
52
52
  "email_address" => "marie@example.com"
53
53
  }
54
54
  }
55
- Fog::Compute::Brightbox::UserCollaboration.new(api_response_data)
55
+ Fog::Brightbox::Compute::UserCollaboration.new(api_response_data)
56
56
  end
57
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '1.0'
19
+ version: 1.2.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 0.16.0
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '1.0'
26
+ version: 1.2.0
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: fog-core
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -188,16 +182,16 @@ dependencies:
188
182
  name: rspec
189
183
  requirement: !ruby/object:Gem::Requirement
190
184
  requirements:
191
- - - "~>"
185
+ - - ">="
192
186
  - !ruby/object:Gem::Version
193
- version: '2.99'
187
+ version: '0'
194
188
  type: :development
195
189
  prerelease: false
196
190
  version_requirements: !ruby/object:Gem::Requirement
197
191
  requirements:
198
- - - "~>"
192
+ - - ">="
199
193
  - !ruby/object:Gem::Version
200
- version: '2.99'
194
+ version: '0'
201
195
  - !ruby/object:Gem::Dependency
202
196
  name: vcr
203
197
  requirement: !ruby/object:Gem::Requirement
@@ -763,7 +757,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
763
757
  requirements:
764
758
  - - ">="
765
759
  - !ruby/object:Gem::Version
766
- version: 1.9.3
760
+ version: '2.0'
767
761
  required_rubygems_version: !ruby/object:Gem::Requirement
768
762
  requirements:
769
763
  - - ">="