Skip to content

Commit c36185b

Browse files
amahajan-dolee-aaronandrewsomethingloosladbrian57
authored
Add Spaces Key API Updated (#993)
* Add Spaces Key API * Fix Lint * Update permissions to be enums * Add curl examples * Fix grants * Dedup Spaces key model * Apply suggestions from code review Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Dan Brian <daniel.brian@gmail.com> * apply suggestions from code review --------- Co-authored-by: Aaron Lee <sphinxer34@yahoo.com> Co-authored-by: Aaron Lee <lee.aaron.68@gmail.com> Co-authored-by: Andrew Starr-Bochicchio <a.starr.b@gmail.com> Co-authored-by: Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com> Co-authored-by: Anna Lushnikova <loosla@users.noreply.github.com> Co-authored-by: Dan Brian <daniel.brian@gmail.com>
1 parent d5e3c64 commit c36185b

22 files changed

+1062
-465
lines changed

specification/DigitalOcean-public.v2.yaml

Lines changed: 454 additions & 465 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
lang: cURL
2+
source: |-
3+
curl -X POST \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
-d '{"name": "test-key", "grants": [{"bucket": "test-bucket", "permission": "read"}]}' \
7+
"https://api.digitalocean.com/v2/spaces/keys"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
lang: cURL
2+
source: |-
3+
curl -X DELETE \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
"https://api.digitalocean.com/v2/spaces/keys/DOACCESSKEYEXAMPLE"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
lang: cURL
2+
source: |-
3+
curl -X GET \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
"https://api.digitalocean.com/v2/spaces/keys/DOACCESSKEYEXAMPLE"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
lang: cURL
2+
source: |-
3+
curl -X GET \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
"https://api.digitalocean.com/v2/spaces/keys"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
lang: cURL
2+
source: |-
3+
curl -X PATCH \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
-d '{"name": "new-key-name"}' \
7+
"https://api.digitalocean.com/v2/spaces/keys/DOACCESSKEYEXAMPLE"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
lang: cURL
2+
source: |-
3+
curl -X PUT \
4+
-H "Content-Type: application/json" \
5+
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
6+
-d '{"name": "new-key-name"}' \
7+
"https://api.digitalocean.com/v2/spaces/keys/DOACCESSKEYEXAMPLE"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
operationId: spacesKey_create
2+
3+
summary: "Create a New Spaces Access Key"
4+
5+
description: |
6+
To create a new Spaces Access Key, send a POST request to `/v2/spaces/keys`.
7+
At the moment, you cannot mix a fullaccess permission with scoped permissions.
8+
A fullaccess permission will be prioritized if fullaccess and scoped permissions are both added.
9+
10+
tags:
11+
- Spaces Keys
12+
13+
requestBody:
14+
required: true
15+
16+
content:
17+
application/json:
18+
schema:
19+
$ref: "models/key.yml"
20+
21+
examples:
22+
Read Only Key:
23+
value:
24+
name: "read-only-key"
25+
grants: [{ "bucket": "my-bucket", "permission": "read" }]
26+
27+
Read Write Key:
28+
value:
29+
name: "read-write-key"
30+
grants: [{ "bucket": "my-bucket", "permission": "readwrite" }]
31+
32+
Full Access Key:
33+
value:
34+
name: "full-access-key"
35+
grants: [{ "bucket": "", "permission": "fullaccess" }]
36+
37+
Mixed Permissions Key:
38+
value:
39+
name: "mixed-permissions-key"
40+
grants:
41+
[
42+
{ "bucket": "my-bucket", "permission": "read" },
43+
{ "bucket": "my-bucket2", "permission": "readwrite" },
44+
]
45+
46+
No Grant Key:
47+
value:
48+
name: "no-grant-key"
49+
grants: []
50+
51+
responses:
52+
"201":
53+
$ref: "responses/key_create.yml"
54+
55+
"400":
56+
$ref: "responses/bad_request.yml"
57+
58+
"401":
59+
$ref: "../../shared/responses/unauthorized.yml"
60+
61+
"429":
62+
$ref: "../../shared/responses/too_many_requests.yml"
63+
64+
"500":
65+
$ref: "../../shared/responses/server_error.yml"
66+
67+
default:
68+
$ref: "../../shared/responses/unexpected_error.yml"
69+
70+
x-codeSamples:
71+
- $ref: "examples/curl/spaces_key_create.yml"
72+
73+
security:
74+
- bearer_auth:
75+
- "spaces_key:create_credentials"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
operationId: spacesKey_delete
2+
3+
summary: "Delete a Spaces Access Key"
4+
5+
description: |
6+
To delete a Spaces Access Key, send a DELETE request to `/v2/spaces/keys/$ACCESS_KEY`.
7+
8+
A successful request will return a `204 No Content` status code.
9+
10+
tags:
11+
- Spaces Keys
12+
13+
parameters:
14+
- $ref: "parameters.yml#/access_key_id"
15+
16+
responses:
17+
"204":
18+
$ref: "../../shared/responses/no_content.yml"
19+
20+
"401":
21+
$ref: "../../shared/responses/unauthorized.yml"
22+
23+
"404":
24+
$ref: "../../shared/responses/not_found.yml"
25+
26+
"429":
27+
$ref: "../../shared/responses/too_many_requests.yml"
28+
29+
"500":
30+
$ref: "../../shared/responses/server_error.yml"
31+
32+
default:
33+
$ref: "../../shared/responses/unexpected_error.yml"
34+
35+
x-codeSamples:
36+
- $ref: "examples/curl/spaces_key_delete.yml"
37+
38+
security:
39+
- bearer_auth:
40+
- "spaces_key:delete"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
operationId: spacesKey_get
2+
3+
summary: "Get a Spaces Access Key"
4+
5+
description: |
6+
To get a Spaces Access Key, send a GET request to `/v2/spaces/keys/$ACCESS_KEY`.
7+
8+
A successful request will return the Access Key.
9+
10+
tags:
11+
- Spaces Keys
12+
13+
parameters:
14+
- $ref: "parameters.yml#/access_key_id"
15+
16+
responses:
17+
"200":
18+
$ref: "responses/key_get.yml"
19+
20+
"401":
21+
$ref: "../../shared/responses/unauthorized.yml"
22+
23+
"404":
24+
$ref: "../../shared/responses/not_found.yml"
25+
26+
"429":
27+
$ref: "../../shared/responses/too_many_requests.yml"
28+
29+
"500":
30+
$ref: "../../shared/responses/server_error.yml"
31+
32+
default:
33+
$ref: "../../shared/responses/unexpected_error.yml"
34+
35+
x-codeSamples:
36+
- $ref: "examples/curl/spaces_key_get.yml"
37+
38+
security:
39+
- bearer_auth:
40+
- "spaces_key:read"

0 commit comments

Comments
 (0)