scalingo 3.0.0.beta.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +1 -6
- data/lib/scalingo/auth/user.rb +13 -0
- data/lib/scalingo/regional.rb +2 -0
- data/lib/scalingo/regional/autoscalers.rb +70 -0
- data/lib/scalingo/version.rb +1 -1
- data/samples/auth/user/stop-free-trial.json +24 -0
- data/samples/regional/autoscalers/_meta.json +27 -0
- data/samples/regional/autoscalers/create-201.json +49 -0
- data/samples/regional/autoscalers/create-500.json +32 -0
- data/samples/regional/autoscalers/destroy-204.json +20 -0
- data/samples/regional/autoscalers/destroy-404.json +25 -0
- data/samples/regional/autoscalers/find-200.json +39 -0
- data/samples/regional/autoscalers/find-404.json +25 -0
- data/samples/regional/autoscalers/for-200.json +41 -0
- data/samples/regional/autoscalers/update-200.json +45 -0
- data/samples/regional/autoscalers/update-404.json +31 -0
- data/samples/regional/autoscalers/update-500.json +30 -0
- data/scalingo.gemspec +2 -3
- data/spec/scalingo/auth/user_spec.rb +6 -0
- data/spec/scalingo/regional/autoscalers_spec.rb +84 -0
- data/spec/scalingo/regional_spec.rb +2 -2
- metadata +30 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 888ac51dbfb37ca019f77fd142a1243719d957472802b57ab928020db57b5998
|
4
|
+
data.tar.gz: 764d9825719123b3140a7caab2fa6a45b05669c83d70247cc689f524d4f4f49d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02fc7e709e9fff36442f74727f71f01de94bdca37c307f59fb01f2bc837145d4c3c527e0c3633931789007baa79a1eb62effbd84d165c7d7456b76fdcfbff521
|
7
|
+
data.tar.gz: 791a7f54c8fa380a5c96d8be8da56beb7f2ae517a69a7976abf92e4c43bbd293e5189cc0b2ac6c48ce73fed8ab172ddacde9788d4e9d10e073796a0cb4a3a4cb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -10,15 +10,10 @@ will therefore be `3.x.x`.
|
|
10
10
|
|
11
11
|
You can check the version 2 at [the v2 branch of this repository](https://github.com/Scalingo/scalingo-ruby-api/tree/v2)
|
12
12
|
|
13
|
-
### The road to 3.0.0
|
14
|
-
|
15
|
-
This gem is still in beta version, but its API should not change a lot until a final release.
|
16
|
-
[This issue tracks the remaining work](https://github.com/Scalingo/scalingo-ruby-api/issues/13).
|
17
|
-
|
18
13
|
## Installation
|
19
14
|
|
20
15
|
```ruby
|
21
|
-
gem "scalingo", "3.0.0
|
16
|
+
gem "scalingo", "3.0.0"
|
22
17
|
```
|
23
18
|
|
24
19
|
And then execute:
|
data/lib/scalingo/auth/user.rb
CHANGED
@@ -27,5 +27,18 @@ module Scalingo
|
|
27
27
|
|
28
28
|
unpack(:user) { response }
|
29
29
|
end
|
30
|
+
|
31
|
+
def stop_free_trial(headers = nil, &block)
|
32
|
+
data = nil
|
33
|
+
|
34
|
+
response = connection.post(
|
35
|
+
"users/stop_free_trial",
|
36
|
+
data,
|
37
|
+
headers,
|
38
|
+
&block
|
39
|
+
)
|
40
|
+
|
41
|
+
unpack { response }
|
42
|
+
end
|
30
43
|
end
|
31
44
|
end
|
data/lib/scalingo/regional.rb
CHANGED
@@ -4,6 +4,7 @@ module Scalingo
|
|
4
4
|
class Regional < API::Client
|
5
5
|
require "scalingo/regional/addons"
|
6
6
|
require "scalingo/regional/apps"
|
7
|
+
require "scalingo/regional/autoscalers"
|
7
8
|
require "scalingo/regional/collaborators"
|
8
9
|
require "scalingo/regional/containers"
|
9
10
|
require "scalingo/regional/deployments"
|
@@ -19,6 +20,7 @@ module Scalingo
|
|
19
20
|
register_handlers!(
|
20
21
|
addons: Addons,
|
21
22
|
apps: Apps,
|
23
|
+
autoscalers: Autoscalers,
|
22
24
|
collaborators: Collaborators,
|
23
25
|
containers: Containers,
|
24
26
|
deployments: Deployments,
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require "scalingo/api/endpoint"
|
2
|
+
|
3
|
+
module Scalingo
|
4
|
+
class Regional::Autoscalers < API::Endpoint
|
5
|
+
def for(app_id, headers = nil, &block)
|
6
|
+
data = nil
|
7
|
+
|
8
|
+
response = connection.get(
|
9
|
+
"apps/#{app_id}/autoscalers",
|
10
|
+
data,
|
11
|
+
headers,
|
12
|
+
&block
|
13
|
+
)
|
14
|
+
|
15
|
+
unpack(:autoscalers) { response }
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(app_id, autoscaler_id, headers = nil, &block)
|
19
|
+
data = nil
|
20
|
+
|
21
|
+
response = connection.get(
|
22
|
+
"apps/#{app_id}/autoscalers/#{autoscaler_id}",
|
23
|
+
data,
|
24
|
+
headers,
|
25
|
+
&block
|
26
|
+
)
|
27
|
+
|
28
|
+
unpack(:autoscaler) { response }
|
29
|
+
end
|
30
|
+
|
31
|
+
def create(app_id, payload = {}, headers = nil, &block)
|
32
|
+
data = {autoscaler: payload}
|
33
|
+
|
34
|
+
response = connection.post(
|
35
|
+
"apps/#{app_id}/autoscalers",
|
36
|
+
data,
|
37
|
+
headers,
|
38
|
+
&block
|
39
|
+
)
|
40
|
+
|
41
|
+
unpack(:autoscaler) { response }
|
42
|
+
end
|
43
|
+
|
44
|
+
def update(app_id, autoscaler_id, payload = {}, headers = nil, &block)
|
45
|
+
data = {autoscaler: payload}
|
46
|
+
|
47
|
+
response = connection.patch(
|
48
|
+
"apps/#{app_id}/autoscalers/#{autoscaler_id}",
|
49
|
+
data,
|
50
|
+
headers,
|
51
|
+
&block
|
52
|
+
)
|
53
|
+
|
54
|
+
unpack(:autoscaler) { response }
|
55
|
+
end
|
56
|
+
|
57
|
+
def destroy(app_id, autoscaler_id, headers = nil, &block)
|
58
|
+
data = nil
|
59
|
+
|
60
|
+
response = connection.delete(
|
61
|
+
"apps/#{app_id}/autoscalers/#{autoscaler_id}",
|
62
|
+
data,
|
63
|
+
headers,
|
64
|
+
&block
|
65
|
+
)
|
66
|
+
|
67
|
+
unpack { response }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/scalingo/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"path": "/users/stop_free_trial",
|
3
|
+
"method": "post",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Authorization": "Bearer the-bearer-token"
|
7
|
+
}
|
8
|
+
},
|
9
|
+
"response": {
|
10
|
+
"status": 200,
|
11
|
+
"headers": {
|
12
|
+
"Date": "Thu, 27 Aug 2020 10:46:32 GMT",
|
13
|
+
"Etag": "W/\"08bf4adf1520d417f7f03783353a3b5d\"",
|
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
|
+
"message": "ok"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"app_id": "example-running-application",
|
3
|
+
"id": "sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
4
|
+
"not_found_id": "wrong-autoscaler-id",
|
5
|
+
"create": {
|
6
|
+
"invalid": {
|
7
|
+
"container_type": "web",
|
8
|
+
"min_containers": 3,
|
9
|
+
"metric": "rpm_per_container"
|
10
|
+
},
|
11
|
+
"valid": {
|
12
|
+
"container_type": "web",
|
13
|
+
"min_containers": 3,
|
14
|
+
"max_containers": 7,
|
15
|
+
"metric": "rpm_per_container",
|
16
|
+
"target": 150
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"update": {
|
20
|
+
"invalid": {
|
21
|
+
"metric": "unknown"
|
22
|
+
},
|
23
|
+
"valid": {
|
24
|
+
"target": 200
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers",
|
3
|
+
"method": "post",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token",
|
8
|
+
"Content-Type": "application/json"
|
9
|
+
},
|
10
|
+
"json_body": {
|
11
|
+
"autoscaler": {
|
12
|
+
"container_type": "web",
|
13
|
+
"min_containers": 3,
|
14
|
+
"max_containers": 7,
|
15
|
+
"metric": "rpm_per_container",
|
16
|
+
"target": 150
|
17
|
+
}
|
18
|
+
}
|
19
|
+
},
|
20
|
+
"response": {
|
21
|
+
"status": 201,
|
22
|
+
"headers": {
|
23
|
+
"Date": "Fri, 28 Aug 2020 11:48:29 GMT",
|
24
|
+
"Etag": "W/\"90db16192d022937f3968d284f6e4f77\"",
|
25
|
+
"Content-Type": "application/json; charset=utf-8",
|
26
|
+
"Transfer-Encoding": "chunked",
|
27
|
+
"Connection": "keep-alive",
|
28
|
+
"Cache-Control": "max-age=0, private, must-revalidate",
|
29
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
30
|
+
},
|
31
|
+
"json_body": {
|
32
|
+
"autoscaler": {
|
33
|
+
"created_at": "2020-08-28T11:48:29.963295861Z",
|
34
|
+
"updated_at": "2020-08-28T11:48:29.963296084Z",
|
35
|
+
"id": "sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
36
|
+
"app_id": "5f48ecb6f112e2000ef34f14",
|
37
|
+
"container_type": "web",
|
38
|
+
"alert_id_scale_up": "al-ecf1cff6-c415-4e7b-8a86-e0ef697b2d87",
|
39
|
+
"alert_id_scale_down": "al-6ef726e8-d69b-44e1-8d67-3acef2a4802d",
|
40
|
+
"min_containers": 3,
|
41
|
+
"max_containers": 7,
|
42
|
+
"last_scale": "0001-01-01T00:00:00Z",
|
43
|
+
"disabled": false,
|
44
|
+
"metric": "rpm_per_container",
|
45
|
+
"target": 150
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers",
|
3
|
+
"method": "post",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token",
|
8
|
+
"Content-Type": "application/json"
|
9
|
+
},
|
10
|
+
"json_body": {
|
11
|
+
"autoscaler": {
|
12
|
+
"container_type": "web",
|
13
|
+
"min_containers": 3,
|
14
|
+
"metric": "rpm_per_container"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"response": {
|
19
|
+
"status": 500,
|
20
|
+
"headers": {
|
21
|
+
"Date": "Fri, 28 Aug 2020 11:48:29 GMT",
|
22
|
+
"Content-Type": "application/json; charset=utf-8",
|
23
|
+
"Transfer-Encoding": "chunked",
|
24
|
+
"Connection": "keep-alive",
|
25
|
+
"Cache-Control": "no-cache",
|
26
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
27
|
+
},
|
28
|
+
"json_body": {
|
29
|
+
"error": "Internal error occured, we're on it!"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers/sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
3
|
+
"method": "delete",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token"
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"response": {
|
11
|
+
"status": 204,
|
12
|
+
"headers": {
|
13
|
+
"Date": "Fri, 28 Aug 2020 11:48:32 GMT",
|
14
|
+
"Connection": "keep-alive",
|
15
|
+
"Cache-Control": "no-cache",
|
16
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
17
|
+
},
|
18
|
+
"body": ""
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers/wrong-autoscaler-id",
|
3
|
+
"method": "delete",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token"
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"response": {
|
11
|
+
"status": 404,
|
12
|
+
"headers": {
|
13
|
+
"Date": "Fri, 28 Aug 2020 11:48:31 GMT",
|
14
|
+
"Content-Type": "application/json; charset=utf-8",
|
15
|
+
"Transfer-Encoding": "chunked",
|
16
|
+
"Connection": "keep-alive",
|
17
|
+
"Cache-Control": "no-cache",
|
18
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
19
|
+
},
|
20
|
+
"json_body": {
|
21
|
+
"resource": "autoscaler",
|
22
|
+
"error": "not found"
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers/sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
3
|
+
"method": "get",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token"
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"response": {
|
11
|
+
"status": 200,
|
12
|
+
"headers": {
|
13
|
+
"Date": "Fri, 28 Aug 2020 11:48:30 GMT",
|
14
|
+
"Etag": "W/\"c870c2f312d82030bde9ae13625f746d\"",
|
15
|
+
"Content-Type": "application/json; charset=utf-8",
|
16
|
+
"Transfer-Encoding": "chunked",
|
17
|
+
"Connection": "keep-alive",
|
18
|
+
"Cache-Control": "max-age=0, private, must-revalidate",
|
19
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
20
|
+
},
|
21
|
+
"json_body": {
|
22
|
+
"autoscaler": {
|
23
|
+
"created_at": "2020-08-28T11:48:29.963Z",
|
24
|
+
"updated_at": "2020-08-28T11:48:29.963Z",
|
25
|
+
"id": "sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
26
|
+
"app_id": "5f48ecb6f112e2000ef34f14",
|
27
|
+
"container_type": "web",
|
28
|
+
"alert_id_scale_up": "al-ecf1cff6-c415-4e7b-8a86-e0ef697b2d87",
|
29
|
+
"alert_id_scale_down": "al-6ef726e8-d69b-44e1-8d67-3acef2a4802d",
|
30
|
+
"min_containers": 3,
|
31
|
+
"max_containers": 7,
|
32
|
+
"last_scale": "0001-01-01T00:00:00Z",
|
33
|
+
"disabled": false,
|
34
|
+
"metric": "rpm_per_container",
|
35
|
+
"target": 150
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers/wrong-autoscaler-id",
|
3
|
+
"method": "get",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token"
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"response": {
|
11
|
+
"status": 404,
|
12
|
+
"headers": {
|
13
|
+
"Date": "Fri, 28 Aug 2020 11:48:30 GMT",
|
14
|
+
"Content-Type": "application/json; charset=utf-8",
|
15
|
+
"Transfer-Encoding": "chunked",
|
16
|
+
"Connection": "keep-alive",
|
17
|
+
"Cache-Control": "no-cache",
|
18
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
19
|
+
},
|
20
|
+
"json_body": {
|
21
|
+
"resource": "autoscaler",
|
22
|
+
"error": "not found"
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers",
|
3
|
+
"method": "get",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token"
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"response": {
|
11
|
+
"status": 200,
|
12
|
+
"headers": {
|
13
|
+
"Date": "Fri, 28 Aug 2020 11:48:30 GMT",
|
14
|
+
"Etag": "W/\"78d382e1680bcf4d9ff9e58c906714ba\"",
|
15
|
+
"Content-Type": "application/json; charset=utf-8",
|
16
|
+
"Transfer-Encoding": "chunked",
|
17
|
+
"Connection": "keep-alive",
|
18
|
+
"Cache-Control": "max-age=0, private, must-revalidate",
|
19
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
20
|
+
},
|
21
|
+
"json_body": {
|
22
|
+
"autoscalers": [
|
23
|
+
{
|
24
|
+
"created_at": "2020-08-28T11:48:29.963Z",
|
25
|
+
"updated_at": "2020-08-28T11:48:29.963Z",
|
26
|
+
"id": "sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
27
|
+
"app_id": "5f48ecb6f112e2000ef34f14",
|
28
|
+
"container_type": "web",
|
29
|
+
"alert_id_scale_up": "al-ecf1cff6-c415-4e7b-8a86-e0ef697b2d87",
|
30
|
+
"alert_id_scale_down": "al-6ef726e8-d69b-44e1-8d67-3acef2a4802d",
|
31
|
+
"min_containers": 3,
|
32
|
+
"max_containers": 7,
|
33
|
+
"last_scale": "0001-01-01T00:00:00Z",
|
34
|
+
"disabled": false,
|
35
|
+
"metric": "rpm_per_container",
|
36
|
+
"target": 150
|
37
|
+
}
|
38
|
+
]
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers/sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
3
|
+
"method": "patch",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token",
|
8
|
+
"Content-Type": "application/json"
|
9
|
+
},
|
10
|
+
"json_body": {
|
11
|
+
"autoscaler": {
|
12
|
+
"target": 200
|
13
|
+
}
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"response": {
|
17
|
+
"status": 200,
|
18
|
+
"headers": {
|
19
|
+
"Date": "Fri, 28 Aug 2020 11:48:31 GMT",
|
20
|
+
"Etag": "W/\"f11b66f818316c26bb369e2e72009d4e\"",
|
21
|
+
"Content-Type": "application/json; charset=utf-8",
|
22
|
+
"Transfer-Encoding": "chunked",
|
23
|
+
"Connection": "keep-alive",
|
24
|
+
"Cache-Control": "max-age=0, private, must-revalidate",
|
25
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
26
|
+
},
|
27
|
+
"json_body": {
|
28
|
+
"autoscaler": {
|
29
|
+
"created_at": "2020-08-28T11:48:29.963Z",
|
30
|
+
"updated_at": "2020-08-28T11:48:31.56609493Z",
|
31
|
+
"id": "sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
32
|
+
"app_id": "5f48ecb6f112e2000ef34f14",
|
33
|
+
"container_type": "web",
|
34
|
+
"alert_id_scale_up": "al-ecf1cff6-c415-4e7b-8a86-e0ef697b2d87",
|
35
|
+
"alert_id_scale_down": "al-6ef726e8-d69b-44e1-8d67-3acef2a4802d",
|
36
|
+
"min_containers": 3,
|
37
|
+
"max_containers": 7,
|
38
|
+
"last_scale": "0001-01-01T00:00:00Z",
|
39
|
+
"disabled": false,
|
40
|
+
"metric": "rpm_per_container",
|
41
|
+
"target": 200
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers/wrong-autoscaler-id",
|
3
|
+
"method": "patch",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token",
|
8
|
+
"Content-Type": "application/json"
|
9
|
+
},
|
10
|
+
"json_body": {
|
11
|
+
"autoscaler": {
|
12
|
+
"target": 200
|
13
|
+
}
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"response": {
|
17
|
+
"status": 404,
|
18
|
+
"headers": {
|
19
|
+
"Date": "Fri, 28 Aug 2020 11:48:30 GMT",
|
20
|
+
"Content-Type": "application/json; charset=utf-8",
|
21
|
+
"Transfer-Encoding": "chunked",
|
22
|
+
"Connection": "keep-alive",
|
23
|
+
"Cache-Control": "no-cache",
|
24
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
25
|
+
},
|
26
|
+
"json_body": {
|
27
|
+
"resource": "autoscaler",
|
28
|
+
"error": "not found"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"path": "/apps/example-running-application/autoscalers/sc-5418fe67-885d-4e50-8cbe-9a9a2d2d690a",
|
3
|
+
"method": "patch",
|
4
|
+
"request": {
|
5
|
+
"headers": {
|
6
|
+
"Accept": "application/json",
|
7
|
+
"Authorization": "Bearer the-bearer-token",
|
8
|
+
"Content-Type": "application/json"
|
9
|
+
},
|
10
|
+
"json_body": {
|
11
|
+
"autoscaler": {
|
12
|
+
"metric": "unknown"
|
13
|
+
}
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"response": {
|
17
|
+
"status": 500,
|
18
|
+
"headers": {
|
19
|
+
"Date": "Fri, 28 Aug 2020 11:48:31 GMT",
|
20
|
+
"Content-Type": "application/json; charset=utf-8",
|
21
|
+
"Transfer-Encoding": "chunked",
|
22
|
+
"Connection": "keep-alive",
|
23
|
+
"Cache-Control": "no-cache",
|
24
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
25
|
+
},
|
26
|
+
"json_body": {
|
27
|
+
"error": "Internal error occured, we're on it!"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
data/scalingo.gemspec
CHANGED
@@ -42,8 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.add_development_dependency "bundler", "~> 2.0"
|
43
43
|
s.add_development_dependency "rake", "~> 13.0"
|
44
44
|
s.add_development_dependency "rspec", "~> 3.0"
|
45
|
-
s.add_development_dependency "
|
46
|
-
s.add_development_dependency "standard", "~> 0.4.2"
|
45
|
+
s.add_development_dependency "standard", "~> 0.10.1"
|
47
46
|
s.add_development_dependency "pry", "~> 0.13.1"
|
48
|
-
s.add_development_dependency "webmock", "~> 3.
|
47
|
+
s.add_development_dependency "webmock", "~> 3.10.0"
|
49
48
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe Scalingo::Regional::Autoscalers do
|
4
|
+
describe_method "create" do
|
5
|
+
context "success" do
|
6
|
+
let(:arguments) { [meta[:app_id], meta[:create][:valid]] }
|
7
|
+
let(:stub_pattern) { "create-201" }
|
8
|
+
|
9
|
+
it_behaves_like "a singular object response", 201
|
10
|
+
end
|
11
|
+
|
12
|
+
context "failure" do
|
13
|
+
let(:arguments) { [meta[:app_id], meta[:create][:invalid]] }
|
14
|
+
let(:stub_pattern) { "create-500" }
|
15
|
+
|
16
|
+
it_behaves_like "a server error"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe_method "for" do
|
21
|
+
context "success" do
|
22
|
+
let(:arguments) { meta[:app_id] }
|
23
|
+
let(:stub_pattern) { "for-200" }
|
24
|
+
|
25
|
+
it_behaves_like "a collection response"
|
26
|
+
it_behaves_like "a non-paginated collection"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe_method "find" do
|
31
|
+
context "success" do
|
32
|
+
let(:arguments) { [meta[:app_id], meta[:id]] }
|
33
|
+
let(:stub_pattern) { "find-200" }
|
34
|
+
|
35
|
+
it_behaves_like "a singular object response"
|
36
|
+
end
|
37
|
+
|
38
|
+
context "not found" do
|
39
|
+
let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
|
40
|
+
let(:stub_pattern) { "find-404" }
|
41
|
+
|
42
|
+
it_behaves_like "a not found response"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe_method "update" do
|
47
|
+
context "success" do
|
48
|
+
let(:arguments) { [meta[:app_id], meta[:id], meta[:update][:valid]] }
|
49
|
+
let(:stub_pattern) { "update-200" }
|
50
|
+
|
51
|
+
it_behaves_like "a singular object response"
|
52
|
+
end
|
53
|
+
|
54
|
+
context "failure" do
|
55
|
+
let(:arguments) { [meta[:app_id], meta[:id], meta[:update][:invalid]] }
|
56
|
+
let(:stub_pattern) { "update-500" }
|
57
|
+
|
58
|
+
it_behaves_like "a server error"
|
59
|
+
end
|
60
|
+
|
61
|
+
context "not found" do
|
62
|
+
let(:arguments) { [meta[:app_id], meta[:not_found_id], meta[:update][:valid]] }
|
63
|
+
let(:stub_pattern) { "update-404" }
|
64
|
+
|
65
|
+
it_behaves_like "a not found response"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe_method "destroy" do
|
70
|
+
context "success" do
|
71
|
+
let(:arguments) { [meta[:app_id], meta[:id]] }
|
72
|
+
let(:stub_pattern) { "destroy-204" }
|
73
|
+
|
74
|
+
it_behaves_like "an empty response"
|
75
|
+
end
|
76
|
+
|
77
|
+
context "not found" do
|
78
|
+
let(:arguments) { [meta[:app_id], meta[:not_found_id]] }
|
79
|
+
let(:stub_pattern) { "destroy-404" }
|
80
|
+
|
81
|
+
it_behaves_like "a not found response"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -4,8 +4,8 @@ RSpec.describe Scalingo::Regional do
|
|
4
4
|
subject { described_class.new("url") }
|
5
5
|
|
6
6
|
%w[
|
7
|
-
addons apps collaborators containers deployments domains
|
8
|
-
logs metrics notifiers operations scm_repo_links
|
7
|
+
addons apps autoscalers collaborators containers deployments domains
|
8
|
+
environment events logs metrics notifiers operations scm_repo_links
|
9
9
|
].each do |section|
|
10
10
|
it "handles requests for #{section}" do
|
11
11
|
expect(subject.respond_to?(section)).to be true
|
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.0.0
|
4
|
+
version: 3.0.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: 2020-
|
12
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -63,22 +63,22 @@ dependencies:
|
|
63
63
|
name: multi_json
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.0'
|
69
66
|
- - ">="
|
70
67
|
- !ruby/object:Gem::Version
|
71
68
|
version: 1.0.3
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1.0'
|
72
72
|
type: :runtime
|
73
73
|
prerelease: false
|
74
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - "~>"
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '1.0'
|
79
76
|
- - ">="
|
80
77
|
- !ruby/object:Gem::Version
|
81
78
|
version: 1.0.3
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.0'
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: bundler
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,34 +121,20 @@ dependencies:
|
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '3.0'
|
124
|
-
- !ruby/object:Gem::Dependency
|
125
|
-
name: rubocop
|
126
|
-
requirement: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - "~>"
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 0.83.0
|
131
|
-
type: :development
|
132
|
-
prerelease: false
|
133
|
-
version_requirements: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - "~>"
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: 0.83.0
|
138
124
|
- !ruby/object:Gem::Dependency
|
139
125
|
name: standard
|
140
126
|
requirement: !ruby/object:Gem::Requirement
|
141
127
|
requirements:
|
142
128
|
- - "~>"
|
143
129
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0.
|
130
|
+
version: 0.10.1
|
145
131
|
type: :development
|
146
132
|
prerelease: false
|
147
133
|
version_requirements: !ruby/object:Gem::Requirement
|
148
134
|
requirements:
|
149
135
|
- - "~>"
|
150
136
|
- !ruby/object:Gem::Version
|
151
|
-
version: 0.
|
137
|
+
version: 0.10.1
|
152
138
|
- !ruby/object:Gem::Dependency
|
153
139
|
name: pry
|
154
140
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,14 +155,14 @@ dependencies:
|
|
169
155
|
requirements:
|
170
156
|
- - "~>"
|
171
157
|
- !ruby/object:Gem::Version
|
172
|
-
version: 3.
|
158
|
+
version: 3.10.0
|
173
159
|
type: :development
|
174
160
|
prerelease: false
|
175
161
|
version_requirements: !ruby/object:Gem::Requirement
|
176
162
|
requirements:
|
177
163
|
- - "~>"
|
178
164
|
- !ruby/object:Gem::Version
|
179
|
-
version: 3.
|
165
|
+
version: 3.10.0
|
180
166
|
description: Ruby client library for the web APIs of Scalingo, a european Platform-as-a-Service
|
181
167
|
email:
|
182
168
|
- leo@scalingo.com
|
@@ -217,6 +203,7 @@ files:
|
|
217
203
|
- lib/scalingo/regional.rb
|
218
204
|
- lib/scalingo/regional/addons.rb
|
219
205
|
- lib/scalingo/regional/apps.rb
|
206
|
+
- lib/scalingo/regional/autoscalers.rb
|
220
207
|
- lib/scalingo/regional/collaborators.rb
|
221
208
|
- lib/scalingo/regional/containers.rb
|
222
209
|
- lib/scalingo/regional/deployments.rb
|
@@ -267,6 +254,7 @@ files:
|
|
267
254
|
- samples/auth/two_factor_auth/validate-wrong.json
|
268
255
|
- samples/auth/user/_meta.json
|
269
256
|
- samples/auth/user/self.json
|
257
|
+
- samples/auth/user/stop-free-trial.json
|
270
258
|
- samples/auth/user/update-200.json
|
271
259
|
- samples/auth/user/update-422.json
|
272
260
|
- samples/billing/profile/_meta.json
|
@@ -313,6 +301,17 @@ files:
|
|
313
301
|
- samples/regional/apps/transfer-422.json
|
314
302
|
- samples/regional/apps/update-200.json
|
315
303
|
- samples/regional/apps/update-stack-404.json
|
304
|
+
- samples/regional/autoscalers/_meta.json
|
305
|
+
- samples/regional/autoscalers/create-201.json
|
306
|
+
- samples/regional/autoscalers/create-500.json
|
307
|
+
- samples/regional/autoscalers/destroy-204.json
|
308
|
+
- samples/regional/autoscalers/destroy-404.json
|
309
|
+
- samples/regional/autoscalers/find-200.json
|
310
|
+
- samples/regional/autoscalers/find-404.json
|
311
|
+
- samples/regional/autoscalers/for-200.json
|
312
|
+
- samples/regional/autoscalers/update-200.json
|
313
|
+
- samples/regional/autoscalers/update-404.json
|
314
|
+
- samples/regional/autoscalers/update-500.json
|
316
315
|
- samples/regional/collaborators/_meta.json
|
317
316
|
- samples/regional/collaborators/accept-200.json
|
318
317
|
- samples/regional/collaborators/accept-400.json
|
@@ -416,6 +415,7 @@ files:
|
|
416
415
|
- spec/scalingo/configuration_spec.rb
|
417
416
|
- spec/scalingo/regional/addons_spec.rb
|
418
417
|
- spec/scalingo/regional/apps_spec.rb
|
418
|
+
- spec/scalingo/regional/autoscalers_spec.rb
|
419
419
|
- spec/scalingo/regional/collaborators_spec.rb
|
420
420
|
- spec/scalingo/regional/containers_spec.rb
|
421
421
|
- spec/scalingo/regional/deployments_spec.rb
|
@@ -448,11 +448,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
448
448
|
version: '0'
|
449
449
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
450
450
|
requirements:
|
451
|
-
- - "
|
451
|
+
- - ">="
|
452
452
|
- !ruby/object:Gem::Version
|
453
|
-
version:
|
453
|
+
version: '0'
|
454
454
|
requirements: []
|
455
|
-
rubygems_version: 3.
|
455
|
+
rubygems_version: 3.1.4
|
456
456
|
signing_key:
|
457
457
|
specification_version: 4
|
458
458
|
summary: Ruby client for Scalingo APIs
|
@@ -479,6 +479,7 @@ test_files:
|
|
479
479
|
- spec/scalingo/regional/addons_spec.rb
|
480
480
|
- spec/scalingo/regional/logs_spec.rb
|
481
481
|
- spec/scalingo/regional/containers_spec.rb
|
482
|
+
- spec/scalingo/regional/autoscalers_spec.rb
|
482
483
|
- spec/scalingo/regional/events_spec.rb
|
483
484
|
- spec/scalingo/bearer_token_spec.rb
|
484
485
|
- spec/scalingo/auth_spec.rb
|