fog-brightbox 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +15 -10
  3. data/CHANGELOG.md +17 -0
  4. data/Rakefile +1 -1
  5. data/fog-brightbox.gemspec +5 -3
  6. data/lib/fog/brightbox/compute/shared.rb +11 -10
  7. data/lib/fog/brightbox/compute.rb +20 -21
  8. data/lib/fog/brightbox/config.rb +6 -9
  9. data/lib/fog/brightbox/models/compute/api_client.rb +4 -4
  10. data/lib/fog/brightbox/models/compute/application.rb +2 -2
  11. data/lib/fog/brightbox/models/compute/cloud_ip.rb +11 -11
  12. data/lib/fog/brightbox/models/compute/collaboration.rb +3 -3
  13. data/lib/fog/brightbox/models/compute/collaborations.rb +1 -1
  14. data/lib/fog/brightbox/models/compute/config_map.rb +2 -3
  15. data/lib/fog/brightbox/models/compute/database_server.rb +17 -5
  16. data/lib/fog/brightbox/models/compute/database_snapshot.rb +2 -2
  17. data/lib/fog/brightbox/models/compute/firewall_policy.rb +6 -6
  18. data/lib/fog/brightbox/models/compute/firewall_rule.rb +9 -9
  19. data/lib/fog/brightbox/models/compute/image.rb +9 -9
  20. data/lib/fog/brightbox/models/compute/load_balancer.rb +12 -12
  21. data/lib/fog/brightbox/models/compute/server.rb +21 -23
  22. data/lib/fog/brightbox/models/compute/server_group.rb +6 -6
  23. data/lib/fog/brightbox/models/compute/user.rb +3 -3
  24. data/lib/fog/brightbox/models/compute/volume.rb +16 -16
  25. data/lib/fog/brightbox/models/storage/directories.rb +2 -2
  26. data/lib/fog/brightbox/models/storage/directory.rb +7 -7
  27. data/lib/fog/brightbox/models/storage/file.rb +13 -13
  28. data/lib/fog/brightbox/models/storage/files.rb +9 -13
  29. data/lib/fog/brightbox/oauth2.rb +11 -11
  30. data/lib/fog/brightbox/requests/compute/list_accounts.rb +1 -1
  31. data/lib/fog/brightbox/requests/compute/reset_database_server.rb +21 -0
  32. data/lib/fog/brightbox/requests/compute/resize_database_server.rb +25 -0
  33. data/lib/fog/brightbox/requests/compute/snapshot_database_server.rb +1 -1
  34. data/lib/fog/brightbox/requests/compute/snapshot_server.rb +1 -1
  35. data/lib/fog/brightbox/requests/storage/copy_object.rb +5 -5
  36. data/lib/fog/brightbox/requests/storage/delete_container.rb +3 -3
  37. data/lib/fog/brightbox/requests/storage/delete_multiple_objects.rb +7 -7
  38. data/lib/fog/brightbox/requests/storage/delete_object.rb +3 -3
  39. data/lib/fog/brightbox/requests/storage/delete_static_large_object.rb +6 -6
  40. data/lib/fog/brightbox/requests/storage/get_container.rb +4 -4
  41. data/lib/fog/brightbox/requests/storage/get_containers.rb +4 -4
  42. data/lib/fog/brightbox/requests/storage/get_object.rb +4 -6
  43. data/lib/fog/brightbox/requests/storage/get_object_http_url.rb +1 -1
  44. data/lib/fog/brightbox/requests/storage/get_object_https_url.rb +1 -1
  45. data/lib/fog/brightbox/requests/storage/head_container.rb +4 -4
  46. data/lib/fog/brightbox/requests/storage/head_containers.rb +4 -4
  47. data/lib/fog/brightbox/requests/storage/head_object.rb +3 -3
  48. data/lib/fog/brightbox/requests/storage/post_set_meta_temp_url_key.rb +3 -3
  49. data/lib/fog/brightbox/requests/storage/put_container.rb +4 -4
  50. data/lib/fog/brightbox/requests/storage/put_dynamic_obj_manifest.rb +4 -4
  51. data/lib/fog/brightbox/requests/storage/put_object.rb +7 -7
  52. data/lib/fog/brightbox/requests/storage/put_static_obj_manifest.rb +6 -6
  53. data/lib/fog/brightbox/storage/authentication_request.rb +4 -4
  54. data/lib/fog/brightbox/storage/connection.rb +2 -2
  55. data/lib/fog/brightbox/storage.rb +13 -14
  56. data/lib/fog/brightbox/version.rb +1 -1
  57. data/spec/fog/brightbox/compute/config_spec.rb +4 -4
  58. data/spec/fog/brightbox/compute/get_access_token_spec.rb +28 -28
  59. data/spec/fog/brightbox/compute/wrapped_request_spec.rb +23 -23
  60. data/spec/fog/brightbox/config_spec.rb +23 -23
  61. data/spec/fog/brightbox/oauth2/client_credentials_strategy_spec.rb +2 -2
  62. data/spec/fog/brightbox/oauth2/credential_set_spec.rb +5 -5
  63. data/spec/fog/brightbox/oauth2/grant_type_strategy_spec.rb +2 -2
  64. data/spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb +3 -3
  65. data/spec/fog/brightbox/oauth2/user_credentials_strategy_spec.rb +4 -4
  66. data/spec/fog/brightbox/storage/authentication_request_spec.rb +34 -34
  67. data/spec/fog/brightbox/storage/config_spec.rb +4 -4
  68. data/spec/fog/brightbox/storage/connection_errors_spec.rb +6 -6
  69. data/spec/fog/brightbox/storage/connection_spec.rb +37 -37
  70. data/spec/fog/brightbox/storage/directory_spec.rb +6 -6
  71. data/spec/fog/brightbox/storage/files_spec.rb +5 -5
  72. data/spec/fog/brightbox/storage_spec.rb +5 -5
  73. data/spec/fog/compute/brightbox/database_server_spec.rb +19 -19
  74. data/spec/fog/compute/brightbox/image_selector_spec.rb +18 -18
  75. data/spec/fog/compute/brightbox/load_balancer_spec.rb +5 -5
  76. data/spec/fog/compute/brightbox/server_spec.rb +44 -44
  77. data/spec/fog/compute/brightbox/volume_spec.rb +68 -69
  78. data/spec/fog/compute/brightbox_spec.rb +10 -10
  79. data/spec/fog/storage/brightbox_spec.rb +83 -83
  80. data/spec/model_setup.rb +9 -9
  81. data/spec/stock_storage_responses.rb +9 -9
  82. data/spec/supports_resource_locking.rb +6 -6
  83. data/tests/brightbox/compute/schema.rb +74 -74
  84. data/tests/brightbox/compute_tests.rb +14 -14
  85. data/tests/brightbox/models/compute/server_tests.rb +0 -1
  86. data/tests/brightbox/requests/compute/account_tests.rb +9 -9
  87. data/tests/brightbox/requests/compute/api_client_tests.rb +9 -9
  88. data/tests/brightbox/requests/compute/application_test.rb +8 -8
  89. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +11 -13
  90. data/tests/brightbox/requests/compute/collaboration_tests.rb +1 -1
  91. data/tests/brightbox/requests/compute/database_server_tests.rb +7 -7
  92. data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +5 -5
  93. data/tests/brightbox/requests/compute/database_type_tests.rb +1 -1
  94. data/tests/brightbox/requests/compute/firewall_policy_tests.rb +7 -7
  95. data/tests/brightbox/requests/compute/firewall_rule_tests.rb +8 -10
  96. data/tests/brightbox/requests/compute/helper.rb +1 -1
  97. data/tests/brightbox/requests/compute/image_tests.rb +2 -2
  98. data/tests/brightbox/requests/compute/interface_tests.rb +1 -1
  99. data/tests/brightbox/requests/compute/load_balancer_tests.rb +23 -23
  100. data/tests/brightbox/requests/compute/server_group_tests.rb +16 -18
  101. data/tests/brightbox/requests/compute/server_tests.rb +12 -12
  102. data/tests/brightbox/requests/compute/server_type_tests.rb +2 -2
  103. data/tests/brightbox/requests/compute/user_tests.rb +4 -4
  104. data/tests/brightbox/requests/compute/volume_tests.rb +5 -5
  105. data/tests/brightbox/requests/compute/zone_tests.rb +2 -2
  106. data/tests/helper.rb +1 -1
  107. data/tests/helpers/collection_helper.rb +16 -23
  108. data/tests/helpers/compute/server_helper.rb +4 -6
  109. data/tests/helpers/formats_helper.rb +5 -5
  110. data/tests/helpers/formats_helper_tests.rb +16 -16
  111. data/tests/helpers/mock_helper.rb +84 -86
  112. data/tests/helpers/model_helper.rb +1 -3
  113. data/tests/helpers/schema_validator_tests.rb +14 -14
  114. metadata +17 -2
  115. data/.rubocop_todo.yml +0 -81
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e29dad67fb7b5d3a127610f2dce8890bfcab19161f43b5cf4f670b808361018f
4
- data.tar.gz: 9f2ada9a08af31b9168e98b86f803bbb07d44434a8680f175120d32060ee3df4
3
+ metadata.gz: d2704dd100c0417f4e0c5542215cc2e0b1e84f0b066f8c4be9858dae64f96a53
4
+ data.tar.gz: 5bf6d58cdbb9360746281d9d2d2196b027db82702000e1e62691d21d30e6ddb3
5
5
  SHA512:
6
- metadata.gz: 17f9017f895c9d6fb0ec020ab24ef19290485f73547bba6526dd516882a79bf2055b2e15d1fb8c5cf24bd1b9dfb1a7777e805c8e55683fc05cb7a1f63947b892
7
- data.tar.gz: af042f15f47599ec50523e0c54359a0d798901fe3afc79f3eed5a8514af058332bf9123beb129238a2c4f18ab8f7203188ce376294917c4f00e676d3a6b93e0e
6
+ metadata.gz: 9b4009f6fc679a921ba6aa51bde935a8d4221d39d1d91e7b1815b31f8aa46ffbf4cf41ca4e49574c5c4829aeb8444f19893da742e67f024dfb0890227ad453b1
7
+ data.tar.gz: 4cdd670508ec4be444829057d96e373aee41df23c8506d66361f33d7228c22b5afaea1f3c74700ebc27f186a4e88c5219025e6747f2db45a2ffb126639bad66d
data/.rubocop.yml CHANGED
@@ -1,20 +1,25 @@
1
- inherit_from: .rubocop_todo.yml
1
+ AllCops:
2
+ TargetRubyVersion: 2.0
2
3
 
3
- HashSyntax:
4
- EnforcedStyle: hash_rockets
5
-
6
- LineLength:
4
+ Metrics/LineLength:
7
5
  Max: 100
