forked from xcarpentier/developers.scalingo.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.html
179 lines (144 loc) · 10.9 KB
/
keys.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
---
layout: default
title: SSH Keys
---
<div class='row'><div class='col-xs-12 col-sm-6 sidebar-text'><h1 id="ssh-keys">SSH Keys</h1>
<p>SSH keys allow you to deploy their applications and to build encrypted tunnels
to the application databases (command <code class="highlighter-rouge">db-tunnel</code> of our <a href="http://cli.scalingo.com">CLI
Tool</a>).</p>
</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>Keys 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 of the key</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>Given name to the key</td>
</tr>
<tr>
<td>content</td>
<td>string</td>
<td>Raw content of the SSH public key</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">"54dcde4a54636101231a0000"</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">"Office Laptop"</span><span class="p">,</span><span class="w">
</span><span class="s2">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmlEXHPj43jNzIiFbFx0NlcZpsFQZUC4paVoDf1/VXeA4P5ld5YT5O4PQEwvx/V8HzQit0sXRgUSFcKgGlAs9b0ea/nzxov8b3kc+Z5Ak1aRSkXKYE30xW9ALag9Pdf1ejzUXMY3X4bltEsyx7wV5i1hkKzQPHrH4SjhcGv+ILAg4J9KDfyqQ2QmKzVA+Esbmg3RE0IGbZIoNBxBYbNejcaw8+lX7nLsqAP8fZ+dgFP3JYsOYuTibtM5s09Gw7c3oXLrRm6F5G/Au6HYqlNYEKUYgZ2UmXox2vK1ljOZYzcOGj9kGqJ5DQgn88cVPqbA73vAYKGY6WcZf2X+3JOTct [email protected]"</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-all-ssh-keys">List all SSH keys</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/account/keys</code></p>
<p>Return the list of all the public keys which are able to connect to the
platform.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H 'Accept: application/json' -H 'Content-Type: application/json' -u ":$AUTH_TOKEN" \
-X GET https://api.scalingo.com/v1/account/keys
</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">"keys"</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><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"54dcde4a54636101231a0000"</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">"Office Laptop"</span><span class="p">,</span><span class="w">
</span><span class="s2">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmlEXHPj43jNzIiFbFx0NlcZpsFQZUC4paVoDf1/VXeA4P5ld5YT5O4PQEwvx/V8HzQit0sXRgUSFcKgGlAs9b0ea/nzxov8b3kc+Z5Ak1aRSkXKYE30xW9ALag9Pdf1ejzUXMY3X4bltEsyx7wV5i1hkKzQPHrH4SjhcGv+ILAg4J9KDfyqQ2QmKzVA+Esbmg3RE0IGbZIoNBxBYbNejcaw8+lX7nLsqAP8fZ+dgFP3JYsOYuTibtM5s09Gw7c3oXLrRm6F5G/Au6HYqlNYEKUYgZ2UmXox2vK1ljOZYzcOGj9kGqJ5DQgn88cVPqbA73vAYKGY6WcZf2X+3JOTct [email protected]"</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">"54dcde4a54a36131231a0001"</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">"Continuous Integration"</span><span class="p">,</span><span class="w">
</span><span class="s2">"content"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"<Public SSH Key>"</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="get-a-precise-ssh-key">Get a precise SSH key</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/account/keys/[:key_id]</code></p>
<p>Return a given public ssh key.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H 'Accept: application/json' -H 'Content-Type: application/json' -u ":$AUTH_TOKEN" \
-X GET https://api.scalingo.com/v1/account/keys/54dcde4a54636101231a0000
</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">"key"</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><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"54dcde4a54636101231a0000"</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">"Office Laptop"</span><span class="p">,</span><span class="w">
</span><span class="s2">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmlEXHPj43jNzIiFbFx0NlcZpsFQZUC4paVoDf1/VXeA4P5ld5YT5O4PQEwvx/V8HzQit0sXRgUSFcKgGlAs9b0ea/nzxov8b3kc+Z5Ak1aRSkXKYE30xW9ALag9Pdf1ejzUXMY3X4bltEsyx7wV5i1hkKzQPHrH4SjhcGv+ILAg4J9KDfyqQ2QmKzVA+Esbmg3RE0IGbZIoNBxBYbNejcaw8+lX7nLsqAP8fZ+dgFP3JYsOYuTibtM5s09Gw7c3oXLrRm6F5G/Au6HYqlNYEKUYgZ2UmXox2vK1ljOZYzcOGj9kGqJ5DQgn88cVPqbA73vAYKGY6WcZf2X+3JOTct [email protected]"</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="allow-a-new-public-ssh-key">Allow a new public SSH key</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/account/keys</code></p>
<p>Allow a new SSH key pair to deploy applications</p>
<h3 id="parameters">Parameters</h3>
<ul>
<li><code class="highlighter-rouge">key.name</code>: Name of the key you want to add</li>
<li><code class="highlighter-rouge">key.content</code>: Public SSH key content (ie. content of <code class="highlighter-rouge">~/.ssh/id_rsa.pub</code>)</li>
</ul>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H 'Accept: application/json' -H 'Content-Type: application/json' -u ":$AUTH_TOKEN" \
-X POST https://api.scalingo.com/v1/account/keys -d \
'{
"key" {
"name" : "Office Laptop",
"content" : "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmlEXHPj43jNzIiFbFx0NlcZpsFQZUC4paVoDf1/VXeA4P5ld5YT5O4PQEwvx/V8HzQit0sXRgUSFcKgGlAs9b0ea/nzxov8b3kc+Z5Ak1aRSkXKYE30xW9ALag9Pdf1ejzUXMY3X4bltEsyx7wV5i1hkKzQPHrH4SjhcGv+ILAg4J9KDfyqQ2QmKzVA+Esbmg3RE0IGbZIoNBxBYbNejcaw8+lX7nLsqAP8fZ+dgFP3JYsOYuTibtM5s09Gw7c3oXLrRm6F5G/Au6HYqlNYEKUYgZ2UmXox2vK1ljOZYzcOGj9kGqJ5DQgn88cVPqbA73vAYKGY6WcZf2X+3JOTct [email protected]"
}
}'
</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">"key"</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><span class="s2">"id"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"54dcde4a54636101231a0000"</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">"Office Laptop"</span><span class="p">,</span><span class="w">
</span><span class="s2">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCmlEXHPj43jNzIiFbFx0NlcZpsFQZUC4paVoDf1/VXeA4P5ld5YT5O4PQEwvx/V8HzQit0sXRgUSFcKgGlAs9b0ea/nzxov8b3kc+Z5Ak1aRSkXKYE30xW9ALag9Pdf1ejzUXMY3X4bltEsyx7wV5i1hkKzQPHrH4SjhcGv+ILAg4J9KDfyqQ2QmKzVA+Esbmg3RE0IGbZIoNBxBYbNejcaw8+lX7nLsqAP8fZ+dgFP3JYsOYuTibtM5s09Gw7c3oXLrRm6F5G/Au6HYqlNYEKUYgZ2UmXox2vK1ljOZYzcOGj9kGqJ5DQgn88cVPqbA73vAYKGY6WcZf2X+3JOTct [email protected]"</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="remove-a-ssh-key-from-the-account">Remove a SSH key from the account</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 https://api.scalingo.com/v1/account/keys/[:key_id]</code></p>
<p>The modification will take effect immediately, the usage of this key will result
in ‘Unauthorized’ errors.</p>
</div><div class='col-xs-12 col-sm-6 sidebar-code'>
<p>Example request</p>
<div class="highlighter-rouge"><pre class="highlight"><code>curl -H 'Accept: application/json' -H 'Content-Type: application/json' -u ":$AUTH_TOKEN" \
-X DELETE https://api.scalingo.com/v1/account/keys/54dcde4a54636101231a0000
</code></pre>
</div>
<p>Returns 204 No Content</p>
</div></div>