fog-brightbox 1.5.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/lib/fog/brightbox/compute/shared.rb +26 -10
  4. data/lib/fog/brightbox/compute.rb +11 -0
  5. data/lib/fog/brightbox/config.rb +12 -0
  6. data/lib/fog/brightbox/models/compute/account.rb +30 -18
  7. data/lib/fog/brightbox/models/compute/api_client.rb +10 -2
  8. data/lib/fog/brightbox/models/compute/application.rb +8 -0
  9. data/lib/fog/brightbox/models/compute/cloud_ip.rb +11 -11
  10. data/lib/fog/brightbox/models/compute/collaboration.rb +11 -0
  11. data/lib/fog/brightbox/models/compute/config_map.rb +14 -0
  12. data/lib/fog/brightbox/models/compute/config_maps.rb +22 -0
  13. data/lib/fog/brightbox/models/compute/database_server.rb +19 -15
  14. data/lib/fog/brightbox/models/compute/database_snapshot.rb +13 -6
  15. data/lib/fog/brightbox/models/compute/database_type.rb +6 -3
  16. data/lib/fog/brightbox/models/compute/event.rb +5 -4
  17. data/lib/fog/brightbox/models/compute/firewall_policy.rb +10 -4
  18. data/lib/fog/brightbox/models/compute/firewall_rule.rb +9 -6
  19. data/lib/fog/brightbox/models/compute/flavor.rb +3 -3
  20. data/lib/fog/brightbox/models/compute/image.rb +16 -14
  21. data/lib/fog/brightbox/models/compute/load_balancer.rb +12 -8
  22. data/lib/fog/brightbox/models/compute/server.rb +19 -17
  23. data/lib/fog/brightbox/models/compute/server_group.rb +13 -5
  24. data/lib/fog/brightbox/models/compute/user.rb +9 -4
  25. data/lib/fog/brightbox/models/compute/user_collaboration.rb +11 -0
  26. data/lib/fog/brightbox/models/compute/volume.rb +15 -14
  27. data/lib/fog/brightbox/models/compute/zone.rb +3 -4
  28. data/lib/fog/brightbox/models/storage/directory.rb +2 -2
  29. data/lib/fog/brightbox/oauth2.rb +47 -7
  30. data/lib/fog/brightbox/requests/compute/create_config_map.rb +22 -0
  31. data/lib/fog/brightbox/requests/compute/delete_config_map.rb +20 -0
  32. data/lib/fog/brightbox/requests/compute/get_config_map.rb +18 -0
  33. data/lib/fog/brightbox/requests/compute/list_config_maps.rb +18 -0
  34. data/lib/fog/brightbox/requests/compute/update_config_map.rb +22 -0
  35. data/lib/fog/brightbox/version.rb +1 -1
  36. data/spec/fog/brightbox/compute/credentials_spec.rb +41 -0
  37. data/spec/fog/brightbox/compute/get_access_token_spec.rb +305 -0
  38. data/spec/fog/brightbox/compute/two_factor_spec.rb +53 -0
  39. data/spec/fog/brightbox/oauth2/user_credentials_strategy_spec.rb +20 -0
  40. metadata +14 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb1f5fab98014e9dda7db0f12f010f30e35277e6516151f3ebe4f1821c662dc3
4
- data.tar.gz: e4bb7b22b9c9e398923ce253708acfb0dd4519b7511428973ced16e20ac77e69
3
+ metadata.gz: 6e454f9c0dfb541dfcb036712499e20160fb9743ab0da50776252bc6f53516f7
4
+ data.tar.gz: a69d2679435006c7c1da3997aa61b38ce5f180b0d1f20b422f7e2c370dc1b753
5
5
  SHA512:
6
- metadata.gz: 38c16b6810afe2ebb15edeedfff0732f54e34ccc0e8bb56af85efcbcf2d43c1776957dff2b0ca44afc5a1cbc7d6b7a98c015cb5feb95aea36c820ab0eada57fd
7
- data.tar.gz: 86e0cd498b82639fd952f3a08c03c15d8e8f623391889c23f602e6a1d7177cbe714b5527d3940e404e902d8a2acbc3c2004de97113ff6823b8656d07a35736ee
6
+ metadata.gz: 00302c2501178651b3aa88100cceec4a5acd33f6feb39ae27aa03935e8e95c5796b2f5c144bb457936d1694791afcaa3b0689cae1e16d81ca02b8c81c63383bb
7
+ data.tar.gz: b072d486bfd7f2a8a4b7a0cf747be18c3db59a7e8b66553ae4183500c33a4e4adb67baa405c58dd7063ba6630141879c92ba380c82da4f9233d9fdb40589b0b9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ ### 1.7.1 / 2022-08-17
2
+
3
+ Bug fixes:
4
+
5
+ * Implement `Storage::Directory#public_url` to allow generation of `File` public URLs correctly.
6
+
7
+ ### 1.7.0 / 2022-07-28
8
+
9
+ Changes:
10
+
11
+ * Adds support for `ConfigMaps` which are simple key/value stores for configuring
12
+ other resources.
13
+ * Updated the API models to include the latest set of attributes defined in the
14
+ Brightbox API enabling them to be referenced.
15
+
16
+ ### 1.6.0 / 2022-07-25
17
+
18
+ Changes:
19
+
20
+ * Added support to opt-in to support Brightbox 2FA within clients.
21
+
22
+ Two Factor Authentication (2FA) support:
23
+
24
+ Passing `brightbox_support_two_factor` into a configuration will raise a new
25
+ error when user authentication has failed BUT the presence of the
26
+ `X-Brightbox-OTP: required` HTTP header is found.
27
+
28
+ This new error `Fog::Brightbox::OAuth2::TwoFactorMissingError` can be handled
29
+ differently by the client and the second factor can be prompted for or
30
+ recovered from a secure keychain.
31
+
32
+ Without opting in, the previous error `Excon::Errors::Unauthorized` is raised.
33
+
34
+ To send the OTP, the `brightbox_one_time_password` can be passed into a
35
+ configuration object or one_time_password can be passed to a credentials
36
+ object.
37
+
1
38
  ### 1.5.0 / 2022-06-09
2
39
 
3
40
  Changes:
@@ -39,21 +39,15 @@ module Fog
39
39
  @persistent = @config.connection_persistent?
40
40
  @connection = Fog::Core::Connection.new(@api_url, @persistent, @connection_options)
41
41
 
42
- # Authentication options
43
- client_id = @config.client_id
44
- client_secret = @config.client_secret
45
-
46
- username = @config.username
47
- password = @config.password
48
42
  @configured_account = @config.account
49
43
  # Request account can be changed at anytime and changes behaviour of future requests
50
44
  @scoped_account = @configured_account
51
45
 
52
- credential_options = { :username => username, :password => password }
53
- @credentials = CredentialSet.new(client_id, client_secret, credential_options)
46
+ @two_factor = @config.two_factor?
47
+ @one_time_password = @config.one_time_password
54
48
 
55
49
  # If existing tokens have been cached, allow continued use of them in the service
56
- @credentials.update_tokens(@config.cached_access_token, @config.cached_refresh_token)
50
+ credentials.update_tokens(@config.cached_access_token, @config.cached_refresh_token)
57
51
 
58
52
  @token_management = @config.managed_tokens?
59
53
  end
@@ -73,6 +67,12 @@ module Fog
73
67
  @scoped_account = @configured_account
74
68
  end
75
69
 
70
+ def credentials
71
+ client_id = @config.client_id
72
+ client_secret = @config.client_secret
73
+ @credentials ||= CredentialSet.new(client_id, client_secret, credential_options)
74
+ end
75
+
76
76
  # Returns the scoped account being used for requests