8
6
  Enabled: false
9
7
 
10
- StringLiterals:
11
- EnforcedStyle: double_quotes
12
-
13
- Encoding:
8
+ Style/Encoding:
14
9
  Description: 'Use UTF-8 as the source file encoding.'
15
10
  Enabled: false
16
11
 
17
- SignalException:
12
+ Style/HashSyntax:
13
+ EnforcedStyle: ruby19_no_mixed_keys
14
+
15
+ Style/SignalException:
18
16
  Description: 'Do not enforce use of fail when raising exceptions.'
19
17
  # Valid values are: semantic, only_raise and only_fail
20
18
  EnforcedStyle: only_raise
19
+
20
+ Style/SpecialGlobalVars:
21
+ # auto "correct" adds gem requirement
22
+ Enabled: false
23
+
24
+ Style/StringLiterals:
25
+ EnforcedStyle: double_quotes
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 1.11.0 / 2023-01-26
2
+
3
+ Enhancements:
4
+
5
+ * Add `DatabaseServer#reset` and `#resize` methods
6
+ * Added requests to support database server resets and resizing
7
+
8
+ Bug fixes:
9
+
10
+ * Remove duplicated request references
11
+ * Fix test method declaration causing parsing error in Ruby 2.0
12
+
13
+ Changes:
14
+
15
+ * Added `rubocop` gem configured to Ruby 2.0
16
+ * Cleaning up of codebase to fix various style and layout problems
17
+
1
18
  ### 1.10.0 / 2023-01-24
2
19
 
3
20
  Enhancements:
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
 
4
- task :default => :test
4
+ task default: :test
5
5
 
