Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Create SSH Key endpoint #12

Merged
merged 3 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ paths:
get:
$ref: 'resources/ssh_keys/list_all_keys.yml'

post:
$ref: 'resources/ssh_keys/create_a_new_key.yml'

/account/keys/{ssh_key_identifier}:
get:
$ref: 'resources/ssh_keys/retrieve_an_existing_key.yml'
Expand Down
5 changes: 4 additions & 1 deletion resources/ssh_keys/attributes/ssh_key_fingerprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ type: string

description: >-
A unique identifier that differentiates this key from other keys using
a format that SSH recognizes.
a format that SSH recognizes. The fingerprint is created when the key
is added to your account.

readOnly: true

example: 3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa
2 changes: 2 additions & 0 deletions resources/ssh_keys/attributes/ssh_key_id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ description: >-
A unique identification number for this key. Can be used to embed a
specific SSH key into a Droplet.

readOnly: true

example: 512189
51 changes: 51 additions & 0 deletions resources/ssh_keys/create_a_new_key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
operationId: create_a_new_key

summary: Add a SSH public key to your account.

description: >-
To add a new SSH public key to your DigitalOcean account, send a POST request to `/v2/account/keys`.
Set the "name" attribute to the name you wish to use and the "public_key" attribute
to the full public key you are adding.

tags:
- SSH Keys

requestBody:
description: >-
Set the "name" attribute to the name you wish to use and the "public_key" attribute
to the full public key you are adding.

required: true

content:
application/json:
schema:
$ref: 'models/ssh_key.yml'

responses:
'201':
description: Created

headers:
ratelimit-limit:
$ref: '../../shared/headers.yml#/ratelimit-limit'
ratelimit-remaining:
$ref: '../../shared/headers.yml#/ratelimit-remaining'
ratelimit-reset:
$ref: '../../shared/headers.yml#/ratelimit-reset'

content:
application/json:
schema:
$ref: 'models/wrapped_ssh_key.yml'

'401':
$ref: '../../shared/responses/unauthorized.yml'

'500':
$ref: '../../shared/responses/server_error.yml'

default:
$ref: '../../shared/responses/unexpected_error.yml'


1 change: 0 additions & 1 deletion resources/ssh_keys/destroy_a_key.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ description: >-
the response body is empty.

tags:
- Account
- SSH Keys

parameters:
Expand Down
1 change: 0 additions & 1 deletion resources/ssh_keys/list_all_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ description: >-
the standard ssh_key attributes.

tags:
- Account
- SSH Keys

parameters:
Expand Down
8 changes: 8 additions & 0 deletions resources/ssh_keys/models/wrapped_ssh_key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: object

properties:
ssh_key:
$ref: 'ssh_key.yml'

required:
- ssh_key
1 change: 0 additions & 1 deletion resources/ssh_keys/retrieve_an_existing_key.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ description: >-
object which contains the standard ssh_key attributes.

tags:
- Account
- SSH Keys

parameters:
Expand Down