77
77
  #
78
78
  # * For API clients this is the owning account
@@ -122,7 +122,7 @@ module Fog
122
122
  def get_access_token
123
123
  begin
124
124
  get_access_token!
125
- rescue Excon::Errors::Unauthorized, Excon::Errors::BadRequest
125
+ rescue Fog::Brightbox::OAuth2::TwoFactorMissingError, Excon::Errors::Unauthorized, Excon::Errors::BadRequest
126
126
  @credentials.update_tokens(nil, nil)
127
127
  end
128
128
  @credentials.access_token
@@ -154,8 +154,24 @@ module Fog
154
154
  @default_image_id ||= (@config.default_image_id || select_default_image)
155
155
  end
156
156
 
157
+ def two_factor?
158
+ @two_factor || false
159
+ end
160
+
157
161
  private
158
162
 
163
+ # This returns a formatted set of options for the credentials for this service
164
+ #
165
+ # @return [Hash]
166
+ def credential_options
167
+ {
168
+ username: @config.username,
169
+ password: @config.password
170
+ }.tap do |opts|
171
+ opts[:one_time_password] = @one_time_password if two_factor?
172
+ end
173
+ end
174
+
159
175
  # This makes a request of the API based on the configured setting for
160
176
  # token management.
161
177
  #
@@ -21,6 +21,10 @@ module Fog
21
21
  # Automatic token management
22
22
  recognizes :brightbox_token_management
23
23
 
24
+ # Two Factor Authentication support (2FA)
25
+ recognizes :brightbox_support_two_factor
26
+ recognizes :brightbox_one_time_password
27
+
24
28
  # Excon connection settings
25
29
  recognizes :persistent
26
30
 
@@ -33,6 +37,8 @@ module Fog
33
37
  model :api_client
34
38
  collection :collaborations
35
39
  model :collaboration
40
+ collection :config_maps
41
+ model :config_map
36
42
  collection :servers
37
43
  model :server
38
44
  collection :server_groups
@@ -81,6 +87,7 @@ module Fog
81
87
  request :create_application
82
88
  request :create_cloud_ip
83
89
  request :create_collaboration
90
+ request :create_config_map
84
91
  request :create_firewall_policy
85
92
  request :create_firewall_rule
86
93
  request :create_image
@@ -93,6 +100,7 @@ module Fog
93
100
  request :delete_application
94
101
  request :delete_cloud_ip
95
102
  request :delete_collaboration
103
+ request :delete_config_map
96
104
  request :delete_firewall_policy
97
105
  request :delete_firewall_rule
98
106
  request :delete_image
@@ -110,6 +118,7 @@ module Fog
110
118
  request :get_authenticated_user
111
119
  request :get_cloud_ip
112
120
  request :get_collaboration
121
+ request :get_config_map
113
122
  request :get_firewall_policy
114
123
  request :get_firewall_rule
115
124
  request :get_image
@@ -131,6 +140,7 @@ module Fog
131
140
  request :list_applications
132
141
  request :list_cloud_ips
133
142
  request :list_collaborations
143
+ request :list_config_maps
134
144
  request :list_events
135
145
  request :list_firewall_policies
136
146
  request :list_images
@@ -184,6 +194,7 @@ module Fog
184
194
  request :update_api_client
185
195
  request :update_application
186
196
  request :update_cloud_ip
197
+ request :update_config_map
187
198
  request :update_firewall_policy
188
199
  request :update_firewall_rule
189
200
  request :update_image
@@ -33,6 +33,10 @@ module Fog
33
33
  # Set to specify the client secret to use for requests.
34
34
  # @option options [String] :brightbox_token_management (true)
35
35
  # Set to specify if the service should handle expired tokens or raise an error instead.
36
+ # @option options [Boolean] :brightbox_support_two_factor
37
+ # Set to enable two factor authentication (2FA) for this configuration/user
38
+ # @option options [String] :brightbox_one_time_password
39
+ # Set to pass through the current one time password when using 2FA
36
40
  # @option options [String] :brightbox_username