6
6
  Rake::TestTask.new do |t|
7
7
  t.libs << "spec"
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path("../lib", __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require "fog/brightbox/version"
@@ -8,9 +9,9 @@ Gem::Specification.new do |spec|
8
9
  spec.version = Fog::Brightbox::VERSION
9
10
  spec.authors = ["Paul Thornthwaite"]
10
11
  spec.email = ["tokengeek@gmail.com"]
11
- spec.description = %q(Module for the 'fog' gem to support Brightbox Cloud)
12
- spec.summary = %q(This library can be used as a module for `fog` or as standalone provider
13
- to use the Brightbox Cloud in applications)
12
+ spec.description = "Module for the 'fog' gem to support Brightbox Cloud"
13
+ spec.summary = "This library can be used as a module for `fog` or as standalone provider
14
+ to use the Brightbox Cloud in applications"
14
15
  spec.homepage = "https://github.com/fog/fog-brightbox"
15
16
  spec.license = "MIT"
16
17
 
@@ -29,6 +30,7 @@ Gem::Specification.new do |spec|
29
30
  spec.add_development_dependency "minitest"
30
31
  spec.add_development_dependency "pry"
31
32
  spec.add_development_dependency "rake"
33
+ spec.add_development_dependency "rubocop", "< 0.50"
32
34
  spec.add_development_dependency "shindo"
33
35
  spec.add_development_dependency "webmock"
34
36
  spec.add_development_dependency "yard"
@@ -9,7 +9,7 @@ module Fog
9
9
 
10
10
  attr_writer :scoped_account
11
11
 
12
- API_URL = "https://api.gb1.brightbox.com/"
12
+ API_URL = "https://api.gb1.brightbox.com/".freeze
13
13
 
14
14
  # Creates a new instance of the Brightbox Compute service
15
15
  #
@@ -23,11 +23,11 @@ module Fog
23
23
  # of a {Brightbox::Config} object but may be a Hash.
24
24
  #
25
25
  def initialize(config)
26
- if config.respond_to?(:config_service?) && config.config_service?
27
- @config = config
28
- else
29
- @config = Fog::Brightbox::Config.new(config)
30
- end
26
+ @config = if config.respond_to?(:config_service?) && config.config_service?
27
+ config
28
+ else
29
+ Fog::Brightbox::Config.new(config)
30
+ end
31
31
  @config = Fog::Brightbox::Compute::Config.new(@config)
32
32
 
33
33
  # Currently authentication and api endpoints are the same but may change
@@ -49,7 +49,7 @@ module Fog
49
49
  # If existing tokens have been cached, allow continued use of them in the service
50
50
  credentials.update_tokens(@config.cached_access_token, @config.cached_refresh_token)
51
51
 
52
- @token_management = @config.managed_tokens?
52
+ @token_management = @config.managed_tokens?
53
53
  end
54
54
 
55
55
  # This returns the account identifier that the request should be scoped by
@@ -82,7 +82,7 @@ module Fog
82
82
  # @return [Fog::Brightbox::Compute::Account]
83
83
  #
84
84
  def account
85
- account_data = get_scoped_account.merge(:service => self)
85
+ account_data = get_scoped_account.merge(service: self)
86
86
  Fog::Brightbox::Compute::Account.new(account_data)
87
87
  end
88
88
 
@@ -95,7 +95,7 @@ module Fog
95
95
  # Returns true if an access token is set
96
96
  # @return [Boolean]
97
97
  def access_token_available?
98
- !! @credentials.access_token
98
+ !!@credentials.access_token
99
99
  end
100
100
 
101
101
  # Returns the current access token or nil
@@ -212,7 +212,8 @@ module Fog
212
212
  # @return [Excon::Response]
213
213
  def authenticated_request(options)
214
214
  headers = options[:headers] || {}
215
- headers.merge!("Authorization" => "Bearer #{@credentials.access_token}", "Content-Type" => "application/json")
215
+ headers["Authorization"] = "Bearer #{@credentials.access_token}"
216
+ headers["Content-Type"] = "application/json"
216
217
  options[:headers] = headers
217
218
  # TODO: This is just a wrapper around a call to Excon::Connection#request
218
219
  # so can be extracted from Compute by passing in the connection,
@@ -79,20 +79,18 @@ module Fog
79
79
  request :add_nodes_load_balancer
80
80
  request :add_servers_server_group
81
81
  request :apply_to_firewall_policy
82
- request :accept_user_collaboration
83
82
  request :attach_volume
84
- request :remove_firewall_policy
85
83
  request :copy_volume
86
84
  request :create_api_client
87
85
  request :create_application
88
86
  request :create_cloud_ip
89
87
  request :create_collaboration
90
88
  request :create_config_map
89
+ request :create_database_server
91
90
  request :create_firewall_policy
92
91
  request :create_firewall_rule
93
92
  request :create_image
94
93
  request :create_load_balancer
95
- request :create_database_server
96
94
  request :create_server
97
95
  request :create_server_group
98
96
  request :create_volume
@@ -101,12 +99,12 @@ module Fog
101
99
  request :delete_cloud_ip
102
100
  request :delete_collaboration
103
101
  request :delete_config_map
102
+ request :delete_database_server
103
+ request :delete_database_snapshot
104
104
  request :delete_firewall_policy
105
105
  request :delete_firewall_rule
106
106
  request :delete_image
107
107
  request :delete_load_balancer
108
- request :delete_database_server
109
- request :delete_database_snapshot
110
108
  request :delete_server
111
109
  request :delete_server_group
112
110
  request :delete_user_collaboration
@@ -119,14 +117,14 @@ module Fog
119
117
  request :get_cloud_ip
120
118
  request :get_collaboration
121
119
  request :get_config_map
120
+ request :get_database_server
121
+ request :get_database_snapshot
122
+ request :get_database_type
122
123
  request :get_firewall_policy
123
124
  request :get_firewall_rule
124
125
  request :get_image
125
126
  request :get_interface
126
127
  request :get_load_balancer
127
- request :get_database_server
128
- request :get_database_snapshot
129
- request :get_database_type
130
128
  request :get_scoped_account
131
129
  request :get_server
132
130
  request :get_server_group
@@ -141,18 +139,18 @@ module Fog
141
139
  request :list_cloud_ips
142
140
  request :list_collaborations
143
141
  request :list_config_maps
142
+ request :list_database_servers
143
+ request :list_database_snapshots
144
+ request :list_database_types
144
145
  request :list_events
145
146
  request :list_firewall_policies
146
147
  request :list_images
147
148
  request :list_load_balancers
148
- request :list_database_servers
149
- request :list_database_snapshots
150
- request :list_database_types
151
149
  request :list_server_groups
152
150
  request :list_server_types
153
151
  request :list_servers
154
- request :list_users
155
152
  request :list_user_collaborations
153
+ request :list_users
156
154
  request :list_volumes
157
155
  request :list_zones
158
156
  request :lock_resource_database_server
@@ -165,19 +163,20 @@ module Fog
165
163
  request :move_servers_server_group
166
164
  request :reboot_server
167
165
  request :reject_user_collaboration
166
+ request :remove_firewall_policy
168
167
  request :remove_listeners_load_balancer
169
168
  request :remove_nodes_load_balancer
170
169
  request :remove_servers_server_group
171
170
  request :resend_collaboration
171
+ request :reset_database_server
172
172
  request :reset_ftp_password_account
173
173
  request :reset_ftp_password_scoped_account
174
174
  request :reset_password_database_server
175
175
  request :reset_secret_api_client
176
176
  request :reset_secret_application
177
177
  request :reset_server
178
- request :resend_collaboration
178
+ request :resize_database_server
179
179
  request :resize_volume
180
- request :reject_user_collaboration
181
180
  request :shutdown_server
182
181
  request :snapshot_database_server
183
182
  request :snapshot_server
@@ -195,12 +194,12 @@ module Fog
195
194
  request :update_application
196
195
  request :update_cloud_ip
197
196
  request :update_config_map
197
+ request :update_database_server
198
+ request :update_database_snapshot
198
199
  request :update_firewall_policy
199
200
  request :update_firewall_rule
200
201
  request :update_image
201
202
  request :update_load_balancer
202
- request :update_database_server
203
- request :update_database_snapshot
204
203
  request :update_scoped_account
205
204
  request :update_server
206
205
  request :update_server_group
@@ -286,17 +285,17 @@ module Fog
286
285
  # @return [Hash]
287
286
  def _wrapped_request(method, path, expected_responses, parameters = {})
288
287
  request_options = {
289
- :method => method.to_s.upcase,
290
- :path => path,
291
- :expects => expected_responses
288
+ method: method.to_s.upcase,
289
+ path: path,
290
+ expects: expected_responses
292
291
  }
293
292
 
294
293
  query = {}
295
294
 
296
295
  # Select the account to scope for this request
297
296
  account = scoped_account(parameters.fetch(:account_id, nil))
298
- query.merge!(:account_id => account) if account
299
- query.merge!(:nested => parameters.delete(:nested)) if parameters.key?(:nested)
297
+ query[:account_id] = account if account
298
+ query[:nested] = parameters.delete(:nested) if parameters.key?(:nested)
300
299
  request_options[:query] = query unless query.empty?
301
300
 
302
301
  request_options[:body] = Fog::JSON.encode(parameters) unless parameters.empty?
@@ -56,11 +56,10 @@ module Fog
56
56
  # @return [OAuth2::CredentialSet]
57
57
  def credentials
58
58
  @credentials ||= OAuth2::CredentialSet.new(client_id, client_secret,
59
- :username => username,
60
- :password => password,
61
- :access_token => cached_access_token,
62
- :refresh_token => cached_refresh_token
63
- )
59
+ username: username,
60
+ password: password,
61
+ access_token: cached_access_token,
62
+ refresh_token: cached_refresh_token)
64
63
  end
