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.
Summary↑
account!() | Like |
account() | Requests information about the registered account |
action!(id) | Like |
action(id) | Requests a particular action record by id |
actions!(per_page \\ 25) | Like |
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(name) | Request a domain by name |
domains!() | Like |
domains() | Request a list of domains |
droplet!(id) | Like |
droplet(id) | Requests a particular droplet object by id |
droplet_neighbors!() | Like |
droplet_neighbors!(id) | Like |
droplet_neighbors() | Requests all droplet neighbors |
droplet_neighbors(id) | Requests neighbors for the supplied droplet ID |
droplets!() | Like |
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(id) | Return an image by id |
images!(type \\ nil) | Like |
images(type \\ nil) | Lists available images |
key!(id) | Like |
key(id) | Requests a specific key (by id or fingerprint) |
keys!() | Like |
keys() | Requests a list of keys associated with the account |
page!(url) | Like |
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() | Requests a list of regions |
response(arg1) | Parse the result body out of an HTTPoison response tuple |
sizes!() | Like |
sizes() | Requests a list of droplet sizes |
wait_time() | The time (in ms) to wait when polling for actions to complete |
Functions
Requests information about the registered account.
Like account/0
but returns response body only.
Requests a particular action record by id.
Like action/1
but returns response body only.
Requests a list of actions, i.e., records of events.
Like actions/1
but returns response body only.
The API token as a string.
The token is the value associated with the environment variable
DIGOC_API2_TOKEN
.
Make a bang-name from the supplied atom.
Examples
iex> DigOc.bang(:next)
:next!
Request a domain by name.
Like domain/1
but returns the response body only.
Request a list of domains.
Like domains/0
but returns the response body only.
Requests a particular droplet object by id.
Like droplet/1
but returns response body only.
Requests all droplet neighbors.
Requests neighbors for the supplied droplet ID.
Like droplet_neighbors/0
but returns response body only.
Like droplet_neighbors/1
but returns response body only.
Requests a list of all droplets.
Like droplets/0
but returns response body only.
The endpoint URL as a string.
Examples
iex> DigOc.endpoint
"https://api.digitalocean.com/v2/"
The name of the event manager.
Examples
iex> DigOc.event_manager
DigOc.EM
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"
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
Return an image by id.
Like image/1
but returns response body only.
Lists available images.
Type may be :application, :distribution, or :private.
Like images/1
but returns response body only.
Requests a specific key (by id or fingerprint).
Like key/1
but returns only the response body.
Requests a list of keys associated with the account.
Like keys/0
but returns only the response body.
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.
Like page/1
but only return the response body.
Make a predicate name from the supplied atom.
Examples
iex> DigOc.predicate(:next)
:next?
Requests a list of regions.
Like regions/0
but only returns the response body.
Parse the result body out of an HTTPoison response tuple.
Examples
iex> res = {:ok, %{ body: "contents" }, %{ result: 200 } }
iex> DigOc.response(res)
%{ body: "contents" }
Requests a list of droplet sizes.
Like sizes/0
but only returns the response body.
The time (in ms) to wait when polling for actions to complete.
Examples
iex> DigOc.wait_time
5000