terraform-provider-greenhost/vendor/github.com/digitalocean/godo
Andrew Starr-Bochicchio 99f86f4aaa
Add support for App Platform (#497)
* Bump godo version.

* Initial support for app service spec.

* Update godo

* Add support for static sites.

* Refactor to share appSpecComponentBase

* Add support for workers.

* Fix expandAppDomainSpec

* Add database support.

* Add first set of acceptance tests.

* Add test excercising envs.

* Add worker test.

* Add import test.

* Add sweeper.

* Add App data source.

* Add documentation for the resource.

* Add data source docs.

* Update health_check attributes.

* Use basic plan in acceptance tests.

* Test upgrading an app from basic to professional.

* Update waitForAppDeployment method.

* Fix env docs.

* Update digitalocean/datasource_digitalocean_app_test.go

Co-authored-by: Cesar Garza <scotch.neat@live.com>

* Simplify expand methods.

* Fix typo in sweeper log message.

Co-authored-by: Cesar Garza <scotch.neat@live.com>
2020-10-13 10:16:53 -04:00
..
.gitignore deps: use go modules for dep mgmt 2019-03-01 15:53:10 -05:00
.whitesource kubernetes - add support for surge upgrades (#465) 2020-07-21 14:20:20 -04:00
1-click.go kubernetes - add support for surge upgrades (#465) 2020-07-21 14:20:20 -04:00
CHANGELOG.md Add support for App Platform (#497) 2020-10-13 10:16:53 -04:00
CONTRIBUTING.md kubernetes - add support for surge upgrades (#465) 2020-07-21 14:20:20 -04:00
LICENSE.txt Transfer of provider code 2017-06-09 16:36:22 +00:00
README.md kubernetes - add support for surge upgrades (#465) 2020-07-21 14:20:20 -04:00
account.go Updated the godo SDK to version v1.4.2 in order to enable setting a dns' record weight to 0 2018-08-31 01:45:30 +01:00
action.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
apps.gen.go Add support for App Platform (#497) 2020-10-13 10:16:53 -04:00
apps.go Add support for App Platform (#497) 2020-10-13 10:16:53 -04:00
balance.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
billing_history.go Add support for VPC. (#410) 2020-04-13 18:09:44 -04:00
cdn.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
certificates.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
databases.go Add support for MySQL user authentication management (#393) 2020-03-17 16:44:25 -04:00
doc.go Add support for volume snapshot tags (#339) 2019-12-05 13:41:23 -05:00
domains.go Allow for SRV records with port 0. Fixes: #475 (#476) 2020-08-07 15:31:41 -04:00
droplet_actions.go Add support for filesystem_type parameter for volume resource 2018-07-04 00:11:42 +02:00
droplets.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
errors.go Transfer of provider code 2017-06-09 16:36:22 +00:00
firewalls.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
floating_ips.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
floating_ips_actions.go Add support for filesystem_type parameter for volume resource 2018-07-04 00:11:42 +02:00
go.mod adding Container Registry support (#383) 2020-06-03 16:30:15 -05:00
go.sum kubernetes - add support for surge upgrades (#465) 2020-07-21 14:20:20 -04:00
godo.go Add support for App Platform (#497) 2020-10-13 10:16:53 -04:00
image_actions.go Add support for filesystem_type parameter for volume resource 2018-07-04 00:11:42 +02:00
images.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
invoices.go Allow for SRV records with port 0. Fixes: #475 (#476) 2020-08-07 15:31:41 -04:00
keys.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
kubernetes.go Add support for App Platform (#497) 2020-10-13 10:16:53 -04:00
links.go Add support for volume snapshot tags (#339) 2019-12-05 13:41:23 -05:00
load_balancers.go Add support for VPC. (#410) 2020-04-13 18:09:44 -04:00
meta.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
projects.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
regions.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
registry.go kubernetes - add support for surge upgrades (#465) 2020-07-21 14:20:20 -04:00
sizes.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
snapshots.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
storage.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
storage_actions.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
strings.go Updated dependency for go SDK to 1.7.0, started to define Kuberenetes resource 2018-11-16 05:03:23 +08:00
tags.go support updating db cluster tags (#353) 2019-12-22 17:44:20 -05:00
timestamp.go Transfer of provider code 2017-06-09 16:36:22 +00:00
vpcs.go Add support for VPC. (#410) 2020-04-13 18:09:44 -04:00

README.md

Godo

Build Status GoDoc

Godo is a Go client library for accessing the DigitalOcean V2 API.

You can view the client API docs here: http://godoc.org/github.com/digitalocean/godo

You can view DigitalOcean API docs here: https://developers.digitalocean.com/documentation/v2/

Install

go get github.com/digitalocean/godo@vX.Y.Z

where X.Y.Z is the version you need.

or

go get github.com/digitalocean/godo

for non Go modules usage or latest version.

Usage

import "github.com/digitalocean/godo"

Create a new DigitalOcean client, then use the exposed services to access different parts of the DigitalOcean API.

Authentication

Currently, Personal Access Token (PAT) is the only method of authenticating with the API. You can manage your tokens at the DigitalOcean Control Panel Applications Page.

You can then use your token to create a new client:

package main

import (
    "github.com/digitalocean/godo"
)

func main() {
    client := godo.NewFromToken("my-digitalocean-api-token")
}

If you need to provide a context.Context to your new client, you should use godo.NewClient to manually construct a client instead.

Examples

To create a new Droplet:

dropletName := "super-cool-droplet"

createRequest := &godo.DropletCreateRequest{
    Name:   dropletName,
    Region: "nyc3",
    Size:   "s-1vcpu-1gb",
    Image: godo.DropletCreateImage{
        Slug: "ubuntu-14-04-x64",
    },
}

ctx := context.TODO()

newDroplet, _, err := client.Droplets.Create(ctx, createRequest)

if err != nil {
    fmt.Printf("Something bad happened: %s\n\n", err)
    return err
}

Pagination

If a list of items is paginated by the API, you must request pages individually. For example, to fetch all Droplets:

func DropletList(ctx context.Context, client *godo.Client) ([]godo.Droplet, error) {
    // create a list to hold our droplets
    list := []godo.Droplet{}

    // create options. initially, these will be blank
    opt := &godo.ListOptions{}
    for {
        droplets, resp, err := client.Droplets.List(ctx, opt)
        if err != nil {
            return nil, err
        }

        // append the current page's droplets to our list
        list = append(list, droplets...)

        // if we are at the last page, break out the for loop
        if resp.Links == nil || resp.Links.IsLastPage() {
            break
        }

        page, err := resp.Links.CurrentPage()
        if err != nil {
            return nil, err
        }

        // set the page we want for the next request
        opt.Page = page + 1
    }

    return list, nil
}

Versioning

Each version of the client is tagged and the version is updated accordingly.

To see the list of past versions, run git tag.

Documentation

For a comprehensive list of examples, check out the API documentation.

For details on all the functionality in this library, see the GoDoc documentation.

Contributing

We love pull requests! Please see the contribution guidelines.