scalingo 3.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rubocop.yml +16 -0
- data/.travis.yml +24 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +110 -0
- data/LICENSE.txt +22 -0
- data/README.md +147 -0
- data/Rakefile +6 -0
- data/bin/console +12 -0
- data/bin/setup +8 -0
- data/lib/scalingo.rb +2 -0
- data/lib/scalingo/api/client.rb +79 -0
- data/lib/scalingo/api/endpoint.rb +23 -0
- data/lib/scalingo/api/response.rb +71 -0
- data/lib/scalingo/auth.rb +21 -0
- data/lib/scalingo/auth/keys.rb +56 -0
- data/lib/scalingo/auth/scm_integrations.rb +57 -0
- data/lib/scalingo/auth/tokens.rb +78 -0
- data/lib/scalingo/auth/two_factor_auth.rb +61 -0
- data/lib/scalingo/auth/user.rb +31 -0
- data/lib/scalingo/bearer_token.rb +20 -0
- data/lib/scalingo/client.rb +105 -0
- data/lib/scalingo/config.rb +38 -0
- data/lib/scalingo/error/expired_token.rb +6 -0
- data/lib/scalingo/error/unauthenticated.rb +6 -0
- data/lib/scalingo/errors.rb +2 -0
- data/lib/scalingo/regional.rb +35 -0
- data/lib/scalingo/regional/addons.rb +109 -0
- data/lib/scalingo/regional/apps.rb +109 -0
- data/lib/scalingo/regional/collaborators.rb +57 -0
- data/lib/scalingo/regional/containers.rb +57 -0
- data/lib/scalingo/regional/deployments.rb +44 -0
- data/lib/scalingo/regional/domains.rb +70 -0
- data/lib/scalingo/regional/environment.rb +83 -0
- data/lib/scalingo/regional/events.rb +55 -0
- data/lib/scalingo/regional/logs.rb +38 -0
- data/lib/scalingo/regional/metrics.rb +41 -0
- data/lib/scalingo/regional/notifiers.rb +96 -0
- data/lib/scalingo/regional/operations.rb +18 -0
- data/lib/scalingo/regional/scm_repo_links.rb +109 -0
- data/lib/scalingo/version.rb +3 -0
- data/samples/auth/keys/_meta.json +13 -0
- data/samples/auth/keys/all-200.json +62 -0
- data/samples/auth/keys/create-201.json +67 -0
- data/samples/auth/keys/create-422.json +34 -0
- data/samples/auth/keys/destroy-204.json +19 -0
- data/samples/auth/keys/destroy-404.json +19 -0
- data/samples/auth/keys/show-200.json +60 -0
- data/samples/auth/keys/show-404.json +19 -0
- data/samples/auth/scm_integrations/_meta.json +14 -0
- data/samples/auth/scm_integrations/all-200.json +41 -0
- data/samples/auth/scm_integrations/create-201.json +41 -0
- data/samples/auth/scm_integrations/create-422.json +36 -0
- data/samples/auth/scm_integrations/destroy-204.json +15 -0
- data/samples/auth/scm_integrations/destroy-404.json +23 -0
- data/samples/auth/scm_integrations/show-200.json +34 -0
- data/samples/auth/scm_integrations/show-404.json +23 -0
- data/samples/auth/tokens/_meta.json +13 -0
- data/samples/auth/tokens/all-200.json +32 -0
- data/samples/auth/tokens/create-201.json +37 -0
- data/samples/auth/tokens/destroy-204.json +19 -0
- data/samples/auth/tokens/destroy-404.json +19 -0
- data/samples/auth/tokens/exchange-200.json +25 -0
- data/samples/auth/tokens/exchange-401.json +24 -0
- data/samples/auth/tokens/renew-200.json +32 -0
- data/samples/auth/tokens/renew-404.json +20 -0
- data/samples/auth/two_factor_auth/_meta.json +10 -0
- data/samples/auth/two_factor_auth/disable-not-initiated.json +23 -0
- data/samples/auth/two_factor_auth/disable-success.json +29 -0
- data/samples/auth/two_factor_auth/initiate-already-enabled.json +29 -0
- data/samples/auth/two_factor_auth/initiate-success.json +36 -0
- data/samples/auth/two_factor_auth/initiate-wrong-provider.json +29 -0
- data/samples/auth/two_factor_auth/status.json +29 -0
- data/samples/auth/two_factor_auth/validate-not-initiated.json +29 -0
- data/samples/auth/two_factor_auth/validate-success.json +49 -0
- data/samples/auth/two_factor_auth/validate-wrong.json +29 -0
- data/samples/auth/user/_meta.json +10 -0
- data/samples/auth/user/self.json +54 -0
- data/samples/auth/user/update-200.json +59 -0
- data/samples/auth/user/update-422.json +33 -0
- data/samples/regional/addons/_meta.json +22 -0
- data/samples/regional/addons/categories-guest.json +36 -0
- data/samples/regional/addons/categories-logged.json +37 -0
- data/samples/regional/addons/destroy-204.json +19 -0
- data/samples/regional/addons/destroy-404.json +24 -0
- data/samples/regional/addons/find-200.json +48 -0
- data/samples/regional/addons/find-404.json +24 -0
- data/samples/regional/addons/for-200.json +50 -0
- data/samples/regional/addons/providers-guest.json +588 -0
- data/samples/regional/addons/providers-logged.json +705 -0
- data/samples/regional/addons/provision-201.json +58 -0
- data/samples/regional/addons/provision-400.json +29 -0
- data/samples/regional/addons/sso-200.json +49 -0
- data/samples/regional/addons/sso-404.json +24 -0
- data/samples/regional/addons/update-200.json +58 -0
- data/samples/regional/addons/update-404.json +30 -0
- data/samples/regional/apps/_meta.json +52 -0
- data/samples/regional/apps/all.json +99 -0
- data/samples/regional/apps/create-201.json +66 -0
- data/samples/regional/apps/create-422.json +34 -0
- data/samples/regional/apps/destroy-204.json +19 -0
- data/samples/regional/apps/destroy-404.json +24 -0
- data/samples/regional/apps/destroy-422.json +27 -0
- data/samples/regional/apps/find-200.json +60 -0
- data/samples/regional/apps/find-404.json +24 -0
- data/samples/regional/apps/logs_url.json +62 -0
- data/samples/regional/apps/rename-200.json +65 -0
- data/samples/regional/apps/rename-404.json +29 -0
- data/samples/regional/apps/rename-422.json +33 -0
- data/samples/regional/apps/transfer-200.json +65 -0
- data/samples/regional/apps/transfer-404.json +27 -0
- data/samples/regional/apps/transfer-422.json +34 -0
- data/samples/regional/apps/update-200.json +66 -0
- data/samples/regional/apps/update-stack-404.json +30 -0
- data/samples/regional/collaborators/_meta.json +17 -0
- data/samples/regional/collaborators/accept-200.json +60 -0
- data/samples/regional/collaborators/accept-400.json +24 -0
- data/samples/regional/collaborators/accept-404.json +24 -0
- data/samples/regional/collaborators/destroy-204.json +19 -0
- data/samples/regional/collaborators/destroy-404.json +24 -0
- data/samples/regional/collaborators/for-200.json +34 -0
- data/samples/regional/collaborators/invite-201.json +37 -0
- data/samples/regional/collaborators/invite-422.json +34 -0
- data/samples/regional/containers/_meta.json +25 -0
- data/samples/regional/containers/for-200.json +39 -0
- data/samples/regional/containers/restart-202.json +28 -0
- data/samples/regional/containers/restart-422.json +33 -0
- data/samples/regional/containers/scale-202.json +48 -0
- data/samples/regional/containers/scale-422.json +36 -0
- data/samples/regional/containers/sizes-guest.json +115 -0
- data/samples/regional/containers/sizes-logged.json +116 -0
- data/samples/regional/deployments/_meta.json +8 -0
- data/samples/regional/deployments/find-200.json +45 -0
- data/samples/regional/deployments/find-404.json +24 -0
- data/samples/regional/deployments/for-with-paging.json +35 -0
- data/samples/regional/deployments/for-without-pages.json +56 -0
- data/samples/regional/deployments/logs-200.json +22 -0
- data/samples/regional/deployments/logs-404.json +24 -0
- data/samples/regional/domains/_meta.json +21 -0
- data/samples/regional/domains/create-201.json +44 -0
- data/samples/regional/domains/create-422.json +33 -0
- data/samples/regional/domains/destroy-204.json +19 -0
- data/samples/regional/domains/destroy-404.json +24 -0
- data/samples/regional/domains/find-200.json +38 -0
- data/samples/regional/domains/find-404.json +24 -0
- data/samples/regional/domains/for-200.json +40 -0
- data/samples/regional/domains/update-200.json +44 -0
- data/samples/regional/domains/update-404.json +30 -0
- data/samples/regional/domains/update-422.json +33 -0
- data/samples/regional/environment/_meta.json +43 -0
- data/samples/regional/environment/bulk-destroy-204.json +19 -0
- data/samples/regional/environment/bulk-update-200.json +70 -0
- data/samples/regional/environment/create-201.json +36 -0
- data/samples/regional/environment/create-422.json +37 -0
- data/samples/regional/environment/destroy-204.json +19 -0
- data/samples/regional/environment/destroy-404.json +24 -0
- data/samples/regional/environment/for-200.json +31 -0
- data/samples/regional/environment/update-200.json +35 -0
- data/samples/regional/environment/update-404.json +30 -0
- data/samples/regional/events/_meta.json +3 -0
- data/samples/regional/events/all-200.json +619 -0
- data/samples/regional/events/categories-guest.json +66 -0
- data/samples/regional/events/categories-logged.json +67 -0
- data/samples/regional/events/for-200.json +404 -0
- data/samples/regional/events/types-guest.json +288 -0
- data/samples/regional/events/types-logged.json +289 -0
- data/samples/regional/logs/_meta.json +11 -0
- data/samples/regional/logs/archives-200.json +28 -0
- data/samples/regional/logs/get-guest-200.json +18 -0
- data/samples/regional/logs/get-logged-200.json +19 -0
- data/samples/regional/logs/get-with-limit-200.json +18 -0
- data/samples/regional/metrics/_meta.json +15 -0
- data/samples/regional/metrics/for-invalid-400.json +23 -0
- data/samples/regional/metrics/for-valid-cpu-200.json +747 -0
- data/samples/regional/metrics/for-valid-router-404.json +23 -0
- data/samples/regional/metrics/types-guest.json +66 -0
- data/samples/regional/metrics/types-logged.json +67 -0
- data/samples/regional/notifiers/_meta.json +23 -0
- data/samples/regional/notifiers/create-201.json +55 -0
- data/samples/regional/notifiers/create-404.json +30 -0
- data/samples/regional/notifiers/create-422.json +36 -0
- data/samples/regional/notifiers/destroy-204.json +19 -0
- data/samples/regional/notifiers/destroy-404.json +24 -0
- data/samples/regional/notifiers/find-200.json +47 -0
- data/samples/regional/notifiers/find-404.json +24 -0
- data/samples/regional/notifiers/for-200.json +49 -0
- data/samples/regional/notifiers/platforms-guest.json +184 -0
- data/samples/regional/notifiers/platforms-logged.json +185 -0
- data/samples/regional/notifiers/test-200.json +22 -0
- data/samples/regional/notifiers/test-404.json +25 -0
- data/samples/regional/notifiers/update-200.json +53 -0
- data/samples/regional/operations/_meta.json +5 -0
- data/samples/regional/operations/find-200.json +31 -0
- data/samples/regional/operations/find-404.json +24 -0
- data/samples/regional/scm_repo_links/_meta.json +22 -0
- data/samples/regional/scm_repo_links/create-201.json +54 -0
- data/samples/regional/scm_repo_links/destroy-204.json +15 -0
- data/samples/regional/scm_repo_links/manual-deploy-200.json +32 -0
- data/samples/regional/scm_repo_links/show-200.json +43 -0
- data/samples/regional/scm_repo_links/update-200.json +50 -0
- data/scalingo.gemspec +51 -0
- data/spec/scalingo/auth/keys_spec.rb +58 -0
- data/spec/scalingo/auth/scm_integrations_spec.rb +58 -0
- data/spec/scalingo/auth/tokens_spec.rb +74 -0
- data/spec/scalingo/auth/two_factor_auth_spec.rb +69 -0
- data/spec/scalingo/auth/user_spec.rb +25 -0
- data/spec/scalingo/regional/addons_spec.rb +133 -0
- data/spec/scalingo/regional/apps_spec.rb +137 -0
- data/spec/scalingo/regional/collaborators_spec.rb +69 -0
- data/spec/scalingo/regional/containers_spec.rb +67 -0
- data/spec/scalingo/regional/deployments_spec.rb +45 -0
- data/spec/scalingo/regional/domains_spec.rb +84 -0
- data/spec/scalingo/regional/environment_spec.rb +77 -0
- data/spec/scalingo/regional/events_spec.rb +65 -0
- data/spec/scalingo/regional/logs_spec.rb +39 -0
- data/spec/scalingo/regional/metrics_spec.rb +46 -0
- data/spec/scalingo/regional/notifiers_spec.rb +113 -0
- data/spec/scalingo/regional/operations_spec.rb +19 -0
- data/spec/scalingo/regional/scm_repo_links_spec.rb +48 -0
- metadata +488 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
require "active_support/core_ext/numeric/time"
|
2
|
+
require "dry-configurable"
|
3
|
+
require "scalingo/version"
|
4
|
+
|
5
|
+
module Scalingo
|
6
|
+
extend Dry::Configurable
|
7
|
+
|
8
|
+
# Known regions. Each region should have a corresponding entry in the urls settings below
|
9
|
+
setting :regions, %i[osc_fr1 osc_secnum_fr1]
|
10
|
+
|
11
|
+
# Default region
|
12
|
+
setting :default_region, :osc_fr1
|
13
|
+
|
14
|
+
# Endpoints URLS
|
15
|
+
setting :urls do
|
16
|
+
setting :auth, "https://auth.scalingo.com/v1"
|
17
|
+
setting :osc_fr1, "https://api.osc-fr1.scalingo.com/v1"
|
18
|
+
setting :osc_secnum_fr1, "https://api.osc-secnum-fr1.scalingo.com/v1"
|
19
|
+
end
|
20
|
+
|
21
|
+
# Configure the User Agent header
|
22
|
+
setting :user_agent, "Scalingo Ruby Client v#{Scalingo::VERSION}"
|
23
|
+
|
24
|
+
# For how long is a bearer token considered valid (it will raise passed this delay).
|
25
|
+
# Set to nil to never raise.
|
26
|
+
setting :exchanged_token_validity, 1.hour
|
27
|
+
|
28
|
+
# Raise an exception when trying to use an authenticated connection without a bearer token set
|
29
|
+
# Having this setting to true prevents performing requests that would fail due to lack of authentication headers.
|
30
|
+
setting :raise_on_missing_authentication, true
|
31
|
+
|
32
|
+
# These headers will be added to every request. Individual methods may override them.
|
33
|
+
# This should be a hash or a callable object that returns a hash.
|
34
|
+
setting :additional_headers, {}
|
35
|
+
|
36
|
+
# Raise an exception when the bearer token in use is supposed to be invalid
|
37
|
+
setting :raise_on_expired_token, false
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "scalingo/api/client"
|
2
|
+
|
3
|
+
module Scalingo
|
4
|
+
class Regional < API::Client
|
5
|
+
require "scalingo/regional/addons"
|
6
|
+
require "scalingo/regional/apps"
|
7
|
+
require "scalingo/regional/collaborators"
|
8
|
+
require "scalingo/regional/containers"
|
9
|
+
require "scalingo/regional/deployments"
|
10
|
+
require "scalingo/regional/domains"
|
11
|
+
require "scalingo/regional/environment"
|
12
|
+
require "scalingo/regional/events"
|
13
|
+
require "scalingo/regional/logs"
|
14
|
+
require "scalingo/regional/metrics"
|
15
|
+
require "scalingo/regional/notifiers"
|
16
|
+
require "scalingo/regional/operations"
|
17
|
+
require "scalingo/regional/scm_repo_links"
|
18
|
+
|
19
|
+
register_handlers!(
|
20
|
+
addons: Addons,
|
21
|
+
apps: Apps,
|
22
|
+
collaborators: Collaborators,
|
23
|
+
containers: Containers,
|
24
|
+
deployments: Deployments,
|
25
|
+
domains: Domains,
|
26
|
+
environment: Environment,
|
27
|
+
events: Events,
|
28
|
+
logs: Logs,
|
29
|
+
metrics: Metrics,
|
30
|
+
notifiers: Notifiers,
|
31
|
+
operations: Operations,
|
32
|
+
scm_repo_links: ScmRepoLinks,
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require "scalingo/api/endpoint"
|
2
|
+
|
3
|
+
module Scalingo
|
4
|
+
class Regional::Addons < API::Endpoint
|
5
|
+
def for(app_id, headers = nil, &block)
|
6
|
+
data = nil
|
7
|
+
|
8
|
+
response = connection.get(
|
9
|
+
"apps/#{app_id}/addons",
|
10
|
+
data,
|
11
|
+
headers,
|
12
|
+
&block
|
13
|
+
)
|
14
|
+
|
15
|
+
unpack(response, key: :addons)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(app_id, addon_id, headers = nil, &block)
|
19
|
+
data = nil
|
20
|
+
|
21
|
+
response = connection.get(
|
22
|
+
"apps/#{app_id}/addons/#{addon_id}",
|
23
|
+
data,
|
24
|
+
headers,
|
25
|
+
&block
|
26
|
+
)
|
27
|
+
|
28
|
+
unpack(response, key: :addon)
|
29
|
+
end
|
30
|
+
|
31
|
+
def provision(app_id, payload = {}, headers = nil, &block)
|
32
|
+
data = {addon: payload}
|
33
|
+
|
34
|
+
response = connection.post(
|
35
|
+
"apps/#{app_id}/addons",
|
36
|
+
data,
|
37
|
+
headers,
|
38
|
+
&block
|
39
|
+
)
|
40
|
+
|
41
|
+
unpack(response, key: :addon)
|
42
|
+
end
|
43
|
+
|
44
|
+
def update(app_id, addon_id, payload = {}, headers = nil, &block)
|
45
|
+
data = {addon: payload}
|
46
|
+
|
47
|
+
response = connection.patch(
|
48
|
+
"apps/#{app_id}/addons/#{addon_id}",
|
49
|
+
data,
|
50
|
+
headers,
|
51
|
+
&block
|
52
|
+
)
|
53
|
+
|
54
|
+
unpack(response, key: :addon)
|
55
|
+
end
|
56
|
+
|
57
|
+
def destroy(app_id, addon_id, headers = nil, &block)
|
58
|
+
data = nil
|
59
|
+
|
60
|
+
response = connection.delete(
|
61
|
+
"apps/#{app_id}/addons/#{addon_id}",
|
62
|
+
data,
|
63
|
+
headers,
|
64
|
+
&block
|
65
|
+
)
|
66
|
+
|
67
|
+
unpack(response)
|
68
|
+
end
|
69
|
+
|
70
|
+
def sso(app_id, addon_id, headers = nil, &block)
|
71
|
+
data = nil
|
72
|
+
|
73
|
+
response = connection.get(
|
74
|
+
"apps/#{app_id}/addons/#{addon_id}/sso",
|
75
|
+
data,
|
76
|
+
headers,
|
77
|
+
&block
|
78
|
+
)
|
79
|
+
|
80
|
+
unpack(response, key: :addon)
|
81
|
+
end
|
82
|
+
|
83
|
+
def categories(headers = nil, &block)
|
84
|
+
data = nil
|
85
|
+
|
86
|
+
response = connection(allow_guest: true).get(
|
87
|
+
"addon_categories",
|
88
|
+
data,
|
89
|
+
headers,
|
90
|
+
&block
|
91
|
+
)
|
92
|
+
|
93
|
+
unpack(response, key: :addon_categories)
|
94
|
+
end
|
95
|
+
|
96
|
+
def providers(headers = nil, &block)
|
97
|
+
data = nil
|
98
|
+
|
99
|
+
response = connection(allow_guest: true).get(
|
100
|
+
"addon_providers",
|
101
|
+
data,
|
102
|
+
headers,
|
103
|
+
&block
|
104
|
+
)
|
105
|
+
|
106
|
+
unpack(response, key: :addon_providers)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require "scalingo/api/endpoint"
|
2
|
+
|
3
|
+
module Scalingo
|
4
|
+
class Regional::Apps < API::Endpoint
|
5
|
+
def all(headers = nil, &block)
|
6
|
+
data = nil
|
7
|
+
|
8
|
+
response = connection.get(
|
9
|
+
"apps",
|
10
|
+
data,
|
11
|
+
headers,
|
12
|
+
&block
|
13
|
+
)
|
14
|
+
|
15
|
+
unpack(response, key: :apps)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(id, headers = nil, &block)
|
19
|
+
data = nil
|
20
|
+
|
21
|
+
response = connection.get(
|
22
|
+
"apps/#{id}",
|
23
|
+
data,
|
24
|
+
headers,
|
25
|
+
&block
|
26
|
+
)
|
27
|
+
|
28
|
+
unpack(response, key: :app)
|
29
|
+
end
|
30
|
+
|
31
|
+
def create(payload = {}, headers = nil, &block)
|
32
|
+
data = {app: payload}
|
33
|
+
|
34
|
+
dry_run = !!(payload[:dry_run] || payload["dry_run"])
|
35
|
+
|
36
|
+
request_headers = {}
|
37
|
+
request_headers["X-Dry-Run"] = "true" if dry_run
|
38
|
+
request_headers.update(headers) if headers
|
39
|
+
|
40
|
+
response = connection.post(
|
41
|
+
"apps",
|
42
|
+
data,
|
43
|
+
request_headers,
|
44
|
+
&block
|
45
|
+
)
|
46
|
+
|
47
|
+
unpack(response, key: :app)
|
48
|
+
end
|
49
|
+
|
50
|
+
def update(id, payload = {}, headers = nil, &block)
|
51
|
+
data = {app: payload}
|
52
|
+
|
53
|
+
response = connection.patch(
|
54
|
+
"apps/#{id}",
|
55
|
+
data,
|
56
|
+
headers,
|
57
|
+
&block
|
58
|
+
)
|
59
|
+
|
60
|
+
unpack(response, key: :app)
|
61
|
+
end
|
62
|
+
|
63
|
+
def logs_url(id, headers = nil, &block)
|
64
|
+
data = nil
|
65
|
+
|
66
|
+
response = connection.get(
|
67
|
+
"apps/#{id}/logs",
|
68
|
+
data,
|
69
|
+
headers,
|
70
|
+
&block
|
71
|
+
)
|
72
|
+
|
73
|
+
unpack(response, key: :logs_url)
|
74
|
+
end
|
75
|
+
|
76
|
+
def destroy(id, payload = {}, headers = nil, &block)
|
77
|
+
response = connection.delete(
|
78
|
+
"apps/#{id}",
|
79
|
+
payload,
|
80
|
+
headers,
|
81
|
+
&block
|
82
|
+
)
|
83
|
+
|
84
|
+
unpack(response)
|
85
|
+
end
|
86
|
+
|
87
|
+
def rename(id, payload = {}, headers = nil, &block)
|
88
|
+
response = connection.post(
|
89
|
+
"apps/#{id}/rename",
|
90
|
+
payload,
|
91
|
+
headers,
|
92
|
+
&block
|
93
|
+
)
|
94
|
+
|
95
|
+
unpack(response, key: :app)
|
96
|
+
end
|
97
|
+
|
98
|
+
def transfer(id, payload = {}, headers = nil, &block)
|
99
|
+
response = connection.patch(
|
100
|
+
"apps/#{id}",
|
101
|
+
payload,
|
102
|
+
headers,
|
103
|
+
&block
|
104
|
+
)
|
105
|
+
|
106
|
+
unpack(response, key: :app)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "scalingo/api/endpoint"
|
2
|
+
|
3
|
+
module Scalingo
|
4
|
+
class Regional::Collaborators < API::Endpoint
|
5
|
+
def for(app_id, headers = nil, &block)
|
6
|
+
data = nil
|
7
|
+
|
8
|
+
response = connection.get(
|
9
|
+
"apps/#{app_id}/collaborators",
|
10
|
+
data,
|
11
|
+
headers,
|
12
|
+
&block
|
13
|
+
)
|
14
|
+
|
15
|
+
unpack(response, key: :collaborators)
|
16
|
+
end
|
17
|
+
|
18
|
+
def destroy(app_id, collaborator_id, headers = nil, &block)
|
19
|
+
data = nil
|
20
|
+
|
21
|
+
response = connection.delete(
|
22
|
+
"apps/#{app_id}/collaborators/#{collaborator_id}",
|
23
|
+
data,
|
24
|
+
headers,
|
25
|
+
&block
|
26
|
+
)
|
27
|
+
|
28
|
+
unpack(response)
|
29
|
+
end
|
30
|
+
|
31
|
+
def invite(app_id, payload = {}, headers = nil, &block)
|
32
|
+
data = {collaborator: payload}
|
33
|
+
|
34
|
+
response = connection.post(
|
35
|
+
"apps/#{app_id}/collaborators",
|
36
|
+
data,
|
37
|
+
headers,
|
38
|
+
&block
|
39
|
+
)
|
40
|
+
|
41
|
+
unpack(response, key: :collaborator)
|
42
|
+
end
|
43
|
+
|
44
|
+
def accept(token, headers = nil, &block)
|
45
|
+
data = {token: token}
|
46
|
+
|
47
|
+
response = connection.get(
|
48
|
+
"apps/collaboration",
|
49
|
+
data,
|
50
|
+
headers,
|
51
|
+
&block
|
52
|
+
)
|
53
|
+
|
54
|
+
unpack(response)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "scalingo/api/endpoint"
|
2
|
+
|
3
|
+
module Scalingo
|
4
|
+
class Regional::Containers < API::Endpoint
|
5
|
+
def for(app_id, headers = nil, &block)
|
6
|
+
data = nil
|
7
|
+
|
8
|
+
response = connection.get(
|
9
|
+
"apps/#{app_id}/containers",
|
10
|
+
data,
|
11
|
+
headers,
|
12
|
+
&block
|
13
|
+
)
|
14
|
+
|
15
|
+
unpack(response, key: :containers)
|
16
|
+
end
|
17
|
+
|
18
|
+
def scale(app_id, formation, headers = nil, &block)
|
19
|
+
data = {containers: formation}
|
20
|
+
|
21
|
+
response = connection.post(
|
22
|
+
"apps/#{app_id}/scale",
|
23
|
+
data,
|
24
|
+
headers,
|
25
|
+
&block
|
26
|
+
)
|
27
|
+
|
28
|
+
unpack(response, key: :containers)
|
29
|
+
end
|
30
|
+
|
31
|
+
def restart(app_id, scope = [], headers = nil, &block)
|
32
|
+
data = {scope: scope}
|
33
|
+
|
34
|
+
response = connection.post(
|
35
|
+
"apps/#{app_id}/restart",
|
36
|
+
data,
|
37
|
+
headers,
|
38
|
+
&block
|
39
|
+
)
|
40
|
+
|
41
|
+
unpack(response)
|
42
|
+
end
|
43
|
+
|
44
|
+
def sizes(headers = nil, &block)
|
45
|
+
data = nil
|
46
|
+
|
47
|
+
response = connection(allow_guest: true).get(
|
48
|
+
"features/container_sizes",
|
49
|
+
data,
|
50
|
+
headers,
|
51
|
+
&block
|
52
|
+
)
|
53
|
+
|
54
|
+
unpack(response, key: :container_sizes)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "scalingo/api/endpoint"
|
2
|
+
|
3
|
+
module Scalingo
|
4
|
+
class Regional::Deployments < API::Endpoint
|
5
|
+
def for(app_id, payload = {}, headers = nil, &block)
|
6
|
+
data = payload.compact
|
7
|
+
|
8
|
+
response = connection.get(
|
9
|
+
"apps/#{app_id}/deployments",
|
10
|
+
data,
|
11
|
+
headers,
|
12
|
+
&block
|
13
|
+
)
|
14
|
+
|
15
|
+
unpack(response, key: :deployments)
|
16
|
+
end
|
17
|
+
|
18
|
+
def find(app_id, deployment_id, headers = nil, &block)
|
19
|
+
data = nil
|
20
|
+
|
21
|
+
response = connection.get(
|
22
|
+
"apps/#{app_id}/deployments/#{deployment_id}",
|
23
|
+
data,
|
24
|
+
headers,
|
25
|
+
&block
|
26
|
+
)
|
27
|
+
|
28
|
+
unpack(response, key: :deployment)
|
29
|
+
end
|
30
|
+
|
31
|
+
def logs(app_id, deployment_id, headers = nil, &block)
|
32
|
+
data = nil
|
33
|
+
|
34
|
+
response = connection.get(
|
35
|
+
"apps/#{app_id}/deployments/#{deployment_id}/output",
|
36
|
+
data,
|
37
|
+
headers,
|
38
|
+
&block
|
39
|
+
)
|
40
|
+
|
41
|
+
unpack(response, key: :deployment)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|