brightbox-cli 5.0.0.alpha → 5.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -1
- data/CHANGELOG.md +63 -0
- data/Gemfile.lock +1 -1
- data/lib/brightbox-cli/accounts.rb +5 -1
- data/lib/brightbox-cli/api.rb +34 -1
- data/lib/brightbox-cli/cloud_ips.rb +6 -6
- data/lib/brightbox-cli/collaboration.rb +3 -7
- data/lib/brightbox-cli/commands/images/show.rb +5 -1
- data/lib/brightbox-cli/commands/lbs/create.rb +0 -2
- data/lib/brightbox-cli/commands/lbs/show.rb +9 -1
- data/lib/brightbox-cli/commands/servers/show.rb +5 -1
- data/lib/brightbox-cli/commands/users/show.rb +5 -1
- data/lib/brightbox-cli/commands/volumes/show.rb +5 -1
- data/lib/brightbox-cli/config.rb +10 -4
- data/lib/brightbox-cli/database_server.rb +20 -20
- data/lib/brightbox-cli/database_snapshot.rb +5 -5
- data/lib/brightbox-cli/database_type.rb +4 -8
- data/lib/brightbox-cli/detailed_server.rb +26 -28
- data/lib/brightbox-cli/detailed_server_group.rb +2 -2
- data/lib/brightbox-cli/firewall_policy.rb +5 -9
- data/lib/brightbox-cli/firewall_rule.rb +14 -15
- data/lib/brightbox-cli/images.rb +22 -21
- data/lib/brightbox-cli/indifferent_access_hash.rb +50 -0
- data/lib/brightbox-cli/load_balancers.rb +27 -11
- data/lib/brightbox-cli/server_groups.rb +4 -8
- data/lib/brightbox-cli/servers.rb +22 -16
- data/lib/brightbox-cli/types.rb +4 -8
- data/lib/brightbox-cli/user_collaboration.rb +1 -1
- data/lib/brightbox-cli/users.rb +3 -5
- data/lib/brightbox-cli/version.rb +1 -1
- data/lib/brightbox-cli/volume.rb +9 -13
- data/lib/brightbox-cli/zones.rb +0 -4
- data/lib/brightbox_cli.rb +1 -0
- data/spec/commands/cloudips/update_spec.rb +7 -5
- data/spec/commands/configmaps/create_spec.rb +6 -6
- data/spec/commands/configmaps/destroy_spec.rb +1 -1
- data/spec/commands/configmaps/list_spec.rb +1 -1
- data/spec/commands/configmaps/show_spec.rb +3 -3
- data/spec/commands/configmaps/update_spec.rb +9 -9
- data/spec/commands/images/show_spec.rb +49 -19
- data/spec/commands/lbs/create_spec.rb +12 -26
- data/spec/commands/lbs/show_spec.rb +120 -22
- data/spec/commands/lbs/update_spec.rb +4 -4
- data/spec/commands/servers/show_spec.rb +83 -1
- data/spec/commands/servers/update_spec.rb +7 -7
- data/spec/commands/sql/instances/create_spec.rb +8 -8
- data/spec/commands/sql/instances/reset_spec.rb +3 -3
- data/spec/commands/sql/instances/resize_spec.rb +4 -4
- data/spec/commands/sql/instances/show_spec.rb +2 -1
- data/spec/commands/sql/instances/update_spec.rb +3 -3
- data/spec/commands/sql/snapshots/list_spec.rb +1 -1
- data/spec/commands/sql/snapshots/show_spec.rb +50 -7
- data/spec/commands/users/show_spec.rb +66 -1
- data/spec/commands/volumes/attach_spec.rb +4 -4
- data/spec/commands/volumes/copy_spec.rb +2 -2
- data/spec/commands/volumes/destroy_spec.rb +1 -1
- data/spec/commands/volumes/detach_spec.rb +1 -1
- data/spec/commands/volumes/list_spec.rb +1 -1
- data/spec/commands/volumes/resize_spec.rb +3 -3
- data/spec/commands/volumes/show_spec.rb +54 -25
- data/spec/commands/volumes/update_spec.rb +4 -4
- data/spec/spec_helper.rb +14 -10
- data/spec/support/shared/api_resource_examples.rb +25 -0
- data/spec/unit/brightbox/account/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/api/attributes_spec.rb +65 -0
- data/spec/unit/brightbox/api/fog_attributes_spec.rb +65 -0
- data/spec/unit/brightbox/cloud_ip/attributes_spec.rb +19 -0
- data/spec/unit/brightbox/collaborating_account/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_server/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_snapshot/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_type/attributes_spec.rb +20 -0
- data/spec/unit/brightbox/detailed_server/attributes_spec.rb +29 -0
- data/spec/unit/brightbox/detailed_server_group/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/firewall_policy/attributes_spec.rb +21 -0
- data/spec/unit/brightbox/firewall_rule/attributes_spec.rb +18 -0
- data/spec/unit/brightbox/image/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/image/status_spec.rb +67 -0
- data/spec/unit/brightbox/load_balancer/acme_cert_spec.rb +75 -0
- data/spec/unit/brightbox/load_balancer/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/load_balancer/formatted_acme_domains_spec.rb +78 -0
- data/spec/unit/brightbox/server/attributes_spec.rb +29 -0
- data/spec/unit/brightbox/server_group/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/type/attributes_spec.rb +20 -0
- data/spec/unit/brightbox/user/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/user_collaboration/attributes_spec.rb +13 -0
- metadata +50 -10
- data/spec/cassettes/brightbox_sql_snapshots/show/when_resource_exists/does_not_output_to_stderr.yml +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eb6588f842b8e2bb0a2b48e1a1eece122697726faa67032b43a868f273b49cd
|
4
|
+
data.tar.gz: 41e2cd7ac07f8423f5a401196710c26befa93e50740248a0d8f430a16c67ec8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6c6997a8f17a14293c46bc07b040b1d3b07fb3409e3fc60fe02b577e8f5cdf1bfde2fa5d5eb6ae526c680e558b114c28908c3d6614b8efa775a866e201830f3
|
7
|
+
data.tar.gz: 912baa8d1adba3c050bfc5d0f0fc69cf69621d5c28da4d063dfe4a6751e42c54d5b36dec2c017286579c745b3b9ce53bff8354f30081911bc0539e923eb3ece4
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,66 @@
|
|
1
|
+
### v5.0.0.rc1 / 2024-12-20
|
2
|
+
|
3
|
+
[Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.8.0...v5.0.0.rc1)
|
4
|
+
|
5
|
+
Backwards incompatible changes:
|
6
|
+
|
7
|
+
* Drop support for Ruby versions older than 2.7
|
8
|
+
* Update `Gemfile.lock` to use Bundler 2.4.22
|
9
|
+
* When ENV `HOME` is not set, the working directory is used for configs
|
10
|
+
rather than `/.brightbox` to fix issues with containers
|
11
|
+
* `show` commands require at least one argument to
|
12
|
+
prevent an issue where the wrong, summary API was
|
13
|
+
used resulting in missing data in tables
|
14
|
+
|
15
|
+
Enhancements:
|
16
|
+
|
17
|
+
* Added support for ACME certificates
|
18
|
+
* `brightbox lbs create` and `update` accepts `--acme-domains` with CSV
|
19
|
+
domains to request them to be setup on the load balancer
|
20
|
+
* `brightbox lbs show` outputs ACME related fields
|
21
|
+
* `acme_domains` - domains requested to be present
|
22
|
+
* `acme_cert_expires` - when the ACME certificate in no longer valid
|
23
|
+
* `acme_cert_fingerprint` - the fingerprint of the ACME certificate
|
24
|
+
* `acme_cert_issued_at` - when the ACME certificate was issued
|
25
|
+
* `acme_cert_subjects` - domain present on ACME certificate
|
26
|
+
* `brightbox firewall-policy` is now an alias for `firewall-policies`
|
27
|
+
|
28
|
+
Changes:
|
29
|
+
|
30
|
+
* `brightbox images` will now report an deprecated and private image as
|
31
|
+
"private" rather than "deprecated"
|
32
|
+
* Update `fog-brightbox` to `v1.12.0`
|
33
|
+
* Numerous dependency gems updated
|
34
|
+
* Expanded debugging output
|
35
|
+
* `Brightbox::Api#attributes` attempts to transform and make attributes
|
36
|
+
indifferent to String or Symbol keys as that has introduced numerous
|
37
|
+
issues over the years. Fog only converts the top level of keys from
|
38
|
+
Strings to Symbols resulting in mismatched keys throughout
|
39
|
+
* Refactored all models `#attributes` and `#to_row` methods to use the
|
40
|
+
above with more involved testing
|
41
|
+
|
42
|
+
Bug fixes:
|
43
|
+
|
44
|
+
* `brightbox lbs create` no longer requires at least one node to balance
|
45
|
+
which was outdated client side validation long removed from the API
|
46
|
+
* `brightbox lbs create` should now recognise the `--buffer-size` option
|
47
|
+
* `brightbox lbs update` converts `buffer-size` to integer before sending
|
48
|
+
* `brightbox cloudips unmap` incorrectly used the "map" description in
|
49
|
+
the help output. This is now fixed
|
50
|
+
|
51
|
+
Testing:
|
52
|
+
|
53
|
+
* Update CI testing matrix from Ruby 2.7 up to 3.3
|
54
|
+
* Ensure bundler version declared in `Gemfile.lock` is used by CI tests
|
55
|
+
* CI setting completes all builds rather than cancelling on one fail
|
56
|
+
* CI testing includes `DEBUG` ENV settings
|
57
|
+
* Tests updated to not "fail" when `DEBUG` output is included upsetting
|
58
|
+
matches to expected output in numerous cases
|
59
|
+
* Simplecov has been introduced and configured to prevent a drop in
|
60
|
+
test coverage.
|
61
|
+
* Temporary testing config directories are removed explicitly to prevent
|
62
|
+
config bleeding in some test scenarios
|
63
|
+
|
1
64
|
### v4.8.0 / 2024-10-23
|
2
65
|
|
3
66
|
[Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.7.0...v4.8.0)
|
data/Gemfile.lock
CHANGED
@@ -13,7 +13,11 @@ module Brightbox
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def to_row
|
16
|
-
attributes.merge(
|
16
|
+
attributes.to_h.merge(
|
17
|
+
:ram_free => ram_free,
|
18
|
+
:cloud_ip_limit => cloud_ip_limit,
|
19
|
+
:lb_limit => lb_limit
|
20
|
+
)
|
17
21
|
end
|
18
22
|
|
19
23
|
def self.all
|
data/lib/brightbox-cli/api.rb
CHANGED
@@ -52,6 +52,16 @@ module Brightbox
|
|
52
52
|
Brightbox.config.cache_id(@id) if Brightbox.config.respond_to?(:cache_id)
|
53
53
|
end
|
54
54
|
|
55
|
+
def attributes
|
56
|
+
fog_attributes
|
57
|
+
end
|
58
|
+
|
59
|
+
# Returns the transformed attributes from the fog model with a
|
60
|
+
# wrapper to allow access using either String or Symbol keys.
|
61
|
+
def fog_attributes
|
62
|
+
IndifferentAccessHash.new(deep_symbolize(fog_model.attributes))
|
63
|
+
end
|
64
|
+
|
55
65
|
def fog_model
|
56
66
|
@fog_model ||= self.class.find(@id)
|
57
67
|
end
|
@@ -62,6 +72,10 @@ module Brightbox
|
|
62
72
|
false
|
63
73
|
end
|
64
74
|
|
75
|
+
def to_row
|
76
|
+
attributes.to_h
|
77
|
+
end
|
78
|
+
|
65
79
|
def to_s
|
66
80
|
@id
|
67
81
|
end
|
@@ -165,7 +179,7 @@ module Brightbox
|
|
165
179
|
if value
|
166
180
|
value
|
167
181
|
else
|
168
|
-
Brightbox.config.cache_id id
|
182
|
+
Brightbox.config.cache_id id if Brightbox.config.respond_to?(:cache_id)
|
169
183
|
@cache[id] = get(id)
|
170
184
|
end
|
171
185
|
end
|
@@ -192,5 +206,24 @@ module Brightbox
|
|
192
206
|
|
193
207
|
fog_model.created_at.strftime("%Y-%m-%d")
|
194
208
|
end
|
209
|
+
|
210
|
+
private
|
211
|
+
|
212
|
+
# Recursively converts all keys in a hash to symbols to ensure
|
213
|
+
# consistent access.
|
214
|
+
def deep_symbolize(hash)
|
215
|
+
return hash unless hash.respond_to?(:each_with_object)
|
216
|
+
|
217
|
+
hash.each_with_object({}) do |(k, v), result|
|
218
|
+
result[k.to_sym] = case v
|
219
|
+
when Hash
|
220
|
+
deep_symbolize(v)
|
221
|
+
when Array
|
222
|
+
v.map { |i| i.is_a?(Hash) ? deep_symbolize(i) : i }
|
223
|
+
else
|
224
|
+
v
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
195
228
|
end
|
196
229
|
end
|
@@ -33,15 +33,15 @@ module Brightbox
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def attributes
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
fog_attributes.tap do |attrs|
|
37
|
+
attrs[:destination] = destination_id
|
38
|
+
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def to_row
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
attributes.merge(
|
43
|
+
port_translators: translators(attributes),
|
44
|
+
).to_h
|
45
45
|
end
|
46
46
|
|
47
47
|
def mapped?
|
@@ -31,14 +31,10 @@ module Brightbox
|
|
31
31
|
|
32
32
|
attr_reader :id
|
33
33
|
|
34
|
-
def attributes
|
35
|
-
fog_model.attributes
|
36
|
-
end
|
37
|
-
|
38
34
|
def to_row
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
attributes.merge(
|
36
|
+
name: invitee_name
|
37
|
+
).to_h
|
42
38
|
end
|
43
39
|
|
44
40
|
def invitee_name
|
@@ -4,7 +4,11 @@ module Brightbox
|
|
4
4
|
cmd.arg_name "image-id..."
|
5
5
|
cmd.command [:show] do |c|
|
6
6
|
c.action do |global_options, _options, args|
|
7
|
-
|
7
|
+
raise "You must specify image IDs to show" if args.empty?
|
8
|
+
|
9
|
+
images = Image.find_or_call(args) do |id|
|
10
|
+
raise "Couldn't find an image with ID #{id}"
|
11
|
+
end
|
8
12
|
|
9
13
|
display_options = {
|
10
14
|
:vertical => true,
|
@@ -61,8 +61,6 @@ module Brightbox
|
|
61
61
|
c.switch ["sslv3"]
|
62
62
|
|
63
63
|
c.action do |global_options, options, args|
|
64
|
-
raise "You must specify which servers to balance connections to" if args.empty?
|
65
|
-
|
66
64
|
listeners = options[:l].split(",").map do |l|
|
67
65
|
inport, outport, protocol, timeout = l.split ":"
|
68
66
|
raise "listener '#{l}' is invalid" if inport.nil? || outport.nil? || protocol.nil?
|
@@ -4,7 +4,11 @@ module Brightbox
|
|
4
4
|
cmd.arg_name "lbs-id..."
|
5
5
|
cmd.command [:show] do |c|
|
6
6
|
c.action do |global_options, _options, args|
|
7
|
-
|
7
|
+
raise "You must specify load balancer IDs to show" if args.empty?
|
8
|
+
|
9
|
+
lbs = LoadBalancer.find_or_call(args) do |id|
|
10
|
+
raise "Couldn't find a load balancer with ID #{id}"
|
11
|
+
end
|
8
12
|
|
9
13
|
table_opts = global_options.merge(
|
10
14
|
:vertical => true,
|
@@ -17,6 +21,10 @@ module Brightbox
|
|
17
21
|
deleted_at
|
18
22
|
policy
|
19
23
|
acme_domains
|
24
|
+
acme_cert_subjects
|
25
|
+
acme_cert_fingerprint
|
26
|
+
acme_cert_expires_at
|
27
|
+
acme_cert_issued_at
|
20
28
|
ssl_minimum_version
|
21
29
|
ssl_issuer
|
22
30
|
ssl_subject
|
@@ -4,7 +4,11 @@ module Brightbox
|
|
4
4
|
cmd.arg_name "server-id..."
|
5
5
|
cmd.command [:show] do |c|
|
6
6
|
c.action do |global_options, _options, args|
|
7
|
-
|
7
|
+
raise "You must specify server IDs to show" if args.empty?
|
8
|
+
|
9
|
+
servers = DetailedServer.find_or_call(args) do |id|
|
10
|
+
raise "Couldn't find a server with ID #{id}"
|
11
|
+
end
|
8
12
|
|
9
13
|
table_opts = global_options.merge(:vertical => true)
|
10
14
|
render_table(servers, table_opts)
|
@@ -4,7 +4,11 @@ module Brightbox
|
|
4
4
|
cmd.arg_name "user-id..."
|
5
5
|
cmd.command [:show] do |c|
|
6
6
|
c.action do |global_options, _options, args|
|
7
|
-
|
7
|
+
raise "You must specify user IDs to show" if args.empty?
|
8
|
+
|
9
|
+
users = User.find_or_call(args) do |id|
|
10
|
+
raise "Couldn't find a user with ID #{id}"
|
11
|
+
end
|
8
12
|
|
9
13
|
table_opts = global_options.merge(
|
10
14
|
:vertical => true,
|
@@ -5,7 +5,11 @@ module Brightbox
|
|
5
5
|
|
6
6
|
cmd.command [:show] do |c|
|
7
7
|
c.action do |global_options, _options, args|
|
8
|
-
|
8
|
+
raise "You must specify volume IDs to show" if args.empty?
|
9
|
+
|
10
|
+
volumes = Volume.find_or_call(args) do |id|
|
11
|
+
raise "Couldn't find a volume with ID #{id}"
|
12
|
+
end
|
9
13
|
|
10
14
|
table_opts = global_options.merge(
|
11
15
|
:vertical => true,
|
data/lib/brightbox-cli/config.rb
CHANGED
@@ -91,11 +91,17 @@ module Brightbox
|
|
91
91
|
def debug_tokens
|
92
92
|
return unless ENV["DEBUG"]
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
94
|
+
if client_name
|
95
|
+
debug "Client: #{client_name}"
|
96
|
+
|
97
|
+
debug "Access token: #{access_token} (#{cached_access_token})"
|
98
|
+
if using_application?
|
99
|
+
debug "Refresh token: #{refresh_token} (#{cached_refresh_token}))"
|
100
|
+
else
|
101
|
+
debug "Refresh token: <NOT EXPECTED FOR CLIENT>"
|
102
|
+
end
|
97
103
|
else
|
98
|
-
debug "
|
104
|
+
debug "No client selected"
|
99
105
|
end
|
100
106
|
end
|
101
107
|
|
@@ -70,34 +70,34 @@ module Brightbox
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def type_identifier
|
73
|
-
return unless
|
73
|
+
return unless fog_attributes.key?("database_server_type")
|
74
74
|
|
75
|
-
|
75
|
+
fog_attributes["database_server_type"]["id"]
|
76
76
|
end
|
77
77
|
|
78
78
|
def zone_handle
|
79
|
-
return unless
|
79
|
+
return unless fog_attributes.key?("zone")
|
80
80
|
|
81
|
-
|
81
|
+
fog_attributes["zone"]["handle"]
|
82
82
|
end
|
83
83
|
|
84
84
|
def to_row
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
85
|
+
attributes.merge(
|
86
|
+
status: fog_model.state,
|
87
|
+
locked: locked?,
|
88
|
+
type: type_identifier,
|
89
|
+
db_engine: engine_version,
|
90
|
+
engine: database_engine,
|
91
|
+
version: database_version,
|
92
|
+
maintenance_weekday: maintenance_weekday,
|
93
|
+
maintenance_hour: maintenance_hour,
|
94
|
+
maintenance_window: maintenance_window,
|
95
|
+
zone: zone_handle,
|
96
|
+
created_on: created_on,
|
97
|
+
allow_access: allow_access,
|
98
|
+
cloud_ip_ids: cloud_ip_ids,
|
99
|
+
cloud_ips: cloud_ip_addresses
|
100
|
+
)
|
101
101
|
end
|
102
102
|
|
103
103
|
def engine_version
|
@@ -27,11 +27,11 @@ module Brightbox
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def to_row
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
fog_attributes.merge(
|
31
|
+
status: fog_model.state,
|
32
|
+
locked: locked?,
|
33
|
+
created_on: fog_model.created_at.strftime("%Y-%m-%d")
|
34
|
+
)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -3,10 +3,10 @@ module Brightbox
|
|
3
3
|
def self.require_account?; true; end
|
4
4
|
|
5
5
|
def attributes
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
fog_attributes.tap do |attrs|
|
7
|
+
attrs[:ram] = ram
|
8
|
+
attrs[:disk] = disk
|
9
|
+
end
|
10
10
|
end
|
11
11
|
|
12
12
|
def ram
|
@@ -17,10 +17,6 @@ module Brightbox
|
|
17
17
|
fog_model.disk.to_i
|
18
18
|
end
|
19
19
|
|
20
|
-
def to_row
|
21
|
-
attributes
|
22
|
-
end
|
23
|
-
|
24
20
|
def self.all
|
25
21
|
conn.database_types
|
26
22
|
end
|
@@ -1,40 +1,38 @@
|
|
1
1
|
module Brightbox
|
2
2
|
class DetailedServer < Server
|
3
3
|
def to_row
|
4
|
-
|
4
|
+
attributes.tap do |attrs|
|
5
|
+
attrs[:compatibility_mode] = attrs["compatibility_mode"]
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
row_attributes[:disk] = server_type["disk_size"].to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
if image
|
18
|
-
row_attributes[:image_name] = image.name
|
19
|
-
row_attributes[:arch] = image.arch
|
20
|
-
row_attributes[:image_username] = image.username
|
21
|
-
end
|
7
|
+
if server_type
|
8
|
+
attrs[:type] = server_type["id"]
|
9
|
+
attrs[:type_handle] = server_type["handle"]
|
10
|
+
attrs[:type_name] = server_type["name"]
|
11
|
+
attrs[:ram] = server_type["ram"]
|
12
|
+
attrs[:cores] = server_type["cores"]
|
13
|
+
attrs[:disk] = server_type["disk_size"].to_i
|
14
|
+
end
|
22
15
|
|
23
|
-
|
24
|
-
|
16
|
+
if image
|
17
|
+
attrs[:image_name] = image.name
|
18
|
+
attrs[:arch] = image.arch
|
19
|
+
attrs[:image_username] = image.username
|
20
|
+
end
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
row_attributes[:cloud_ipv6s] = cloud_ips.map { |i| i["public_ipv6"] }.join(", ")
|
29
|
-
row_attributes[:snapshots] = snapshots.map { |i| i["id"] }.join(", ")
|
22
|
+
attrs[:private_ips] = interfaces.map { |i| i["ipv4_address"] }.join(", ")
|
23
|
+
attrs[:ipv6_address] = interfaces.map { |i| i["ipv6_address"] }.join(", ")
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
attrs[:cloud_ip_ids] = cloud_ips.map { |i| i["id"] }.join(", ")
|
26
|
+
attrs[:cloud_ipv4s] = cloud_ips.map { |i| i["public_ipv4"] }.join(", ")
|
27
|
+
attrs[:cloud_ipv6s] = cloud_ips.map { |i| i["public_ipv6"] }.join(", ")
|
28
|
+
attrs[:snapshots] = snapshots.map { |i| i["id"] }.join(", ")
|
34
29
|
|
35
|
-
|
30
|
+
if server_groups
|
31
|
+
attrs[:server_groups] = server_groups.map { |sg| sg["id"] }.join(", ")
|
32
|
+
end
|
36
33
|
|
37
|
-
|
34
|
+
attrs[:volumes] = volume_ids if volumes
|
35
|
+
end.to_h
|
38
36
|
end
|
39
37
|
|
40
38
|
def volume_ids
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Brightbox
|
2
2
|
class DetailedServerGroup < ServerGroup
|
3
3
|
def to_row
|
4
|
-
row_attributes =
|
4
|
+
row_attributes = attributes
|
5
5
|
row_attributes[:firewall_policy] = firewall_policy && firewall_policy.id
|
6
|
-
row_attributes
|
6
|
+
row_attributes.to_h
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.default_field_order
|
@@ -15,15 +15,11 @@ module Brightbox
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def attributes
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_row
|
26
|
-
attributes
|
18
|
+
fog_attributes.tap do |attrs|
|
19
|
+
attrs[:name] = name
|
20
|
+
attrs[:description] = description
|
21
|
+
attrs[:server_group] = server_group_id
|
22
|
+
end
|
27
23
|
end
|
28
24
|
|
29
25
|
def self.default_field_order
|
@@ -19,24 +19,23 @@ module Brightbox
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def attributes
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
t
|
28
|
-
end
|
29
|
-
|
30
|
-
def to_row
|
31
|
-
attrs = attributes.dup
|
32
|
-
%i[protocol source sport destination dport icmp_type].each do |key|
|
33
|
-
attrs[key] = attributes[key] || "-"
|
22
|
+
(@attributes || fog_attributes).tap do |attrs|
|
23
|
+
attrs[:sport] = attrs[:source_port]
|
24
|
+
attrs[:dport] = attrs[:destination_port]
|
25
|
+
attrs[:firewall_policy] = attrs[:firewall_policy_id]
|
26
|
+
attrs[:icmp_type] = attrs[:icmp_type_name]
|
34
27
|
end
|
35
|
-
attrs
|
36
28
|
end
|
37
29
|
|
38
|
-
def
|
39
|
-
attributes
|
30
|
+
def to_row
|
31
|
+
attributes.merge(
|
32
|
+
protocol: attributes[:protocol] || "-",
|
33
|
+
source: attributes[:source] || "-",
|
34
|
+
sport: attributes[:sport] || "-",
|
35
|
+
destination: attributes[:destination] || "-",
|
36
|
+
dport: attributes[:dport] || "-",
|
37
|
+
icmp_type: attributes[:icmp_type] || "-"
|
38
|
+
)
|
40
39
|
end
|
41
40
|
|
42
41
|
def self.default_field_order
|
data/lib/brightbox-cli/images.rb
CHANGED
@@ -16,7 +16,7 @@ module Brightbox
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.default_field_order
|
19
|
-
%i[id owner type created_on status size
|
19
|
+
%i[id owner type created_on status size name]
|
20
20
|
end
|
21
21
|
|
22
22
|
# Filter out images that are not of the right type, account or status if the option is passed
|
@@ -68,31 +68,32 @@ module Brightbox
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def status
|
71
|
-
if
|
71
|
+
if fog_attributes[:status] == "available"
|
72
72
|
public? ? "public" : "private"
|
73
|
+
elsif fog_attributes[:status] == "deprecated"
|
74
|
+
public? ? "deprecated" : "private"
|
73
75
|
else
|
74
|
-
|
76
|
+
fog_attributes[:status]
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
78
80
|
def to_row
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
o
|
81
|
+
fog_attributes.merge(
|
82
|
+
id: fog_model.id,
|
83
|
+
status: status,
|
84
|
+
locked: locked?,
|
85
|
+
username: username,
|
86
|
+
arch: arch,
|
87
|
+
name: name.to_s + " (#{arch})",
|
88
|
+
owner: official ? "brightbox" : owner_id,
|
89
|
+
type: type,
|
90
|
+
created_at: created_at,
|
91
|
+
created_on: created_on,
|
92
|
+
description: description,
|
93
|
+
licence_name: licence_name,
|
94
|
+
size: virtual_size,
|
95
|
+
min_ram: min_ram
|
96
|
+
)
|
96
97
|
end
|
97
98
|
|
98
99
|
def public?
|
@@ -100,7 +101,7 @@ module Brightbox
|
|
100
101
|
end
|
101
102
|
|
102
103
|
def status_sort_code
|
103
|
-
case
|
104
|
+
case fog_attributes[:status]
|
104
105
|
when "available"
|
105
106
|
(public? ? 1 : 2)
|
106
107
|
when "deprecated"
|