-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added reserved ipv6 API specs (#951)
* added reserved ipv6 * fixed lint issues * Addressed review comments * fixed schemas and responses * removed ruby examples * removed ruby example refs * addressed review comments * fixed python examples * replaced beta with public-preview * removed project_id from resp * added 422 error * fixed lint issue * added null value for droplet --------- Co-authored-by: Anna Lushnikova <[email protected]>
- Loading branch information
Showing
32 changed files
with
902 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
specification/resources/reserved_ipv6/examples/curl/create_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
lang: cURL | ||
source: |- | ||
curl -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
-d '{"region_slug": "nyc3"}' \ | ||
"https://api.digitalocean.com/v2/reserved_ipv6" |
6 changes: 6 additions & 0 deletions
6
specification/resources/reserved_ipv6/examples/curl/delete_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
lang: cURL | ||
source: |- | ||
curl -X DELETE \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
"https://api.digitalocean.com/v2/reserved_ipv6/2409:40d0:f7:1017:74b4:3a96:105e:4c6e" |
6 changes: 6 additions & 0 deletions
6
specification/resources/reserved_ipv6/examples/curl/get_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
lang: cURL | ||
source: |- | ||
curl -X GET \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
"https://api.digitalocean.com/v2/reserved_ipv6/2409:40d0:f7:1017:74b4:3a96:105e:4c6e" |
6 changes: 6 additions & 0 deletions
6
specification/resources/reserved_ipv6/examples/curl/list_reserved_ipv6s.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
lang: cURL | ||
source: |- | ||
curl -X GET \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
"https://api.digitalocean.com/v2/reserved_ipv6?page=1&per_page=20" |
15 changes: 15 additions & 0 deletions
15
specification/resources/reserved_ipv6/examples/curl/post_reserved_ipv6_action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
lang: cURL | ||
source: |- | ||
# Assign a Reserved IPv6 to a Droplet | ||
curl -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
-d '{"type":"assign","droplet_id":8219222}' \ | ||
"https://api.digitalocean.com/v2/reserved_ipv6/2409:40d0:f7:1017:74b4:3a96:105e:4c6e/actions" | ||
# Unassign a Reserved IPv6 from a Droplet | ||
curl -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | ||
-d '{"type":"unassign"}' \ | ||
"https://api.digitalocean.com/v2/reserved_ipv6/2409:40d0:f7:1017:74b4:3a96:105e:4c6e/actions" |
21 changes: 21 additions & 0 deletions
21
specification/resources/reserved_ipv6/examples/go/create_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
lang: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
createRequest := &godo.ReservedIPV6CreateRequest{ | ||
RegionSlug: "nyc3", | ||
} | ||
reservedIPV6, _, err := client.ReservedIPV6s.Create(ctx, createRequest) | ||
} |
17 changes: 17 additions & 0 deletions
17
specification/resources/reserved_ipv6/examples/go/delete_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
lang: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
_, err := client.ReservedIPV6s.Delete(ctx, "2409:40d0:f7:1017:74b4:3a96:105e:4c6e") | ||
} |
17 changes: 17 additions & 0 deletions
17
specification/resources/reserved_ipv6/examples/go/get_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
lang: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
reservedIP, _, err := client.ReservedIPV6s.Get(ctx, "2409:40d0:f7:1017:74b4:3a96:105e:4c6e") | ||
} |
22 changes: 22 additions & 0 deletions
22
specification/resources/reserved_ipv6/examples/go/list_reserved_ipv6s.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
lang: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
opt := &godo.ListOptions{ | ||
Page: 1, | ||
PerPage: 200, | ||
} | ||
reservedIPs, _, err := client.ReservedIPV6s.List(ctx, opt) | ||
} |
21 changes: 21 additions & 0 deletions
21
specification/resources/reserved_ipv6/examples/go/post_reserved_ipv6_action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
lang: Go | ||
source: |- | ||
import ( | ||
"context" | ||
"os" | ||
"github.com/digitalocean/godo" | ||
) | ||
func main() { | ||
token := os.Getenv("DIGITALOCEAN_TOKEN") | ||
client := godo.NewFromToken(token) | ||
ctx := context.TODO() | ||
// Assign a Reserved IPv6 to a Droplet | ||
action, _, err := client.ReservedIPV6Actions.Assign(ctx, "2409:40d0:f7:1017:74b4:3a96:105e:4c6e", 8219222) | ||
// Unassign a Reserved IPv6 | ||
action, _, err := client.ReservedIPV6Actions.Unassign(ctx, "2409:40d0:f7:1017:74b4:3a96:105e:4c6e") | ||
} |
12 changes: 12 additions & 0 deletions
12
specification/resources/reserved_ipv6/examples/python/create_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
lang: Python | ||
source: |- | ||
import os | ||
from pydo import Client | ||
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) | ||
req = { | ||
"region_slug": nyc3 | ||
} | ||
resp = client.reserved_ipv6s.create(body=req) |
8 changes: 8 additions & 0 deletions
8
specification/resources/reserved_ipv6/examples/python/delete_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
lang: Python | ||
source: |- | ||
import os | ||
from pydo import Client | ||
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) | ||
resp = client.reserved_ipv6s.delete(reserved_ipv6="2409:40d0:f7:1017:74b4:3a96:105e:4c6e") |
8 changes: 8 additions & 0 deletions
8
specification/resources/reserved_ipv6/examples/python/get_reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
lang: Python | ||
source: |- | ||
import os | ||
from pydo import Client | ||
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) | ||
resp = client.reserved_ipv6s.get(reserved_ipv6="2409:40d0:f7:1017:74b4:3a96:105e:4c6e") |
8 changes: 8 additions & 0 deletions
8
specification/resources/reserved_ipv6/examples/python/list_reserved_ipv6s.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
lang: Python | ||
source: |- | ||
import os | ||
from pydo import Client | ||
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) | ||
resp = client.reserved_ipv6s.list() |
12 changes: 12 additions & 0 deletions
12
specification/resources/reserved_ipv6/examples/python/post_reserved_ipv6_action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
lang: Python | ||
source: |- | ||
import os | ||
from pydo import Client | ||
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) | ||
req={ | ||
"type": "unassign" | ||
} | ||
resp = client.reserved_ipv6s_actions.post(reserved_ipv6="2409:40d0:f7:1017:74b4:3a96:105e:4c6e", body=req) |
33 changes: 33 additions & 0 deletions
33
specification/resources/reserved_ipv6/models/reserved_ipv6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
type: object | ||
|
||
properties: | ||
ip: | ||
type: string | ||
format: ipv6 | ||
example: 2409:40d0:f7:1017:74b4:3a96:105e:4c6e | ||
description: The public IP address of the reserved IPv6. It also serves as its | ||
identifier. | ||
|
||
reserved_at: | ||
type: string | ||
format: date-time | ||
example: "2024-11-20T11:08:30Z" | ||
description: The date and time when the reserved IPv6 was reserved. | ||
|
||
region_slug: | ||
type: string | ||
description: The region that the reserved IPv6 is reserved to. When you | ||
query a reserved IPv6,the region_slug will be returned. | ||
example: nyc3 | ||
|
||
droplet: | ||
anyOf: | ||
- title: 'null' | ||
type: object | ||
nullable: true | ||
description: If the reserved IP is not assigned to a Droplet, the | ||
value will be null. | ||
- $ref: '../../droplets/models/droplet.yml' | ||
example: null | ||
|
||
|
36 changes: 36 additions & 0 deletions
36
specification/resources/reserved_ipv6/models/reserved_ipv6_actions.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
reserved_ipv6_action_type: | ||
type: object | ||
required: | ||
- type | ||
properties: | ||
type: | ||
type: string | ||
enum: | ||
- assign | ||
- unassign | ||
description: The type of action to initiate for the reserved IPv6. | ||
discriminator: | ||
propertyName: type | ||
mapping: | ||
assign: '#/reserved_ipv6_action_assign' | ||
unassign: '#/reserved_ipv6_action_unassign' | ||
|
||
reserved_ipv6_action_unassign: | ||
allOf: | ||
- $ref: '#/reserved_ipv6_action_type' | ||
- type: object | ||
required: | ||
- type | ||
|
||
reserved_ipv6_action_assign: | ||
allOf: | ||
- $ref: '#/reserved_ipv6_action_type' | ||
- type: object | ||
required: | ||
- type | ||
- droplet_id | ||
properties: | ||
droplet_id: | ||
type: integer | ||
example: 758604968 | ||
description: The ID of the Droplet that the reserved IPv6 will be assigned to. |
9 changes: 9 additions & 0 deletions
9
specification/resources/reserved_ipv6/models/reserved_ipv6_create.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
title: Reserve to Region | ||
type: object | ||
properties: | ||
region_slug: | ||
type: string | ||
example: nyc3 | ||
description: The slug identifier for the region the reserved IPv6 will be reserved to. | ||
required: | ||
- region_slug |
30 changes: 30 additions & 0 deletions
30
specification/resources/reserved_ipv6/models/reserved_ipv6_list.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
type: object | ||
properties: | ||
reserved_ipv6s: | ||
type: array | ||
items: | ||
properties: | ||
ip: | ||
type: string | ||
format: ipv6 | ||
example: 2409:40d0:f7:1017:74b4:3a96:105e:4c6e | ||
description: The public IP address of the reserved IPv6. It also serves as its | ||
identifier. | ||
region_slug: | ||
type: string | ||
description: The region that the reserved IPv6 is reserved to. When you | ||
query a reserved IPv6,the region_slug will be returned. | ||
example: nyc3 | ||
reserved_at: | ||
type: string | ||
format: date-time | ||
example: '2020-01-01T00:00:00Z' | ||
droplet: | ||
anyOf: | ||
- title: 'null' | ||
type: object | ||
nullable: true | ||
description: If the reserved IP is not assigned to a Droplet, the | ||
value will be null. | ||
- $ref: '../../droplets/models/droplet.yml' | ||
example: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
reserved_ipv6: | ||
in: path | ||
name: reserved_ipv6 | ||
description: A reserved IPv6 address. | ||
required: true | ||
schema: | ||
type: string | ||
format: ipv6 | ||
minimum: 1 | ||
example: 2409:40d0:f7:1017:74b4:3a96:105e:4c6e |
Oops, something went wrong.