diff --git a/specification/resources/spaces/examples/go/space_key_patch.yml b/specification/resources/spaces/examples/go/space_key_patch.yml new file mode 100644 index 000000000..85b0c1a7e --- /dev/null +++ b/specification/resources/spaces/examples/go/space_key_patch.yml @@ -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() + + updateReq := &godo.SpacesKeyUpdateRequest{ + Name: "new-key-name", + } + + client.SpacesKeys.Update(ctx, "DOACCESSKEYEXAMPLE", updateReq) + } \ No newline at end of file diff --git a/specification/resources/spaces/examples/go/spaces_key_create.yml b/specification/resources/spaces/examples/go/spaces_key_create.yml new file mode 100644 index 000000000..c47ae890c --- /dev/null +++ b/specification/resources/spaces/examples/go/spaces_key_create.yml @@ -0,0 +1,27 @@ +lang: Go +source: |- + import ( + "context" + "os" + + "github.com/digitalocean/godo" + ) + + func main() { + token := os.Getenv("DIGITALOCEAN_TOKEN") + + client := godo.NewFromToken(token) + ctx := context.TODO() + + createReq := &godo.SpacesKeyCreateRequest{ + Name: "read-only-key", + Grants: []*godo.Grant{ + { + Bucket: "my-bucket", + Permission: godo.SpacesKeyRead, + }, + }, + } + + client.SpacesKeys.Create(ctx, createReq) + } \ No newline at end of file diff --git a/specification/resources/spaces/examples/go/spaces_key_delete.yml b/specification/resources/spaces/examples/go/spaces_key_delete.yml new file mode 100644 index 000000000..d9defdf6b --- /dev/null +++ b/specification/resources/spaces/examples/go/spaces_key_delete.yml @@ -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() + + client.SpacesKeys.Delete(ctx, "DOACCESSKEYEXAMPLE") + } \ No newline at end of file diff --git a/specification/resources/spaces/examples/go/spaces_key_get.yml b/specification/resources/spaces/examples/go/spaces_key_get.yml new file mode 100644 index 000000000..89494567e --- /dev/null +++ b/specification/resources/spaces/examples/go/spaces_key_get.yml @@ -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() + + client.SpacesKeys.Get(ctx, "DOACCESSKEYEXAMPLE") + } \ No newline at end of file diff --git a/specification/resources/spaces/examples/go/spaces_key_list.yml b/specification/resources/spaces/examples/go/spaces_key_list.yml new file mode 100644 index 000000000..2f0204a75 --- /dev/null +++ b/specification/resources/spaces/examples/go/spaces_key_list.yml @@ -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, + } + + client.SpacesKeys.List(ctx, opt) + } \ No newline at end of file diff --git a/specification/resources/spaces/examples/go/spaces_key_update.yml b/specification/resources/spaces/examples/go/spaces_key_update.yml new file mode 100644 index 000000000..85b0c1a7e --- /dev/null +++ b/specification/resources/spaces/examples/go/spaces_key_update.yml @@ -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() + + updateReq := &godo.SpacesKeyUpdateRequest{ + Name: "new-key-name", + } + + client.SpacesKeys.Update(ctx, "DOACCESSKEYEXAMPLE", updateReq) + } \ No newline at end of file diff --git a/specification/resources/spaces/examples/python/spaces_key_create.yml b/specification/resources/spaces/examples/python/spaces_key_create.yml new file mode 100644 index 000000000..3553a5cf7 --- /dev/null +++ b/specification/resources/spaces/examples/python/spaces_key_create.yml @@ -0,0 +1,18 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + req = { + "name": "read-only-key", + "grants": [ + { + "bucket": "my-bucket", + "permission": "read" + } + ] + } + + resp = client.spaces_key.create(body=req) diff --git a/specification/resources/spaces/examples/python/spaces_key_delete.yml b/specification/resources/spaces/examples/python/spaces_key_delete.yml new file mode 100644 index 000000000..525387c06 --- /dev/null +++ b/specification/resources/spaces/examples/python/spaces_key_delete.yml @@ -0,0 +1,8 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + resp = client.spaces_key.delete("DOACCESSKEYEXAMPLE") \ No newline at end of file diff --git a/specification/resources/spaces/examples/python/spaces_key_get.yml b/specification/resources/spaces/examples/python/spaces_key_get.yml new file mode 100644 index 000000000..b82549e87 --- /dev/null +++ b/specification/resources/spaces/examples/python/spaces_key_get.yml @@ -0,0 +1,8 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + resp = client.spaces_key.get("DOACCESSKEYEXAMPLE") \ No newline at end of file diff --git a/specification/resources/spaces/examples/python/spaces_key_list.yml b/specification/resources/spaces/examples/python/spaces_key_list.yml new file mode 100644 index 000000000..4698fbaa0 --- /dev/null +++ b/specification/resources/spaces/examples/python/spaces_key_list.yml @@ -0,0 +1,8 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + resp = client.spaces_key.list() \ No newline at end of file diff --git a/specification/resources/spaces/examples/python/spaces_key_patch.yml b/specification/resources/spaces/examples/python/spaces_key_patch.yml new file mode 100644 index 000000000..ae6f5789e --- /dev/null +++ b/specification/resources/spaces/examples/python/spaces_key_patch.yml @@ -0,0 +1,12 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + req = { + "name": "new-key-name", + } + + resp = client.spaces_key.update("DOACCESSKEYEXAMPLE", body=req) diff --git a/specification/resources/spaces/examples/python/spaces_key_update.yml b/specification/resources/spaces/examples/python/spaces_key_update.yml new file mode 100644 index 000000000..ae6f5789e --- /dev/null +++ b/specification/resources/spaces/examples/python/spaces_key_update.yml @@ -0,0 +1,12 @@ +lang: Python +source: |- + import os + from pydo import Client + + client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) + + req = { + "name": "new-key-name", + } + + resp = client.spaces_key.update("DOACCESSKEYEXAMPLE", body=req) diff --git a/specification/resources/spaces/key_create.yml b/specification/resources/spaces/key_create.yml index e3ffb27bc..45f16f45d 100644 --- a/specification/resources/spaces/key_create.yml +++ b/specification/resources/spaces/key_create.yml @@ -69,6 +69,8 @@ responses: x-codeSamples: - $ref: "examples/curl/spaces_key_create.yml" + - $ref: "examples/go/spaces_key_create.yml" + - $ref: "examples/python/spaces_key_create.yml" security: - bearer_auth: diff --git a/specification/resources/spaces/key_delete.yml b/specification/resources/spaces/key_delete.yml index e4ca49f0a..c26b4c800 100644 --- a/specification/resources/spaces/key_delete.yml +++ b/specification/resources/spaces/key_delete.yml @@ -34,6 +34,8 @@ responses: x-codeSamples: - $ref: "examples/curl/spaces_key_delete.yml" + - $ref: "examples/go/spaces_key_delete.yml" + - $ref: "examples/python/spaces_key_delete.yml" security: - bearer_auth: diff --git a/specification/resources/spaces/key_get.yml b/specification/resources/spaces/key_get.yml index c64344b20..7e45ed8cb 100644 --- a/specification/resources/spaces/key_get.yml +++ b/specification/resources/spaces/key_get.yml @@ -34,6 +34,8 @@ responses: x-codeSamples: - $ref: "examples/curl/spaces_key_get.yml" + - $ref: "examples/go/spaces_key_get.yml" + - $ref: "examples/python/spaces_key_get.yml" security: - bearer_auth: diff --git a/specification/resources/spaces/key_list.yml b/specification/resources/spaces/key_list.yml index d78b512d2..d3e53b503 100644 --- a/specification/resources/spaces/key_list.yml +++ b/specification/resources/spaces/key_list.yml @@ -35,6 +35,8 @@ responses: x-codeSamples: - $ref: "examples/curl/spaces_key_list.yml" + - $ref: "examples/go/spaces_key_list.yml" + - $ref: "examples/python/spaces_key_list.yml" security: - bearer_auth: diff --git a/specification/resources/spaces/key_patch.yml b/specification/resources/spaces/key_patch.yml index eb9b83f24..fac16b60a 100644 --- a/specification/resources/spaces/key_patch.yml +++ b/specification/resources/spaces/key_patch.yml @@ -49,6 +49,8 @@ responses: x-codeSamples: - $ref: "examples/curl/spaces_key_patch.yml" + - $ref: "examples/go/space_key_patch.yml" + - $ref: "examples/python/spaces_key_patch.yml" security: - bearer_auth: diff --git a/specification/resources/spaces/key_update.yml b/specification/resources/spaces/key_update.yml index 3280e0ca8..ed6431403 100644 --- a/specification/resources/spaces/key_update.yml +++ b/specification/resources/spaces/key_update.yml @@ -49,6 +49,8 @@ responses: x-codeSamples: - $ref: "examples/curl/spaces_key_update.yml" + - $ref: "examples/go/spaces_key_update.yml" + - $ref: "examples/python/spaces_key_update.yml" security: - bearer_auth: