summaryrefslogtreecommitdiff
path: root/api-ref/source/os-keypairs.inc
blob: 76099fad165e45b880cdfcc6268ea3e72df7149d (plain)
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
.. -*- rst -*-

=====================
 Keypairs (keypairs)
=====================

Generates, imports, and deletes SSH keys.

List Keypairs
=============

.. rest_method:: GET /os-keypairs

Lists keypairs that are associated with the account.

Normal response codes: 200

Error response codes: unauthorized(401), forbidden(403)

Request
-------

.. rest_parameters:: parameters.yaml

  - user_id: keypair_user
  - limit: keypair_limit
  - marker: keypair_marker

Response
--------

.. rest_parameters:: parameters.yaml

  - keypairs: keypairs
  - keypair: keypair
  - name: keypair_name
  - public_key: keypair_public_key
  - fingerprint: keypair_fingerprint
  - type: keypair_type
  - keypairs_links: keypair_links

**Example List Keypairs (v2.35): JSON response**

.. literalinclude:: ../../doc/api_samples/os-keypairs/v2.35/keypairs-list-resp.json
   :language: javascript

Import (or create) Keypair
==========================

.. rest_method:: POST /os-keypairs

Imports (or generates) a keypair.

.. warning::

   Generating a keypair is no longer possible starting from version 2.92.

Normal response codes: 200, 201

.. note::

   The success status code was changed from 200 to 201 in version 2.2

Error response codes: badRequest(400), unauthorized(401), forbidden(403), conflict(409)

Request
-------

.. rest_parameters:: parameters.yaml

  - keypair: keypair
  - name: keypair_name_in
  - public_key: keypair_public_key_in
  - type: keypair_type_in
  - user_id: keypair_userid_in

**Example Create Or Import Keypair (v2.10): JSON request**

.. literalinclude:: ../../doc/api_samples/os-keypairs/v2.10/keypairs-import-post-req.json
   :language: javascript

**Example Import Keypair (v2.92): JSON request**

.. literalinclude:: ../../doc/api_samples/os-keypairs/v2.92/keypairs-import-post-req.json
   :language: javascript

Response
--------

.. rest_parameters:: parameters.yaml

  - keypair: keypair
  - name: keypair_name
  - public_key: keypair_public_key
  - fingerprint: keypair_fingerprint
  - user_id: keypair_userid
  - private_key: keypair_private_key
  - type: keypair_type

**Example Create Or Import Keypair (v2.10): JSON response**

.. literalinclude:: ../../doc/api_samples/os-keypairs/v2.10/keypairs-import-post-resp.json
   :language: javascript

**Example Import Keypair (v2.92): JSON response**

.. literalinclude:: ../../doc/api_samples/os-keypairs/v2.92/keypairs-import-post-resp.json
   :language: javascript

Show Keypair Details
====================

.. rest_method:: GET /os-keypairs/{keypair_name}

Shows details for a keypair that is associated with the account.

Normal response codes: 200

Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)

Request
-------

.. rest_parameters:: parameters.yaml

  - keypair_name: keypair_name_path
  - user_id: keypair_user

Response
--------

.. rest_parameters:: parameters.yaml

  - keypair: keypair
  - created_at: created
  - deleted: keypair_deleted
  - deleted_at: keypair_updated_deleted_at
  - fingerprint: keypair_fingerprint
  - id: keypair_id
  - name: keypair_name
  - public_key: keypair_public_key
  - updated_at: keypair_updated_deleted_at
  - user_id: keypair_userid
  - type: keypair_type

**Example Show Keypair Details (v2.10): JSON response**

.. literalinclude:: ../../doc/api_samples/os-keypairs/v2.10/keypairs-get-resp.json
   :language: javascript

Delete Keypair
==============

.. rest_method:: DELETE /os-keypairs/{keypair_name}

Deletes a keypair.

Normal response codes: 202, 204

.. note::

   The normal return code is 204 in version 2.2 to match the fact that
   no body content is returned.

Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)

Request
-------

.. rest_parameters:: parameters.yaml

  - keypair_name: keypair_name_path
  - user_id: keypair_user

Response
--------

There is no body content for the response of a successful DELETE query