scalingo 3.2.0 → 3.4.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 +1 -1
- data/CHANGELOG.md +9 -0
- data/README.md +5 -1
- data/lib/scalingo/core_client.rb +7 -0
- data/lib/scalingo/regional_database/backups.rb +1 -1
- data/lib/scalingo/regional_database/databases.rb +13 -0
- data/lib/scalingo/version.rb +1 -1
- data/samples/regional_database/backups/_meta.json +1 -1
- data/samples/regional_database/backups/archive-200.json +2 -2
- data/samples/regional_database/backups/archive-400.json +1 -1
- data/samples/regional_database/backups/create-201.json +10 -8
- data/samples/regional_database/backups/create-400.json +1 -1
- data/samples/regional_database/backups/for-200.json +1 -1
- data/samples/regional_database/backups/for-400.json +1 -1
- data/samples/regional_database/databases/_meta.json +1 -1
- data/samples/regional_database/databases/find-200.json +5 -3
- data/samples/regional_database/databases/find-400.json +1 -1
- data/samples/regional_database/databases/upgrade-202.json +39 -0
- data/samples/regional_database/databases/upgrade-400.json +24 -0
- data/spec/scalingo/core_client_spec.rb +23 -0
- data/spec/scalingo/regional_database/databases_spec.rb +16 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90d46c83c5910349a51d707d80748ed81a542947e95397ce34f52c0f75a0bd56
|
4
|
+
data.tar.gz: e6e2840344c04d9ea78ef69dbfadfb601f4dd1c7c62f3af511c16a0652f6b1d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f166cbc46cd1ef4237e72765fb69348374f1c0d5f6e42bc3c544ff2f8926c3832a115d135241e2f3dd5a679297ce9b5a0196af80660d189d57aba3b9b11ab3f
|
7
|
+
data.tar.gz: f261a4617f0dc6f8ef3158ac918386020bb6243d93a89f315efb1a338bc7348287f23d7ae3307f61c9e29eef673f4fe41c23343d168cc3fd8ebb526530b15187
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
+
## 3.4.0 - 2023-01-26
|
4
|
+
|
5
|
+
* New: Add `databases#upgrade` endpoint for database API ([#51](https://github.com/Scalingo/scalingo-ruby-api/pull/51))
|
6
|
+
|
7
|
+
## 3.3.0 - 2023-01-03
|
8
|
+
|
9
|
+
* Bugfix: response of Backups#create was not properly unpacked ([#44](https://github.com/Scalingo/scalingo-ruby-api/issues/44))
|
10
|
+
* New: Add default region for database API ([#45](https://github.com/Scalingo/scalingo-ruby-api/issues/44))
|
11
|
+
|
3
12
|
## 3.2.0 - 2022-12-23
|
4
13
|
|
5
14
|
* Removal: `Scalingo::Client#agora_fr1` had been removed since the region no longer exists.
|
data/README.md
CHANGED
@@ -174,6 +174,10 @@ scalingo.db_api_osc_fr1.backups.for(addon_id)
|
|
174
174
|
|
175
175
|
# get URL to download backup archive
|
176
176
|
scalingo.db_api_osc_fr1.backups.archive(addon_id, backup_id)
|
177
|
+
|
178
|
+
# you can omit the region to use the default one
|
179
|
+
scalingo.databases.find(addon_id)
|
180
|
+
|
177
181
|
```
|
178
182
|
|
179
183
|
## Development
|
@@ -187,7 +191,7 @@ bundle
|
|
187
191
|
### Run tests
|
188
192
|
|
189
193
|
```bash
|
190
|
-
bundle exec
|
194
|
+
bundle exec rspec
|
191
195
|
```
|
192
196
|
|
193
197
|
### Release a new version
|
data/lib/scalingo/core_client.rb
CHANGED
@@ -41,6 +41,10 @@ module Scalingo
|
|
41
41
|
public_send(name || config.default_region)
|
42
42
|
end
|
43
43
|
|
44
|
+
def database_region(name = nil)
|
45
|
+
public_send(name || "db_api_#{config.default_region}")
|
46
|
+
end
|
47
|
+
|
44
48
|
## Authentication helpers / Token management
|
45
49
|
def authenticate_with(access_token: nil, bearer_token: nil, expires_at: nil)
|
46
50
|
if !access_token && !bearer_token
|
@@ -102,5 +106,8 @@ module Scalingo
|
|
102
106
|
def_delegator :region, :notifiers
|
103
107
|
def_delegator :region, :operations
|
104
108
|
def_delegator :region, :scm_repo_links
|
109
|
+
|
110
|
+
def_delegator :database_region, :databases
|
111
|
+
def_delegator :database_region, :backups
|
105
112
|
end
|
106
113
|
end
|
@@ -14,5 +14,18 @@ module Scalingo
|
|
14
14
|
|
15
15
|
unpack(:database) { response }
|
16
16
|
end
|
17
|
+
|
18
|
+
def upgrade(id, headers = nil, &block)
|
19
|
+
data = nil
|
20
|
+
|
21
|
+
response = database_connection(id).post(
|
22
|
+
"databases/#{id}/upgrade",
|
23
|
+
data,
|
24
|
+
headers,
|
25
|
+
&block
|
26
|
+
)
|
27
|
+
|
28
|
+
unpack(:database) { response }
|
29
|
+
end
|
17
30
|
end
|
18
31
|
end
|
data/lib/scalingo/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"path": "/databases/
|
2
|
+
"path": "/databases/63bfe3b600deff4f0516cc12/backups/5bb95a904ffb096e9a2831b8/archive",
|
3
3
|
"method": "get",
|
4
4
|
"request": {
|
5
5
|
"headers": {
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"Referrer-Policy": "strict-origin-when-cross-origin"
|
19
19
|
},
|
20
20
|
"json_body": {
|
21
|
-
"download_url": "https://regional-database.scalingo.test/databases/
|
21
|
+
"download_url": "https://regional-database.scalingo.test/databases/63bfe3b600deff4f0516cc12/backups/5bb95a904ffb096e9a2831b8/download?token=token1234"
|
22
22
|
}
|
23
23
|
}
|
24
24
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"path": "/databases/
|
2
|
+
"path": "/databases/63bfe3b600deff4f0516cc12/backups",
|
3
3
|
"method": "post",
|
4
4
|
"request": {
|
5
5
|
"headers": {
|
@@ -18,13 +18,15 @@
|
|
18
18
|
"Referrer-Policy": "strict-origin-when-cross-origin"
|
19
19
|
},
|
20
20
|
"json_body": {
|
21
|
-
"
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
"database_backup": {
|
22
|
+
"id": "5b8b36104ffb090be1ac3ce1",
|
23
|
+
"created_at": "2019-07-18T03:00:00.178+02:00",
|
24
|
+
"name": "20180902010000_kibana-3938",
|
25
|
+
"size": 0,
|
26
|
+
"status": "pending",
|
27
|
+
"database_id": "597601234ffb097af4f3099b",
|
28
|
+
"type": "postgresql"
|
29
|
+
}
|
28
30
|
}
|
29
31
|
}
|
30
32
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"path": "/databases/
|
2
|
+
"path": "/databases/63bfe3b600deff4f0516cc12",
|
3
3
|
"method": "get",
|
4
4
|
"request": {
|
5
5
|
"headers": {
|
@@ -19,7 +19,7 @@
|
|
19
19
|
},
|
20
20
|
"json_body": {
|
21
21
|
"database": {
|
22
|
-
"id": "
|
22
|
+
"id": "63bfe3b600deff4f0516cc12",
|
23
23
|
"resource_id": "my-db-123",
|
24
24
|
"app_name": "my-app",
|
25
25
|
"created_at": "2019-02-05T15:38:14.343+01:00",
|
@@ -38,7 +38,9 @@
|
|
38
38
|
"instances": [],
|
39
39
|
"readable_version": "3.2.9-1",
|
40
40
|
"periodic_backups_enabled": true,
|
41
|
-
"periodic_backups_scheduled_at": [
|
41
|
+
"periodic_backups_scheduled_at": [
|
42
|
+
0
|
43
|
+
]
|
42
44
|
}
|
43
45
|
}
|
44
46
|
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"path": "/databases/63bfe3b600deff4f0516cc12/upgrade",
|
3
|
+
"method": "post",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Authorization": "Bearer the-bearer-token"
|
7
|
+
}
|
8
|
+
},
|
9
|
+
"response": {
|
10
|
+
"status": 202,
|
11
|
+
"headers": {
|
12
|
+
"Date": "Fri, 29 May 2020 13:08:59 GMT",
|
13
|
+
"Etag": "W/\"a9504bb2f6f87c65ff68074ae787831e\"",
|
14
|
+
"Content-Type": "application/json; charset=utf-8",
|
15
|
+
"Transfer-Encoding": "chunked",
|
16
|
+
"Connection": "keep-alive",
|
17
|
+
"Cache-Control": "max-age=0, private, must-revalidate",
|
18
|
+
"Referrer-Policy": "strict-origin-when-cross-origin",
|
19
|
+
"Location": "https://db-api.osc-st-fr1.st-sc.fr/api/operations/63bef2179307d55a9658cd99"
|
20
|
+
},
|
21
|
+
"json_body": {
|
22
|
+
"message": "Database upgrade to 7.0.5-1 is pending",
|
23
|
+
"id": "6335961fb07f4c000fe7461c",
|
24
|
+
"created_at": "2022-09-29T12:57:03.372Z",
|
25
|
+
"updated_at": "2022-09-29T12:57:03.372Z",
|
26
|
+
"database_type_id": "5eea3345d6f2bd5a55e2aad0",
|
27
|
+
"major": 7,
|
28
|
+
"minor": 0,
|
29
|
+
"patch": 5,
|
30
|
+
"build": 1,
|
31
|
+
"features": [
|
32
|
+
"tls"
|
33
|
+
],
|
34
|
+
"release_number": 330,
|
35
|
+
"allowed_plugins": null,
|
36
|
+
"warning_message": ""
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"path": "/databases/63bfe3b600deff4f0516cc12/upgrade",
|
3
|
+
"method": "post",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Authorization": "Bearer the-bearer-token"
|
7
|
+
}
|
8
|
+
},
|
9
|
+
"response": {
|
10
|
+
"status": 400,
|
11
|
+
"headers": {
|
12
|
+
"Date": "Fri, 29 May 2020 13:08:59 GMT",
|
13
|
+
"Etag": "W/\"a9504bb2f6f87c65ff68074ae787831e\"",
|
14
|
+
"Content-Type": "application/json; charset=utf-8",
|
15
|
+
"Transfer-Encoding": "chunked",
|
16
|
+
"Connection": "keep-alive",
|
17
|
+
"Cache-Control": "max-age=0, private, must-revalidate",
|
18
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
19
|
+
},
|
20
|
+
"json_body": {
|
21
|
+
"error": "unauthorized"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::CoreClient do
|
4
|
+
subject { described_class.new }
|
5
|
+
|
6
|
+
describe "#database_region" do
|
7
|
+
it "forwards call to the specified region" do
|
8
|
+
allow(subject).to receive("db_api_osc_secnum_fr1")
|
9
|
+
|
10
|
+
subject.database_region("db_api_osc_secnum_fr1")
|
11
|
+
|
12
|
+
expect(subject).to have_received("db_api_osc_secnum_fr1")
|
13
|
+
end
|
14
|
+
|
15
|
+
it "forwards call to default db_api region" do
|
16
|
+
allow(subject).to receive("db_api_#{subject.config.default_region}")
|
17
|
+
|
18
|
+
subject.database_region
|
19
|
+
|
20
|
+
expect(subject).to have_received("db_api_#{subject.config.default_region}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -20,4 +20,20 @@ RSpec.describe Scalingo::RegionalDatabase::Databases do
|
|
20
20
|
it_behaves_like "a client error"
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
describe_method "upgrade" do
|
25
|
+
context "success" do
|
26
|
+
let(:arguments) { [meta[:id]] }
|
27
|
+
let(:stub_pattern) { "upgrade-202" }
|
28
|
+
|
29
|
+
it_behaves_like "a singular object response", 202
|
30
|
+
end
|
31
|
+
|
32
|
+
context "failure" do
|
33
|
+
let(:arguments) { [meta[:id]] }
|
34
|
+
let(:stub_pattern) { "upgrade-400" }
|
35
|
+
|
36
|
+
it_behaves_like "a client error"
|
37
|
+
end
|
38
|
+
end
|
23
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scalingo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Unbekandt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -428,6 +428,8 @@ files:
|
|
428
428
|
- samples/regional_database/databases/_meta.json
|
429
429
|
- samples/regional_database/databases/find-200.json
|
430
430
|
- samples/regional_database/databases/find-400.json
|
431
|
+
- samples/regional_database/databases/upgrade-202.json
|
432
|
+
- samples/regional_database/databases/upgrade-400.json
|
431
433
|
- scalingo.gemspec
|
432
434
|
- spec/scalingo/api/client_spec.rb
|
433
435
|
- spec/scalingo/api/endpoint_spec.rb
|
@@ -443,6 +445,7 @@ files:
|
|
443
445
|
- spec/scalingo/billing_spec.rb
|
444
446
|
- spec/scalingo/client_spec.rb
|
445
447
|
- spec/scalingo/configuration_spec.rb
|
448
|
+
- spec/scalingo/core_client_spec.rb
|
446
449
|
- spec/scalingo/regional/addons_spec.rb
|
447
450
|
- spec/scalingo/regional/apps_spec.rb
|
448
451
|
- spec/scalingo/regional/autoscalers_spec.rb
|
@@ -486,7 +489,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
489
|
- !ruby/object:Gem::Version
|
487
490
|
version: '0'
|
488
491
|
requirements: []
|
489
|
-
rubygems_version: 3.
|
492
|
+
rubygems_version: 3.4.1
|
490
493
|
signing_key:
|
491
494
|
specification_version: 4
|
492
495
|
summary: Ruby client for Scalingo APIs
|
@@ -505,6 +508,7 @@ test_files:
|
|
505
508
|
- spec/scalingo/billing_spec.rb
|
506
509
|
- spec/scalingo/client_spec.rb
|
507
510
|
- spec/scalingo/configuration_spec.rb
|
511
|
+
- spec/scalingo/core_client_spec.rb
|
508
512
|
- spec/scalingo/regional/addons_spec.rb
|
509
513
|
- spec/scalingo/regional/apps_spec.rb
|
510
514
|
- spec/scalingo/regional/autoscalers_spec.rb
|