fog-brightbox 1.10.0 → 1.12.0
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 +20 -3
- data/.rubocop.yml +15 -10
- data/CHANGELOG.md +34 -0
- data/README.md +6 -0
- data/Rakefile +1 -1
- data/fog-brightbox.gemspec +9 -3
- data/lib/fog/brightbox/compute/shared.rb +11 -10
- data/lib/fog/brightbox/compute.rb +20 -21
- data/lib/fog/brightbox/config.rb +6 -9
- data/lib/fog/brightbox/models/compute/api_client.rb +4 -4
- data/lib/fog/brightbox/models/compute/application.rb +2 -2
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +11 -11
- data/lib/fog/brightbox/models/compute/collaboration.rb +3 -3
- data/lib/fog/brightbox/models/compute/collaborations.rb +1 -1
- data/lib/fog/brightbox/models/compute/config_map.rb +2 -3
- data/lib/fog/brightbox/models/compute/database_server.rb +17 -5
- data/lib/fog/brightbox/models/compute/database_snapshot.rb +2 -2
- data/lib/fog/brightbox/models/compute/firewall_policy.rb +6 -6
- data/lib/fog/brightbox/models/compute/firewall_rule.rb +9 -9
- data/lib/fog/brightbox/models/compute/image.rb +9 -9
- data/lib/fog/brightbox/models/compute/load_balancer.rb +12 -12
- data/lib/fog/brightbox/models/compute/server.rb +21 -23
- data/lib/fog/brightbox/models/compute/server_group.rb +6 -6
- data/lib/fog/brightbox/models/compute/user.rb +3 -3
- data/lib/fog/brightbox/models/compute/volume.rb +16 -16
- data/lib/fog/brightbox/models/storage/directories.rb +2 -2
- data/lib/fog/brightbox/models/storage/directory.rb +7 -7
- data/lib/fog/brightbox/models/storage/file.rb +13 -13
- data/lib/fog/brightbox/models/storage/files.rb +9 -13
- data/lib/fog/brightbox/oauth2.rb +13 -11
- data/lib/fog/brightbox/requests/compute/list_accounts.rb +1 -1
- data/lib/fog/brightbox/requests/compute/reset_database_server.rb +21 -0
- data/lib/fog/brightbox/requests/compute/resize_database_server.rb +25 -0
- data/lib/fog/brightbox/requests/compute/snapshot_database_server.rb +1 -1
- data/lib/fog/brightbox/requests/compute/snapshot_server.rb +1 -1
- data/lib/fog/brightbox/requests/storage/copy_object.rb +5 -5
- data/lib/fog/brightbox/requests/storage/delete_container.rb +3 -3
- data/lib/fog/brightbox/requests/storage/delete_multiple_objects.rb +7 -7
- data/lib/fog/brightbox/requests/storage/delete_object.rb +3 -3
- data/lib/fog/brightbox/requests/storage/delete_static_large_object.rb +6 -6
- data/lib/fog/brightbox/requests/storage/get_container.rb +4 -4
- data/lib/fog/brightbox/requests/storage/get_containers.rb +4 -4
- data/lib/fog/brightbox/requests/storage/get_object.rb +4 -6
- data/lib/fog/brightbox/requests/storage/get_object_http_url.rb +1 -1
- data/lib/fog/brightbox/requests/storage/get_object_https_url.rb +1 -1
- data/lib/fog/brightbox/requests/storage/head_container.rb +4 -4
- data/lib/fog/brightbox/requests/storage/head_containers.rb +4 -4
- data/lib/fog/brightbox/requests/storage/head_object.rb +3 -3
- data/lib/fog/brightbox/requests/storage/post_set_meta_temp_url_key.rb +3 -3
- data/lib/fog/brightbox/requests/storage/put_container.rb +4 -4
- data/lib/fog/brightbox/requests/storage/put_dynamic_obj_manifest.rb +4 -4
- data/lib/fog/brightbox/requests/storage/put_object.rb +7 -7
- data/lib/fog/brightbox/requests/storage/put_static_obj_manifest.rb +6 -6
- data/lib/fog/brightbox/storage/authentication_request.rb +4 -4
- data/lib/fog/brightbox/storage/connection.rb +2 -2
- data/lib/fog/brightbox/storage.rb +13 -14
- data/lib/fog/brightbox/version.rb +1 -1
- data/spec/fog/brightbox/compute/config_spec.rb +4 -4
- data/spec/fog/brightbox/compute/get_access_token_spec.rb +28 -28
- data/spec/fog/brightbox/compute/wrapped_request_spec.rb +23 -23
- data/spec/fog/brightbox/config_spec.rb +23 -23
- data/spec/fog/brightbox/oauth2/client_credentials_strategy_spec.rb +2 -2
- data/spec/fog/brightbox/oauth2/credential_set_spec.rb +5 -5
- data/spec/fog/brightbox/oauth2/grant_type_strategy_spec.rb +2 -2
- data/spec/fog/brightbox/oauth2/refresh_token_strategy_spec.rb +3 -3
- data/spec/fog/brightbox/oauth2/user_credentials_strategy_spec.rb +4 -4
- data/spec/fog/brightbox/storage/authentication_request_spec.rb +41 -34
- data/spec/fog/brightbox/storage/config_spec.rb +4 -4
- data/spec/fog/brightbox/storage/connection_errors_spec.rb +6 -6
- data/spec/fog/brightbox/storage/connection_spec.rb +37 -37
- data/spec/fog/brightbox/storage/directory_spec.rb +6 -6
- data/spec/fog/brightbox/storage/files_spec.rb +5 -5
- data/spec/fog/brightbox/storage_spec.rb +5 -5
- data/spec/fog/compute/brightbox/database_server_spec.rb +19 -19
- data/spec/fog/compute/brightbox/image_selector_spec.rb +18 -18
- data/spec/fog/compute/brightbox/load_balancer_spec.rb +5 -5
- data/spec/fog/compute/brightbox/server_spec.rb +44 -44
- data/spec/fog/compute/brightbox/volume_spec.rb +68 -69
- data/spec/fog/compute/brightbox_spec.rb +16 -10
- data/spec/fog/storage/brightbox_spec.rb +83 -83
- data/spec/model_setup.rb +9 -9
- data/spec/stock_storage_responses.rb +9 -9
- data/spec/supports_resource_locking.rb +6 -6
- data/tests/brightbox/compute/schema.rb +74 -74
- data/tests/brightbox/compute_tests.rb +14 -14
- data/tests/brightbox/models/compute/account_tests.rb +0 -10
- data/tests/brightbox/models/compute/server_tests.rb +0 -1
- data/tests/brightbox/requests/compute/account_tests.rb +7 -21
- data/tests/brightbox/requests/compute/api_client_tests.rb +9 -9
- data/tests/brightbox/requests/compute/application_test.rb +8 -8
- data/tests/brightbox/requests/compute/cloud_ip_tests.rb +11 -13
- data/tests/brightbox/requests/compute/collaboration_tests.rb +1 -1
- data/tests/brightbox/requests/compute/database_server_tests.rb +7 -7
- data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +5 -5
- data/tests/brightbox/requests/compute/database_type_tests.rb +1 -1
- data/tests/brightbox/requests/compute/firewall_policy_tests.rb +7 -7
- data/tests/brightbox/requests/compute/firewall_rule_tests.rb +8 -10
- data/tests/brightbox/requests/compute/helper.rb +1 -1
- data/tests/brightbox/requests/compute/image_tests.rb +2 -2
- data/tests/brightbox/requests/compute/interface_tests.rb +1 -1
- data/tests/brightbox/requests/compute/load_balancer_tests.rb +23 -23
- data/tests/brightbox/requests/compute/server_group_tests.rb +16 -18
- data/tests/brightbox/requests/compute/server_tests.rb +12 -12
- data/tests/brightbox/requests/compute/server_type_tests.rb +2 -2
- data/tests/brightbox/requests/compute/user_tests.rb +4 -4
- data/tests/brightbox/requests/compute/volume_tests.rb +5 -5
- data/tests/brightbox/requests/compute/zone_tests.rb +2 -2
- data/tests/helper.rb +1 -1
- data/tests/helpers/collection_helper.rb +16 -23
- data/tests/helpers/compute/server_helper.rb +4 -6
- data/tests/helpers/formats_helper.rb +5 -5
- data/tests/helpers/formats_helper_tests.rb +16 -16
- data/tests/helpers/mock_helper.rb +84 -86
- data/tests/helpers/model_helper.rb +1 -3
- data/tests/helpers/schema_validator_tests.rb +14 -14
- metadata +22 -7
- data/.rubocop_todo.yml +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fdadbc0fea3aa4cedbd5f80c7cd921ff302304f18a10b4d00a95bfb62f8c01f
|
4
|
+
data.tar.gz: eb5f3540d35cee35994ffe5468c3b6bc6abd6668ca3aa8748f01aa6554e594bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 822ae83ee99e51772dc7d201f8ad0afe12276301b0c548284cb29dc6d64ce8a4204efc946011ab9f756a00d2d0dd0f044ee75538e262f723b94c71703ed9a755
|
7
|
+
data.tar.gz: 01c48ca96800eb5d830bde46306ec25adbc2bc60dad60fd7b667e7677e2b2843e28da151830cb901555b44ce3a609d83cc9fea5aa2c7c80270e78b5aa5452dd9
|
data/.github/workflows/ruby.yml
CHANGED
@@ -15,12 +15,11 @@ on:
|
|
15
15
|
|
16
16
|
jobs:
|
17
17
|
test:
|
18
|
-
|
19
18
|
runs-on: ubuntu-latest
|
20
19
|
strategy:
|
20
|
+
fail-fast: false
|
21
21
|
matrix:
|
22
|
-
ruby-version: ["2.
|
23
|
-
|
22
|
+
ruby-version: ["2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "head"]
|
24
23
|
steps:
|
25
24
|
- uses: actions/checkout@v2
|
26
25
|
- name: Set up Ruby
|
@@ -32,3 +31,21 @@ jobs:
|
|
32
31
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
33
32
|
- name: Run tests
|
34
33
|
run: bundle exec rake
|
34
|
+
|
35
|
+
test-old:
|
36
|
+
runs-on: ubuntu-20.04
|
37
|
+
strategy:
|
38
|
+
fail-fast: false
|
39
|
+
matrix:
|
40
|
+
ruby-version: ["2.3"]
|
41
|
+
steps:
|
42
|
+
- uses: actions/checkout@v2
|
43
|
+
- name: Set up Ruby
|
44
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
45
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
46
|
+
uses: ruby/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: ${{ matrix.ruby-version }}
|
49
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
50
|
+
- name: Run tests
|
51
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,20 +1,25 @@
|
|
1
|
-
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.0
|
2
3
|
|
3
|
-
|
4
|
-
EnforcedStyle: hash_rockets
|
5
|
-
|
6
|
-
LineLength:
|
4
|
+
Metrics/LineLength:
|
7
5
|
Max: 100
|
8
6
|
Enabled: false
|
9
7
|
|
10
|
-
|
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
|
-
|
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,37 @@
|
|
1
|
+
### 1.12.0 / 2024-12-10
|
2
|
+
|
3
|
+
Bug fixes:
|
4
|
+
|
5
|
+
* Declare `Excon[:omit_default_port]` to fix specs matching on headers
|
6
|
+
that vary based on the Ruby version and the discovered Excon version's
|
7
|
+
default behaviour
|
8
|
+
* Explicitly require `base64` in authentication code
|
9
|
+
* Require `base64` gem for Ruby 3.4 as it is no longer in stdlib
|
10
|
+
* Remove `rubocop` version dependency as it is a development tool
|
11
|
+
|
12
|
+
Changes:
|
13
|
+
|
14
|
+
* Soft deprecation of Ruby 2.1 and 2.2 due to upstream constraints
|
15
|
+
* Updated CI testing matrix for supported versions
|
16
|
+
* Remove specs related to legacy FTP image uploading
|
17
|
+
|
18
|
+
### 1.11.0 / 2023-01-26
|
19
|
+
|
20
|
+
Enhancements:
|
21
|
+
|
22
|
+
* Add `DatabaseServer#reset` and `#resize` methods
|
23
|
+
* Added requests to support database server resets and resizing
|
24
|
+
|
25
|
+
Bug fixes:
|
26
|
+
|
27
|
+
* Remove duplicated request references
|
28
|
+
* Fix test method declaration causing parsing error in Ruby 2.0
|
29
|
+
|
30
|
+
Changes:
|
31
|
+
|
32
|
+
* Added `rubocop` gem configured to Ruby 2.0
|
33
|
+
* Cleaning up of codebase to fix various style and layout problems
|
34
|
+
|
1
35
|
### 1.10.0 / 2023-01-24
|
2
36
|
|
3
37
|
Enhancements:
|
data/README.md
CHANGED
@@ -44,6 +44,12 @@ and its modules:
|
|
44
44
|
As required by the main `fog-core` library, support for Ruby 1.9 was dropped in
|
45
45
|
`v1.0.0` of this gem.
|
46
46
|
|
47
|
+
Upstream changes on dependencies have resulted in support failing for Ruby <2.3
|
48
|
+
from `v1.12.0` due to some libraries failing to declare usage of newer language
|
49
|
+
features in their own gemspec files.
|
50
|
+
|
51
|
+
As of 2024 `fog-core` is only testing for Ruby 3.0+ support.
|
52
|
+
|
47
53
|
## Contributing
|
48
54
|
|
49
55
|
1. Fork it ( https://github.com/fog/fog-brightbox/fork )
|
data/Rakefile
CHANGED
data/fog-brightbox.gemspec
CHANGED
@@ -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 =
|
12
|
-
spec.summary =
|
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
|
|
@@ -21,6 +22,10 @@ Gem::Specification.new do |spec|
|
|
21
22
|
|
22
23
|
spec.required_ruby_version = ">= 2.0"
|
23
24
|
|
25
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4")
|
26
|
+
spec.add_dependency "base64"
|
27
|
+
end
|
28
|
+
|
24
29
|
spec.add_dependency "fog-core", ">= 1.45", "< 3.0"
|
25
30
|
spec.add_dependency "fog-json"
|
26
31
|
spec.add_dependency "dry-inflector"
|
@@ -29,6 +34,7 @@ Gem::Specification.new do |spec|
|
|
29
34
|
spec.add_development_dependency "minitest"
|
30
35
|
spec.add_development_dependency "pry"
|
31
36
|
spec.add_development_dependency "rake"
|
37
|
+
spec.add_development_dependency "rubocop"
|
32
38
|
spec.add_development_dependency "shindo"
|
33
39
|
spec.add_development_dependency "webmock"
|
34
40
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
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(:
|
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
|
-
|
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
|
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 :
|
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
|
-
:
|
290
|
-
:
|
291
|
-
:
|
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
|
299
|
-
query
|
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?
|
data/lib/fog/brightbox/config.rb
CHANGED
@@ -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
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
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
|
-
|
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.
|
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
|
22
|
+
raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
|
23
23
|
options = {
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
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
|
19
|
+
raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
|
20
20
|
options = {
|
21
|
-
:
|
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, :
|
25
|
-
attribute :server_group, :
|
26
|
-
attribute :database_server, :
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
service.map_cloud_ip(identity, :
|
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
|
30
|
+
raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if identity
|
31
31
|
|
32
32
|
options = {
|
33
|
-
:
|
34
|
-
:
|
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 = { :
|
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
|
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
|
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
|
21
|
-
attribute :maintenance_weekday
|
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
|
-
:
|
48
|
-
:
|
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, :
|
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)
|
@@ -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
|
26
|
+
raise Fog::Errors::Error, "Resaving an existing object may create a duplicate" if persisted?
|
27
27
|
options = {
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
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
|
-
:
|
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
|
-
:
|
50
|
+
server_group: server_group_id
|
51
51
|
}
|
52
52
|
data = service.remove_firewall_policy(identity, options)
|
53
53
|
merge_attributes(data)
|