https://github.com/ndejong/digitalocean-api-query
Command line tool for easily making API calls to Digital Ocean to inspect the state of components
https://github.com/ndejong/digitalocean-api-query
devops digitalocean
Last synced: 12 months ago
JSON representation
Command line tool for easily making API calls to Digital Ocean to inspect the state of components
- Host: GitHub
- URL: https://github.com/ndejong/digitalocean-api-query
- Owner: ndejong
- License: apache-2.0
- Created: 2018-03-14T02:56:20.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-25T02:42:57.000Z (about 4 years ago)
- Last Synced: 2025-02-10T06:14:12.458Z (about 1 year ago)
- Topics: devops, digitalocean
- Language: Shell
- Size: 8.79 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# digitalocean-api-query
An all-bash (+ curl) command line tool for easily making API calls to Digital
Ocean to inspect the state of components.
Supports the following Digital Ocean (v2) API calls for query
* [account](https://developers.digitalocean.com/documentation/v2/#account)
* [account/keys](https://developers.digitalocean.com/documentation/v2/#ssh-keys)
* [actions](https://developers.digitalocean.com/documentation/v2/#actions)
* [certificates](https://developers.digitalocean.com/documentation/v2/#certificates)
* [domains](https://developers.digitalocean.com/documentation/v2/#domains)
* [droplets](https://developers.digitalocean.com/documentation/v2/#droplets)
* [firewalls](https://developers.digitalocean.com/documentation/v2/#firewalls)
* [floating_ips](https://developers.digitalocean.com/documentation/v2/#floating-ips)
* [images](https://developers.digitalocean.com/documentation/v2/#images)
* [load_balancers](https://developers.digitalocean.com/documentation/v2/#load-balancers)
* [regions](https://developers.digitalocean.com/documentation/v2/#regions)
* [sizes](https://developers.digitalocean.com/documentation/v2/#sizes)
* [tags](https://developers.digitalocean.com/documentation/v2/#tags)
* [volumes](https://developers.digitalocean.com/documentation/v2/#block-storage)
## Set your environment variable before use
Set either `DO_TOKEN` or `TF_VAR_do_token` to your Digital Ocean API key value
before using `digitalocean-api-query` since requests all require authentication.
The `TF_VAR_do_token` environment variable is designed to be handy if you are
also using Terraform among your toolset.
For example:
```bash
$ export DO_TOKEN=122e68eac3d39a245df747f2d2a2c9c5f4c97c84e3f1463c625492cce1e622cd
```
## Example requests
obtain droplet data using 'jq' to pretty-print the response data
```bash
$ digitalocean-api-query droplets | jq .
```
obtain a list of droplet.id using 'jq' to filter the response data
```bash
$ digitalocean-api-query droplets | jq .droplets[].id
```
obtain a list of volume.id slugs using 'jq' to filter the response data
```bash
$ digitalocean-api-query volumes | jq .volumes[].id
```
obtain a list of region slugs using 'jq' to filter the response data
```bash
$ digitalocean-api-query regions | jq .regions[].slug
```
## Install
digitalocean-api-query is a straight-forward bash script so you can simply
download directly and place somewhere useful to you - the sha256sum value is
available to confirm integrity, use it.
## Authors
This code is managed by [Verb Networks](https://github.com/verbnetworks).
## License
Apache 2 Licensed. See LICENSE file for full details.