-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[droplets/backup-policy]: include go and py examples for droplet back…
…up policy get, list and list supported (#950)
- Loading branch information
Showing
9 changed files
with
123 additions
and
42 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
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
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
17 changes: 17 additions & 0 deletions
17
specification/resources/droplets/examples/go/droplets_get_backup_policy.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() | ||
droplet, _, err := client.Droplets.GetBackupPolicy(ctx, 444909706) | ||
} |
17 changes: 17 additions & 0 deletions
17
specification/resources/droplets/examples/go/droplets_list_backup_policies.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() | ||
droplet, _, err := client.Droplets.ListBackupPolicies(ctx) | ||
} |
17 changes: 17 additions & 0 deletions
17
specification/resources/droplets/examples/go/droplets_list_supported_backup_policies.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() | ||
droplet, _, err := client.Droplets.ListSupportedBackupPolicies(ctx) | ||
} |
8 changes: 8 additions & 0 deletions
8
specification/resources/droplets/examples/python/droplets_get_backup_policy.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.droplets.get_backup_policy(droplet_id=444909706) |
8 changes: 8 additions & 0 deletions
8
specification/resources/droplets/examples/python/droplets_list_backup_policies.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.droplets.list_backup_policies() |
8 changes: 8 additions & 0 deletions
8
specification/resources/droplets/examples/python/droplets_list_supported_backup_policies.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.droplets.list_supported_backup_policies() |