65
64
 
66
65
  # @return [Boolean]
@@ -88,7 +87,7 @@ module Fog
88
87
  def compute_url
89
88
  URI.parse(@options.fetch(:brightbox_api_url, "https://api.gb1.brightbox.com"))
90
89
  end
91
- alias_method :api_url, :compute_url
90
+ alias api_url compute_url
92
91
 
93
92
  def storage_url
94
93
  URI.parse(@options[:brightbox_storage_url] || "https://orbit.brightbox.com")
@@ -103,15 +102,13 @@ module Fog
103
102
  def storage_management_url
104
103
  @storage_management_url ||= if @options.key?(:brightbox_storage_management_url)
105
104
  URI.parse(@options[:brightbox_storage_management_url])
106
- else
107
- nil
108
105
  end
109
106
  end
110
107
 
111
108
  # @param [URI] management_url The +URI+ to use for management requests.
112
109
  # @raise [ArgumentError] if non +URI+ object passed
113
110
  def storage_management_url=(management_url)
114
- raise ArgumentError unless management_url.kind_of?(URI)
111
+ raise ArgumentError unless management_url.is_a?(URI)
115
112
  @storage_management_url = management_url
116
113
  end
117
114
 
@@ -19,11 +19,11 @@ module Fog
19
19
  attribute :account_id, aliases: "account", squash: "id"
