{"id":13571253,"url":"https://github.com/digitalocean/godo","last_synced_at":"2026-02-09T13:07:01.522Z","repository":{"id":20347859,"uuid":"23622727","full_name":"digitalocean/godo","owner":"digitalocean","description":"DigitalOcean Go API client","archived":false,"fork":false,"pushed_at":"2025-06-09T18:01:46.000Z","size":9231,"stargazers_count":1476,"open_issues_count":15,"forks_count":324,"subscribers_count":101,"default_branch":"main","last_synced_at":"2025-06-09T19:19:44.405Z","etag":null,"topics":["api","digitalocean","go","golang","hacktoberfest"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/digitalocean/godo","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"secdev/scapy","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalocean.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-09-03T14:07:36.000Z","updated_at":"2025-06-04T13:23:36.000Z","dependencies_parsed_at":"2023-02-13T01:31:09.221Z","dependency_job_id":"9a5f523c-514a-4c35-85ae-9f063b771110","html_url":"https://github.com/digitalocean/godo","commit_stats":{"total_commits":633,"total_committers":174,"mean_commits":"3.6379310344827585","dds":0.8688783570300158,"last_synced_commit":"65b6447f287e8e14e73162f551ef97225a661c36"},"previous_names":["digitaloceancloud/godo"],"tags_count":190,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fgodo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fgodo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fgodo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fgodo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalocean","download_url":"https://codeload.github.com/digitalocean/godo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fgodo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259178519,"owners_count":22817388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","digitalocean","go","golang","hacktoberfest"],"created_at":"2024-08-01T14:01:00.238Z","updated_at":"2026-01-16T06:54:59.897Z","avatar_url":"https://github.com/digitalocean.png","language":"Go","funding_links":[],"categories":["Go","Repositories"],"sub_categories":[],"readme":"# Godo\n\n[![GitHub Actions CI](https://github.com/digitalocean/godo/actions/workflows/ci.yml/badge.svg)](https://github.com/digitalocean/godo/actions/workflows/ci.yml)\n[![GoDoc](https://godoc.org/github.com/digitalocean/godo?status.svg)](https://godoc.org/github.com/digitalocean/godo)\n\nGodo is a Go client library for accessing the DigitalOcean V2 API.\n\nYou can view the client API docs here: [http://godoc.org/github.com/digitalocean/godo](http://godoc.org/github.com/digitalocean/godo)\n\nYou can view DigitalOcean API docs here: [https://docs.digitalocean.com/reference/api/api-reference/](https://docs.digitalocean.com/reference/api/api-reference/)\n\n## Install\n```sh\ngo get github.com/digitalocean/godo@vX.Y.Z\n```\n\nwhere X.Y.Z is the [version](https://github.com/digitalocean/godo/releases) you need.\n\nor\n```sh\ngo get github.com/digitalocean/godo\n```\nfor non Go modules usage or latest version.\n\n## Usage\n\n```go\nimport \"github.com/digitalocean/godo\"\n```\n\nCreate a new DigitalOcean client, then use the exposed services to\naccess different parts of the DigitalOcean API.\n\n### Authentication\n\nCurrently, Personal Access Token (PAT) is the only method of\nauthenticating with the API. You can manage your tokens\nat the DigitalOcean Control Panel [Applications Page](https://cloud.digitalocean.com/settings/applications).\n\nYou can then use your token to create a new client:\n\n```go\npackage main\n\nimport (\n    \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n    client := godo.NewFromToken(\"my-digitalocean-api-token\")\n}\n```\n\nIf you need to provide a `context.Context` to your new client, you should use [`godo.NewClient`](https://godoc.org/github.com/digitalocean/godo#NewClient) to manually construct a client instead.\n\n## Examples\n\n\nTo create a new Droplet:\n\n```go\ndropletName := \"super-cool-droplet\"\n\ncreateRequest := \u0026godo.DropletCreateRequest{\n    Name:   dropletName,\n    Region: \"nyc3\",\n    Size:   \"s-1vcpu-1gb\",\n    Image: godo.DropletCreateImage{\n        Slug: \"ubuntu-20-04-x64\",\n    },\n}\n\nctx := context.TODO()\n\nnewDroplet, _, err := client.Droplets.Create(ctx, createRequest)\n\nif err != nil {\n    fmt.Printf(\"Something bad happened: %s\\n\\n\", err)\n    return err\n}\n```\n\n### Pagination\n\nIf a list of items is paginated by the API, you must request pages individually. For example, to fetch all Droplets:\n\n```go\nfunc DropletList(ctx context.Context, client *godo.Client) ([]godo.Droplet, error) {\n    // create a list to hold our droplets\n    list := []godo.Droplet{}\n\n    // create options. initially, these will be blank\n    opt := \u0026godo.ListOptions{}\n    for {\n        droplets, resp, err := client.Droplets.List(ctx, opt)\n        if err != nil {\n            return nil, err\n        }\n\n        // append the current page's droplets to our list\n        list = append(list, droplets...)\n\n        // if we are at the last page, break out the for loop\n        if resp.Links == nil || resp.Links.IsLastPage() {\n            break\n        }\n\n        page, err := resp.Links.CurrentPage()\n        if err != nil {\n            return nil, err\n        }\n\n        // set the page we want for the next request\n        opt.Page = page + 1\n    }\n\n    return list, nil\n}\n```\n\nSome endpoints offer token based pagination. For example, to fetch all Registry Repositories:\n\n```go\nfunc ListRepositoriesV2(ctx context.Context, client *godo.Client, registryName string) ([]*godo.RepositoryV2, error) {\n    // create a list to hold our registries\n    list := []*godo.RepositoryV2{}\n\n    // create options. initially, these will be blank\n    opt := \u0026godo.TokenListOptions{}\n    for {\n        repositories, resp, err := client.Registry.ListRepositoriesV2(ctx, registryName, opt)\n        if err != nil {\n            return nil, err\n        }\n\n        // append the current page's registries to our list\n        list = append(list, repositories...)\n\n        // if we are at the last page, break out the for loop\n        if resp.Links == nil || resp.Links.IsLastPage() {\n            break\n        }\n\n        // grab the next page token\n        nextPageToken, err := resp.Links.NextPageToken()\n        if err != nil {\n            return nil, err\n        }\n\n        // provide the next page token for the next request\n        opt.Token = nextPageToken\n    }\n\n    return list, nil\n}\n```\n\n### Automatic Retries and Exponential Backoff\n\nThe Godo client can be configured to use automatic retries and exponentional backoff for requests that fail with 429 or 500-level response codes via [go-retryablehttp](https://github.com/hashicorp/go-retryablehttp). To configure Godo to enable usage of go-retryablehttp, the `RetryConfig.RetryMax` must be set.\n\n```go\ntokenSrc := oauth2.StaticTokenSource(\u0026oauth2.Token{\n    AccessToken: \"dop_v1_xxxxxx\",\n})\n\noauth_client := oauth2.NewClient(oauth2.NoContext, tokenSrc)\n\nwaitMax := godo.PtrTo(6.0)\nwaitMin := godo.PtrTo(3.0)\n\nretryConfig := godo.RetryConfig{\n    RetryMax:     3,\n    RetryWaitMin: waitMin,\n    RetryWaitMax: waitMax,\n}\n\nclient, err := godo.New(oauth_client, godo.WithRetryAndBackoffs(retryConfig))\n```\n\nPlease refer to the [RetryConfig Godo documentation](https://pkg.go.dev/github.com/digitalocean/godo#RetryConfig) for more information.\n\n## Versioning\n\nEach version of the client is tagged and the version is updated accordingly.\n\nTo see the list of past versions, run `git tag`.\n\n\n## Documentation\n\nFor a comprehensive list of examples, check out the [API documentation](https://docs.digitalocean.com/reference/api/api-reference/#tag/SSH-Keys).\n\nFor details on all the functionality in this library, see the [GoDoc](http://godoc.org/github.com/digitalocean/godo) documentation.\n\n\n## Contributing\n\nWe love pull requests! Please see the [contribution guidelines](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fgodo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalocean%2Fgodo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fgodo/lists"}