DigOc

This is an Elixir client for the Digital Ocean API, verion 2. Details about the API can be found on Digital Ocean’s documentation site.

Source

Summary

account!()

Like account/0 but returns response body only

account()

Requests information about the registered account

action!(id)

Like action/1 but returns response body only

action(id)

Requests a particular action record by id

actions!(per_page \\ 25)

Like actions/1 but returns response body only

actions(per_page \\ 25)

Requests a list of actions, i.e., records of events

api_token()

The API token as a string

bang(atom)

Make a bang-name from the supplied atom

domain!(name)

Like domain/1 but returns the response body only

domain(name)

Request a domain by name

domains!()

Like domains/0 but returns the response body only

domains()

Request a list of domains

droplet!(id)

Like droplet/1 but returns response body only

droplet(id)

Requests a particular droplet object by id

droplet_neighbors!()

Like droplet_neighbors/0 but returns response body only

droplet_neighbors!(id)

Like droplet_neighbors/1 but returns response body only

droplet_neighbors()

Requests all droplet neighbors

droplet_neighbors(id)

Requests neighbors for the supplied droplet ID

droplets!()

Like droplets/0 but returns response body only

droplets()

Requests a list of all droplets

endpoint()

The endpoint URL as a string

event_manager()

The name of the event manager

feature_from_result(res, f)

Given a result or result body and a droplet map key, return the value associated with that key

id_from_result(res)

Given a result or a result body, return the droplet ID

image!(id)

Like image/1 but returns response body only

image(id)

Return an image by id

images!(type \\ nil)

Like images/1 but returns response body only

images(type \\ nil)

Lists available images

key!(id)

Like key/1 but returns only the response body

key(id)

Requests a specific key (by id or fingerprint)

keys!()

Like keys/0 but returns only the response body

keys()

Requests a list of keys associated with the account

page!(url)

Like page/1 but only return the response body

page(url)

Request a page from Digital Ocean. Most likely used to retrieve pages that are specified somewhere in the :links key (like the next or previous page of results

predicate(atom)

Make a predicate name from the supplied atom

regions!()

Like regions/0 but only returns the response body

regions()

Requests a list of regions

response(arg1)

Parse the result body out of an HTTPoison response tuple

sizes!()

Like sizes/0 but only returns the response body

sizes()

Requests a list of droplet sizes

wait_time()

The time (in ms) to wait when polling for actions to complete

Functions

account()

Requests information about the registered account.

Source
account!()

Like account/0 but returns response body only.

Source
action(id)

Requests a particular action record by id.

Source
action!(id)

Like action/1 but returns response body only.

Source
actions(per_page \\ 25)

Requests a list of actions, i.e., records of events.

Documentation.

Source
actions!(per_page \\ 25)

Like actions/1 but returns response body only.

Source
api_token()

The API token as a string.

The token is the value associated with the environment variable DIGOC_API2_TOKEN.

Source
bang(atom)

Make a bang-name from the supplied atom.

Examples

iex> DigOc.bang(:next)
:next!
Source
domain(name)

Request a domain by name.

Source
domain!(name)

Like domain/1 but returns the response body only.

Source
domains()

Request a list of domains.

Source
domains!()

Like domains/0 but returns the response body only.

Source
droplet(id)

Requests a particular droplet object by id.

Source
droplet!(id)

Like droplet/1 but returns response body only.

Source
droplet_neighbors()

Requests all droplet neighbors.

Source
droplet_neighbors(id)

Requests neighbors for the supplied droplet ID.

Source
droplet_neighbors!()

Like droplet_neighbors/0 but returns response body only.

Source
droplet_neighbors!(id)

Like droplet_neighbors/1 but returns response body only.

Source
droplets()

Requests a list of all droplets.

Source
droplets!()

Like droplets/0 but returns response body only.

Source
endpoint()

The endpoint URL as a string.

Examples

iex> DigOc.endpoint
"https://api.digitalocean.com/v2/"
Source
event_manager()

The name of the event manager.

Examples

iex> DigOc.event_manager
DigOc.EM
Source
feature_from_result(res, f)

Given a result or result body and a droplet map key, return the value associated with that key.

Examples

iex> res = {:ok, %{ droplet: %{ id: 123, name: "example" } }, %{}}
iex> DigOc.feature_from_result(res, :id)
123
iex> DigOc.feature_from_result(DigOc.response(res), :name)
"example"
Source
id_from_result(res)

Given a result or a result body, return the droplet ID.

Examples

iex> res = {:ok, %{ droplet: %{ id: 123, name: "example" } }, %{}}
iex> DigOc.id_from_result(res)
123
Source
image(id)

Return an image by id.

Source
image!(id)

Like image/1 but returns response body only.

Source
images(type \\ nil)

Lists available images.

Type may be :application, :distribution, or :private.

Source
images!(type \\ nil)

Like images/1 but returns response body only.

Source
key(id)

Requests a specific key (by id or fingerprint).

Source
key!(id)

Like key/1 but returns only the response body.

Source
keys()

Requests a list of keys associated with the account.

Source
keys!()

Like keys/0 but returns only the response body.

Source
page(url)

Request a page from Digital Ocean. Most likely used to retrieve pages that are specified somewhere in the :links key (like the next or previous page of results.

Source
page!(url)

Like page/1 but only return the response body.

Source
predicate(atom)

Make a predicate name from the supplied atom.

Examples

iex> DigOc.predicate(:next)
:next?
Source
regions()

Requests a list of regions.

Source
regions!()

Like regions/0 but only returns the response body.

Source
response(arg1)

Parse the result body out of an HTTPoison response tuple.

Examples

iex> res = {:ok, %{ body: "contents" }, %{ result: 200 } }
iex> DigOc.response(res)
%{ body: "contents" }
Source
sizes()

Requests a list of droplet sizes.

Source
sizes!()

Like sizes/0 but only returns the response body.

Source
wait_time()

The time (in ms) to wait when polling for actions to complete.

Examples

iex> DigOc.wait_time
5000
Source