godo: github.com/digitalocean/godo/util Index | Examples | Files

package util

import "github.com/digitalocean/godo/util"

Index

Examples

Package Files

droplet.go

func WaitForActive Uses

func WaitForActive(ctx context.Context, client *godo.Client, monitorURI string) error

WaitForActive waits for a droplet to become active

Code:

// 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)
}

Package util imports 4 packages (graph) and is imported by 19 packages. Updated 2019-10-03. Refresh now. Tools for package owners.