/usr/share/gocode/src/github.com/digitalocean/godo/util/droplet_test.go is in golang-github-digitalocean-godo-dev 1.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package util
import (
"golang.org/x/oauth2"
"github.com/digitalocean/godo"
"github.com/digitalocean/godo/context"
)
func ExampleWaitForActive() {
// build client
pat := "mytoken"
token := &oauth2.Token{AccessToken: pat}
t := oauth2.StaticTokenSource(token)
ctx := context.TODO()
oauthClient := oauth2.NewClient(ctx, t)
client := godo.NewClient(oauthClient)
// create your droplet and retrieve the create action uri
uri := "https://api.digitalocean.com/v2/actions/xxxxxxxx"
// block until until the action is complete
err := WaitForActive(ctx, client, uri)
if err != nil {
panic(err)
}
}
|