20
20
 
21
21
  def save
22
- raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
22
+ raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
23
23
  options = {
24
- :name => name,
25
- :description => description,
26
- :permissions_group => permissions_group
24
+ name: name,
25
+ description: description,
26
+ permissions_group: permissions_group
27
27
  }.delete_if { |_k, v| v.nil? || v == "" }
28
28
  data = service.create_api_client(options)
29
29
  merge_attributes(data)
@@ -16,9 +16,9 @@ module Fog
16
16
  attribute :revoked_at, type: :time
17
17
 
18
18
  def save
19
- raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
19
+ raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
20
20
  options = {
21
- :name => name
21
+ name: name
22
22
  }.delete_if { |_k, v| v.nil? || v == "" }
23
23
  data = service.create_application(options)
24
24
  merge_attributes(data)
@@ -21,9 +21,9 @@ module Fog
21
21
  attribute :account_id, aliases: "account", squash: "id"
22
22
  attribute :interface_id, aliases: "interface", squash: "id"
23
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"
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"
27
27
  attribute :port_translators
28
28
 
29
29
  # Attempt to map or point the Cloud IP to the destination resource.
@@ -32,14 +32,14 @@ module Fog
32
32
  #
33
33
  def map(destination)
34
34
  requires :identity
35
- if destination.respond_to?(:mapping_identity)
36
- final_destination = destination.mapping_identity
37
- elsif destination.respond_to?(:identity)
38
- final_destination = destination.identity
39
- else
40
- final_destination = destination
41
- end
42
- service.map_cloud_ip(identity, :destination => final_destination)
35
+ final_destination = if destination.respond_to?(:mapping_identity)
36
+ destination.mapping_identity
37
+ elsif destination.respond_to?(:identity)
38
+ destination.identity
39
+ else
40
+ destination
41
+ end
42
+ service.map_cloud_ip(identity, destination: final_destination)
43
43
  end