37
41
  # Set to specify your user account. Either user identifier (+usr-12345+) or email address
38
42
  # may be used.
@@ -226,6 +230,14 @@ module Fog
226
230
  def storage_temp_key
227
231
  @options[:brightbox_temp_url_key]
228
232
  end
233
+
234
+ def two_factor?
235
+ @options[:brightbox_support_two_factor] || false
236
+ end
237
+
238
+ def one_time_password
239
+ @options[:brightbox_one_time_password]
240
+ end
229
241
  end
230
242
  end
231
243
  end
@@ -3,8 +3,8 @@ module Fog
3
3
  class Compute
4
4
  class Account < Fog::Brightbox::Model
5
5
  identity :id
6
- attribute :url
7
6
  attribute :resource_type
7
+ attribute :url
8
8
 
9
9
  attribute :name
10
10
  attribute :status
@@ -20,35 +20,47 @@ module Fog
20
20
  attribute :telephone_number
21
21
  attribute :verified_telephone
22
22
  attribute :verified_ip
23
- attribute :servers_used
24
- attribute :ram_limit
25
- attribute :ram_used
26
- attribute :cloud_ips_limit
27
- attribute :cloud_ips_used
28
- attribute :load_balancers_limit
29
- attribute :load_balancers_used
30
- attribute :dbs_servers_used
31
- attribute :dbs_ram_limit
32
- attribute :dbs_ram_used
23
+
24
+ # Account limits (read-only)
25
+ attribute :block_storage_limit, type: :integer
26
+ attribute :block_storage_used, type: :integer
27
+ attribute :cloud_ips_limit, type: :integer
28
+ attribute :cloud_ips_used, type: :integer
29
+ attribute :dbs_instances_used, type: :integer
30
+ attribute :dbs_ram_limit, type: :integer
31
+ attribute :dbs_ram_used, type: :integer
32
+ attribute :load_balancers_limit, type: :integer
33
+ attribute :load_balancers_used, type: :integer
34
+ attribute :ram_limit, type: :integer
35
+ attribute :ram_used, type: :integer
36
+ attribute :servers_used, type: :integer
37
+
33
38
  attribute :library_ftp_host
34
39
  attribute :library_ftp_user
35
40
  # This is always returned as nil unless after a call to reset_ftp_password
36
41
  attribute :library_ftp_password
37
42
 
38
43
  # Boolean flags
39
- attribute :valid_credit_card
40
- attribute :telephone_verified
44
+ attribute :valid_credit_card, type: :boolean
45
+ attribute :telephone_verified, type: :boolean
41
46
 
42
- # Times
43
- attribute :created_at, :type => :time
44
- attribute :verified_at, :type => :time
47
+ # Timestamps
48
+ attribute :created_at, type: :time
49
+ attribute :verified_at, type: :time
45
50
 
46
- # Links - to be replaced
47
- attribute :owner_id, :aliases => "owner", :squash => "id"
51
+ # Links
52
+ attribute :owner_id, aliases: "owner", squash: "id"
48
53
  attribute :clients
54
+ attribute :cloud_ips
55
+ attribute :database_servers
56
+ attribute :database_snapshots
57
+ attribute :firewall_policies
49
58
  attribute :images
59
+ attribute :load_balancers
60
+ attribute :server_groups
50
61
  attribute :servers
51
62
  attribute :users
63
+ attribute :volumes
52
64
  attribute :zones
53
65
 
54
66
  # Resets the account's image library FTP password returning the new value
@@ -3,12 +3,20 @@ module Fog
3
3
  class Compute
4
4
  class ApiClient < Fog::Brightbox::Model
5
5
  identity :id
6
+ attribute :resource_type
7
+ attribute :url
8
+
6
9
  attribute :name
