forked from xcarpentier/developers.scalingo.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addons.html
204 lines (168 loc) · 12.5 KB
/
addons.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
---
layout: default
title: Addons
---
<div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'><h1 id="addons">Addons</h1>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p><strong>Addon attributes</strong></p>
<table class="table">
<thead>
<tr>
<th>field</th>
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>string</td>
<td>unique ID identifying the addon</td>
</tr>
<tr>
<td>provisioned_at</td>
<td>date</td>
<td>when the addon has been created</td>
</tr>
<tr>
<td>deprovisioned_at</td>
<td>date</td>
<td>when the addon has been removed/upgraded</td>
</tr>
<tr>
<td>resource_id</td>
<td>string</td>
<td>resource reference</td>
</tr>
<tr>
<td>plan</td>
<td>object</td>
<td>embedded reference to Plan resource</td>
</tr>
<tr>
<td>addon_provider</td>
<td>object</td>
<td>embedded reference to AddonProvider resource</td>
</tr>
</tbody>
</table>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example object:</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"5415beca646173000b015000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"provisioned_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-02-22T18:55:02.766+01:00"</span><span class="p">,</span><span class="w">
</span><span class="s2">"deprovisioned_at"</span><span class="p">:</span><span class="w"> </span><span class="err">nil</span><span class="p">,</span><span class="w">
</span><span class="s2">"plan"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"description"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"[Markdown description]"</span><span class="p">,</span><span class="w">
</span><span class="s2">"display_name"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"64MB Free tier"</span><span class="p">,</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"52fd2357356330032b080000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"free"</span><span class="p">,</span><span class="w">
</span><span class="s2">"price"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mf">0.0</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="s2">"resource_id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"example_app_3083"</span><span class="p">,</span><span class="w">
</span><span class="s2">"addon_provider"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"scalingo-redis"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"Scalingo Redis"</span><span class="p">,</span><span class="w">
</span><span class="s2">"logo_url"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"//storage.sbg1.cloud.ovh.net/v1/AUTH_be65d32d71a6435589a419eac98613f2/scalingo/redis.png"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="list-application-addons">List application addons</h2>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p><code class="highlighter-rouge">GET https://api.scalingo.com/v1/apps/[:app]/addons</code></p>
<p>List all the provisioned addons for a given application.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\ </span>
-X GET https://api.scalingo.com/v1/apps/example-app/addons
</code></pre>
</div>
<p>Returns 201 Created</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"addons"</span><span class="p">:</span><span class="w"> </span><span class="p">[{</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"5415beca646173000b015000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"provisioned_at"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2015-02-22T18:55:02.766+01:00"</span><span class="p">,</span><span class="w">
</span><span class="s2">"deprovisioned_at"</span><span class="p">:</span><span class="w"> </span><span class="err">nil</span><span class="p">,</span><span class="w">
</span><span class="s2">"plan"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"description"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"[Markdown description]"</span><span class="p">,</span><span class="w">
</span><span class="s2">"display_name"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"64MB Free tier"</span><span class="p">,</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"52fd2357356330032b080000"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"free"</span><span class="p">,</span><span class="w">
</span><span class="s2">"price"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="s2">"resource_id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"example_app_3083"</span><span class="p">,</span><span class="w">
</span><span class="s2">"addon_provider"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"scalingo-redis"</span><span class="p">,</span><span class="w">
</span><span class="s2">"name"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"Scalingo Redis"</span><span class="p">,</span><span class="w">
</span><span class="s2">"logo_url"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"//storage.sbg1.cloud.ovh.net/v1/AUTH_be65d32d71a6435589a419eac98613f2/scalingo/redis.png"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="provision-an-addon">Provision an addon</h2>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p><code class="highlighter-rouge">POST https://api.scalingo.com/v1/apps/[:app]/addons</code></p>
<p>Provision the addon defined by the <code class="highlighter-rouge">addon_provider</code> at the given plan.
The resource should be instantly available, it modifies environment
variables.</p>
<h3 id="parameters">Parameters</h3>
<ul>
<li><code class="highlighter-rouge">addon.addon_provider_id</code></li>
<li><code class="highlighter-rouge">addon.plan_id</code></li>
</ul>
<p>Free usage limit:</p>
<p>You can only use free addons without having defined <a href="https://my.scalingo.com/apps/billing">a payment
method</a>.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\</span>
-X POST https://api.scalingo.com/v1/apps/[:app]/addons <span class="se">\</span>
-d <span class="s1">'{"addon":{"plan_id": "1234", "addon_provider_id": "1234"}}'</span>
</code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="upgrade-an-addon">Upgrade an addon</h2>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p><code class="highlighter-rouge">PATCH https://api.scalingo.com/v1/apps/[:app]/addons/[:addon_id]</code></p>
<p>Change your addon plan. The endpoint will query the addon provider to
upgrade your plan to a new one.</p>
<p>Be cautious though, the operation might fail. The provider may refuse to
downgrade an addon if the operation is invalid. Example: You have a 3GB
database and you want to return to the free tier database at 512MB.</p>
<h3 id="parameters">Parameters</h3>
<ul>
<li><code class="highlighter-rouge">addon.plan_id</code></li>
</ul>
<p>Free usage limit:</p>
<p>You can only use free addons without having defined <a href="https://my.scalingo.com/apps/billing">a payment
method</a>.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\</span>
-X PATCH https://api.scalingo.com/v1/apps/[:app]/addons/[:addon_id] <span class="se">\</span>
-d <span class="s1">'{"addon": {"plan_id": "2"}}'</span>
</code></pre>
</div>
<p>Returns 200 OK</p>
<div class="highlighter-rouge"><pre class="highlight"><code><span class="p">{</span><span class="w">
</span><span class="s2">"vars"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"VAR1"</span><span class="p">,</span><span class="w"> </span><span class="s2">"VAR2"</span><span class="p">],</span><span class="w">
</span><span class="s2">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"<custom message from the addon provider>"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>
</div>
</div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<h2 id="remove-an-addon">Remove an addon</h2>
</div><div class='hidden-xs col-xs-12 col-sm-6 sidebar-code'></div></div><div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'>
<p><code class="highlighter-rouge">DELETE htttps://api.scalingo.com/v1/apps/[:app]/addons/[:addon_id]</code></p>
<p>Request deprovisionning of the addon. This may be a dangerous operation as the
addon provider will certainly erase all the data related to your application.
Be cautious when deleting addons, be sure of what you’re doing.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H <span class="s2">"Accept: application/json"</span> -H <span class="s2">"Content-Type: application/json"</span> -u :<span class="nv">$AUTH_TOKEN</span> <span class="se">\</span>
-X DELETE https://api.scalingo.com/v1/apps/[:app]/addons/[:addon_id] <span class="se">\</span>
</code></pre>
</div>
<p>Returns 204 No Content</p>
</div></div>