44
44
 
45
45
  def mapped?
@@ -27,11 +27,11 @@ module Fog
27
27
  end
28
28
 
29
29
  def save
30
- raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if identity
30
+ raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if identity
31
31
 
32
32
  options = {
33
- :role => role,
34
- :email => email
33
+ role: role,
34
+ email: email
35
35
  }.delete_if { |_k, v| v.nil? || v == "" }
36
36
 
37
37
  data = service.create_collaboration(options)
@@ -30,7 +30,7 @@ module Fog
30
30
  def invite(email, role)
31
31
  return nil if email.nil? || email == ""
32
32
  return nil if role.nil? || role == ""
33
- options = { :email => email, :role => role }
33
+ options = { email: email, role: role }
34
34
  data = service.create_collaboration(options)
35
35
  new(data)
36
36
  end
@@ -22,7 +22,7 @@ module Fog
22
22
  service.update_config_map(identity, options)
23
23
  else
24
24
  # create
25
- raise Fog::Errors::Error.new("'data' is required") if data.nil? || data.empty?
25
+ raise Fog::Errors::Error, "'data' is required" if data.nil? || data.empty?
26
26
  options[:data] = payload
27
27
  service.create_config_map(options)
28
28
  end
@@ -30,8 +30,7 @@ module Fog
30
30
  merge_attributes(res)
31
31
  true
32
32
  rescue StandardError => e
33
- raise Fog::Errors::Error.new(e.message)
34
- false
33
+ raise Fog::Errors::Error, e.message
35
34
  end
36
35
 
37
36
  def destroy
@@ -17,8 +17,8 @@ module Fog
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
20
+ attribute :maintenance_hour # , type: :integer
21
+ attribute :maintenance_weekday # , type: :integer
22
22
  attribute :source
23
23
 
24
24
  attribute :snapshots_retention, type: :string
@@ -44,8 +44,8 @@ module Fog
44
44
 
45
45
  def save
46
46
  options = {
47
- :name => name,
48
- :description => description
47
+ name: name,
48
+ description: description
49
49
  }
50
50
 
51
51
  options[:allow_access] = allow_access if allow_access
@@ -79,7 +79,7 @@ module Fog
79
79
  def snapshot(return_snapshot = false)
80
80
  requires :identity
81
81
 
82
- response, snapshot_id = service.snapshot_database_server(identity, :return_link => return_snapshot)
82
+ response, snapshot_id = service.snapshot_database_server(identity, return_link: return_snapshot)
83
83
  merge_attributes(response)
84
84
 
85
85
  if return_snapshot
@@ -95,12 +95,24 @@ module Fog
95
95
  true
96
96
  end
97
97
 
98
+ def reset
99
+ requires :identity
100
+ merge_attributes(service.reset_database_server(identity))
101
+ true
102
+ end
103
+
98
104
  def reset_password
99
105
  requires :identity
100
106
  merge_attributes(service.reset_password_database_server(identity))
101
107
  true
102
108
  end
103
109
 
110
+ def resize(new_type)
111
+ requires :identity
112
+ merge_attributes(service.resize_database_server(identity, new_type: new_type))
113
+ true
114
+ end
115
+
104
116
  private
105
117
 
106
118
  def create_database_server(options)
@@ -32,8 +32,8 @@ module Fog
32
32
 
33
33
  def save
34
34
  options = {
35
- :name => name,
36
- :description => description
35
+ name: name,
36
+ description: description
37
37
  }
38
38
  data = update_database_snapshot(options)
39
39
  merge_attributes(data)
@@ -23,11 +23,11 @@ module Fog
23
23
 
24
24
  # Sticking with existing Fog behaviour, save does not update but creates a new resource
25
25
  def save
26
- raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
26
+ raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
27
27
  options = {
28
- :server_group => server_group_id,
29
- :name => name,
30
- :description => description
28
+ server_group: server_group_id,
29
+ name: name,
30
+ description: description
31
31
  }.delete_if { |_k, v| v.nil? || v == "" }
32
32
  data = service.create_firewall_policy(options)
33
33
  merge_attributes(data)
@@ -37,7 +37,7 @@ module Fog
37
37
  def apply_to(server_group_id)
38
38
  requires :identity
39
39
  options = {
40
- :server_group => server_group_id
40
+ server_group: server_group_id
41
41
  }
42
42
  data = service.apply_to_firewall_policy(identity, options)
43
43
  merge_attributes(data)
@@ -47,7 +47,7 @@ module Fog
47
47
  def remove(server_group_id)
48
48
  requires :identity
49
49
  options = {
50
- :server_group => server_group_id
50
+ server_group: server_group_id
51
51
  }
52
52
  data = service.remove_firewall_policy(identity, options)
53
53
  merge_attributes(data)
@@ -23,17 +23,17 @@ module Fog
23
23
 
24
24
  # Sticking with existing Fog behaviour, save does not update but creates a new resource
25
25
  def save
26
- raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
26
+ raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
27
27
  requires :firewall_policy_id
28
28
  options = {
29
- :firewall_policy => firewall_policy_id,
30
- :protocol => protocol,
31
- :description => description,
32
- :source => source,
33
- :source_port => source_port,
34
- :destination => destination,
35
- :destination_port => destination_port,
36
- :icmp_type_name => icmp_type_name
29
+ firewall_policy: firewall_policy_id,
30
+ protocol: protocol,
31
+ description: description,
32
+ source: source,
33
+ source_port: source_port,
34
+ destination: destination,
35
+ destination_port: destination_port,
36
+ icmp_type_name: icmp_type_name
37
37
  }.delete_if { |_k, v| v.nil? || v == "" }
38
38
  data = service.create_firewall_rule(options)
39
39
  merge_attributes(data)
@@ -42,17 +42,17 @@ module Fog
42
42
  end
43
43
 
44
44
  def save
45
- raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
45
+ raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
46
46
 
47
47
  options = {
48
- :arch => arch,
49
- :description => description,
50
- :http_url => http_url,
51
- :name => name,
52
- :server => server,
53
- :source => source,
54
- :username => username,
55
- :volume => volume
48
+ arch: arch,
49
+ description: description,
50
+ http_url: http_url,
51
+ name: name,
52
+ server: server,
53
+ source: source,
54
+ username: username,
55
+ volume: volume
56
56
  }.delete_if { |_k, v| v.nil? || v == "" }
57
57
  data = service.create_image(options)
58
58
  merge_attributes(data)
@@ -52,20 +52,20 @@ module Fog
52
52
  end
53
53
 
54
54
  def save
55
- raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
55
+ raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
56
56
  requires :nodes, :listeners, :healthcheck
57
57
  options = {
58
- :nodes => nodes,
59
- :listeners => listeners,
60
- :healthcheck => healthcheck,
61
- :policy => policy,
62
- :name => name,
63
- :domains => domains,
64
- :buffer_size => buffer_size,
65
- :certificate_pem => certificate_pem,
66
- :certificate_private_key => certificate_private_key,
67
- :ssl_minimum_version => ssl_minimum_version,
68
- :sslv3 => ssl3?
58
+ nodes: nodes,
59
+ listeners: listeners,
60
+ healthcheck: healthcheck,
61
+ policy: policy,
62
+ name: name,
63
+ domains: domains,
64
+ buffer_size: buffer_size,
65
+ certificate_pem: certificate_pem,
66
+ certificate_private_key: certificate_private_key,
67
+ ssl_minimum_version: ssl_minimum_version,
68
+ sslv3: ssl3?
69
69
  }.delete_if { |_k, v| v.nil? || v == "" }
70
70
  data = service.create_load_balancer(options)
71
71
  merge_attributes(data)