7
10
  attribute :description
11
+
8
12
  attribute :secret
9
- attribute :revoked_at, :type => :time
10
13
  attribute :permissions_group
11
- attribute :account_id
14
+
15
+ # Timestamps
16
+ attribute :revoked_at, type: :time
17
+
18
+ # Links
19
+ attribute :account_id, aliases: "account", squash: "id"
12
20
 
13
21
  def save
14
22
  raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
@@ -3,10 +3,18 @@ module Fog
3
3
  class Compute
4
4
  class Application < Fog::Brightbox::Model
5
5
  identity :id
6
+ attribute :resource_type
6
7
  attribute :url
8
+
7
9
  attribute :name
10
+ attribute :description
8
11
  attribute :secret
9
12
 
13
+ # Timestamps
14
+ attribute :created_at, type: :time
15
+ attribute :updated_at, type: :time
16
+ attribute :revoked_at, type: :time
17
+
10
18
  def save
11
19
  raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
12
20
  options = {
@@ -3,28 +3,28 @@ module Fog
3
3
  class Compute
4
4
  class CloudIp < Fog::Brightbox::Model
5
5
  identity :id
6
- attribute :url
7
6
  attribute :resource_type
7
+ attribute :url
8
8
 
9
9
  attribute :name
10
10
  attribute :status
11
11
  attribute :description
12
12
 
13
- attribute :reverse_dns
13
+ attribute :fqdn
14
+ attribute :mode
14
15
  attribute :public_ip
15
16
  attribute :public_ipv4
16
17
  attribute :public_ipv6
17
- attribute :fqdn
18
+ attribute :reverse_dns
18
19
 
19
- # Links - to be replaced
20
- attribute :account_id, :aliases => "account", :squash => "id"
21
- attribute :interface_id, :aliases => "interface", :squash => "id"
22
- attribute :server_id, :aliases => "server", :squash => "id"
23
- attribute :load_balancer, :alias => "load_balancer", :squash => "id"
24
- attribute :server_group, :alias => "server_group", :squash => "id"
25
- attribute :database_server, :alias => "database_server", :squash => "id"
20
+ # Links
21
+ attribute :account_id, aliases: "account", squash: "id"
22
+ attribute :interface_id, aliases: "interface", squash: "id"
23
+ attribute :server_id, aliases: "server", squash: "id"
24
+ attribute :load_balancer, :alias => "load_balancer", squash: "id"
25
+ attribute :server_group, :alias => "server_group", squash: "id"
26
+ attribute :database_server, :alias => "database_server", squash: "id"
26
27
  attribute :port_translators
27
- attribute :name
28
28
 
29
29
  # Attempt to map or point the Cloud IP to the destination resource.
30
30
  #
@@ -3,10 +3,21 @@ module Fog
3
3
  class Compute
4
4
  class Collaboration < Fog::Brightbox::Model
5
5
  identity :id
6
+ attribute :resource_type
7
+ attribute :url
8
+
6
9
  attribute :status
10
+
7
11
  attribute :email
8
12
  attribute :role
9
13
  attribute :role_label
14
+
15
+ # Timestamps
16
+ attribute :created_at, type: :time
17
+ attribute :started_at, type: :time
18
+ attribute :finished_at, type: :time
19
+
20
+ # Links
10
21
  attribute :account
11
22
  attribute :user
12
23
  attribute :inviter
@@ -0,0 +1,14 @@
1
+ module Fog
2
+ module Brightbox
3
+ class Compute
4
+ class ConfigMap < Fog::Brightbox::Model
5
+ identity :id
6
+ attribute :resource_type
7
+ attribute :url
8
+
9
+ attribute :name
10
+ attribute :data
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ module Fog
2
+ module Brightbox
3
+ class Compute
4
+ class ConfigMaps < Fog::Collection
5
+ model Fog::Brightbox::Compute::ConfigMap
6
+
7
+ def all
8
+ data = service.list_config_maps
9
+ load(data)
10
+ end
11
+
12
+ def get(identifier)
13
+ return nil if identifier.nil? || identifier == ""
14
+ data = service.get_config_map(identifier)
15
+ new(data)
16
+ rescue Excon::Errors::NotFound
17
+ nil
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -5,39 +5,43 @@ module Fog
5
5
  include Fog::Brightbox::Compute::ResourceLocking
6
6
 
7
7
  identity :id
8
- attribute :url
9
8
  attribute :resource_type
9
+ attribute :url
10
10
 
11
11
  attribute :name
12
12
  attribute :description
13
- attribute :state, :aliases => "status"
13
+ attribute :state, aliases: "status"
14
14
 
15
15
  attribute :admin_username
16
16
  attribute :admin_password
17
-
17
+ attribute :allow_access
18
18
  attribute :database_engine
19
19
  attribute :database_version
20
+ attribute :maintenance_hour #, type: :integer
21
+ attribute :maintenance_weekday #, type: :integer
22
+ attribute :source
20
23
 
21
- attribute :maintenance_weekday
22
- attribute :maintenance_hour
24
+ attribute :snapshots_retention, type: :string
23
25
 
24
26
  # This is a crontab formatted string e.g. "* 5 * * 0"
25
- attribute :snapshots_schedule, :type => :string
26
- attribute :snapshots_schedule_next_at, :type => :time
27
+ attribute :snapshots_schedule, type: :string
28
+ attribute :snapshots_schedule_next_at, type: :time
27
29
 
28
- attribute :created_at, :type => :time
29
- attribute :updated_at, :type => :time
30
- attribute :deleted_at, :type => :time
30
+ # Timestamps
31
+ attribute :created_at, type: :time
32
+ attribute :updated_at, type: :time
33
+ attribute :deleted_at, type: :time
31
34
 
32
- attribute :allow_access
35
+ # Links
36
+ attribute :flavor_id, alias: "database_server_type", squash: "id"
37
+ attribute :zone_id, alias: "zone", squash: "id"
33
38
 
34
- attribute :flavor_id, "alias" => "database_server_type", :squash => "id"
35
- attribute :zone_id, "alias" => "zone", :squash => "id"
39
+ attribute :account
40
+ attribute :cloud_ips
36
41
 
42
+ # Generated from snapshot action and not a real attribute
37
43
  attribute :snapshot_id
38
44
 
39
- attribute :cloud_ips
40
-
41
45
  def save
42
46
  options = {
43
47
  :name => name,
@@ -7,21 +7,28 @@ module Fog
7
7
  include Fog::Brightbox::Compute::ResourceLocking
8
8
 
9
9
  identity :id
10
- attribute :url
11
10
  attribute :resource_type
11
+ attribute :url
12
12
 
13
13
  attribute :name
14
14
  attribute :description
15
- attribute :state, :aliases => "status"
15
+ attribute :state, aliases: "status"
16
16
 
17
17
  attribute :database_engine
18
18
  attribute :database_version
19
19
 
20
- attribute :size
20
+ attribute :size, type: :integer
21
+ attribute :source
22
+ attribute :source_trigger
23
+
24
+ # Timestamps
25
+ attribute :created_at, type: :time
26
+ attribute :updated_at, type: :time
27
+ attribute :deleted_at, type: :time
21
28
 
22
- attribute :created_at, :type => :time
23
- attribute :updated_at, :type => :time
24
- attribute :deleted_at, :type => :time
29
+ # Links
30
+ attribute :account
31
+ attribute :account_id, aliases: "account", squash: "id"
25
32
 
26
33
  def save
27
34
  options = {
@@ -3,14 +3,17 @@ module Fog
3
3
  class Compute
4
4
  class DatabaseType < Fog::Brightbox::Model
5
5
  identity :id
6
- attribute :url
7
6
  attribute :resource_type
7
+ attribute :url
8
8
 
9
9
  attribute :name
10
10
  attribute :description
11
11
 
12
- attribute :disk, :aliases => "disk_size"
13
- attribute :ram
12
+ attribute :disk, aliases: "disk_size", type: :integer
13
+ attribute :ram, type: :integer
14
+
15
+ # Boolean flags
16
+ attribute :default, type: :boolean
14
17
  end
15
18
  end
16
19
  end
@@ -4,17 +4,18 @@ module Fog
4
4
  # @api private
5
5
  class Event < Fog::Brightbox::Model
6
6
  identity :id
7
- attribute :url
8
7
  attribute :resource_type
8
+ attribute :url
9
9
 
10
10
  attribute :action
11
11
  attribute :message
12
12
  attribute :short_message
13
13
 
14
- # Times
15
- attribute :created_at, :type => :time
14
+ # Timestamps
15
+ attribute :created_at, type: :time
16
16
 
17
- # Links - to be replaced
17
+ # Links
18
+ attribute :affects
18
19
  attribute :resource
19
20
  attribute :client
20
21
  attribute :user
@@ -3,16 +3,22 @@ module Fog
3
3
  class Compute
4
4
  class FirewallPolicy < Fog::Brightbox::Model
5
5
  identity :id
6
- attribute :url
7
6
  attribute :resource_type
7
+ attribute :url
8
8
 
9
9
  attribute :name
10
10
  attribute :description
11
11
 
12
- attribute :default
12
+ # Boolean flags
13
+ attribute :default, type: :boolean
14
+
15
+ # Timestamps
16
+ attribute :created_at, type: :time
17
+
18
+ # Links
19
+ attribute :account_id, aliases: "account", squash: "id"
20
+ attribute :server_group_id, aliases: "server_group", squash: "id"
13
21
 
14
- attribute :server_group_id, :aliases => "server_group", :squash => "id"
15
- attribute :created_at, :type => :time
16
22
  attribute :rules
17
23
 
18
24
  # Sticking with existing Fog behaviour, save does not update but creates a new resource
@@ -3,20 +3,23 @@ module Fog
3
3
  class Compute
4
4
  class FirewallRule < Fog::Brightbox::Model
5
5
  identity :id
6
- attribute :url
7
6
  attribute :resource_type
7
+ attribute :url
8
8
 
9
9
  attribute :description
10
10
 
11
- attribute :source
12
- attribute :source_port
13
11
  attribute :destination
14
12
  attribute :destination_port
15
- attribute :protocol
16
13
  attribute :icmp_type_name
17
- attribute :created_at, :type => :time
14
+ attribute :protocol
15
+ attribute :source
16
+ attribute :source_port
17
+
18
+ # Timestamps
19
+ attribute :created_at, type: :time
18
20
 
19
- attribute :firewall_policy_id, :aliases => "firewall_policy", :squash => "id"
21
+ # Links
22
+ attribute :firewall_policy_id, aliases: "firewall_policy", squash: "id"
20
23
 
21
24
  # Sticking with existing Fog behaviour, save does not update but creates a new resource
22
25
  def save
@@ -3,19 +3,19 @@ module Fog
3
3
  class Compute
4
4
  class Flavor < Fog::Brightbox::Model
5
5
  identity :id
6
- attribute :url
7
6
  attribute :resource_type
7
+ attribute :url
8
8
 
9
9
  attribute :name
10
10
  attribute :status
11
- attribute :description
12
11
 
13
12
  attribute :handle
14
13
 
15
14
  attribute :bits
16
15
  attribute :cores
17
- attribute :disk, :aliases => "disk_size"
16
+ attribute :disk, aliases: "disk_size"
18
17
  attribute :ram
18
+ attribute :storage_type
19
19
 
20
20
  def bits
21
21
  64 # This is actually based on the Image type used. 32bit or 64bit Images are supported