Equinoxe_cohttp.Device
This module manages API parts related to devices.
val id_of_string : string -> id
id_of_string str
creates a unique identifier from str
.
val action_to_string : action -> string
action_of_string action
returns a readable action as a string.
type os =
| Debian_9 |
| Debian_10 |
| NixOs_21_05 |
| Ubuntu_18_04 |
| Ubuntu_20_04 |
| Ubuntu_21_04 |
| FreeBSD_11_2 |
| Centos_8 |
| Alpine_3 |
Os available when creating a new device.
val os_to_string : os -> string
os_to_string os
converts an os into a string understandable by the API.
type location =
| Washington |
| Dallas |
| Silicon_valley |
| Sao_paulo |
| Amsterdam |
| Frankfurt |
| Singapore |
| Sydney |
Locations available when deploying a new device.
val location_to_string : location -> string
location_to_string metro
converts a metro into a string understandable by the API.
val plan_to_string : plan -> string
plan_to_string plan
converts a plan into a string understandable by the API.
type config = {
id : id; |
hostname : string; |
location : location; |
plan : plan; |
os : os; |
state : State.t; |
tags : string list; |
user : string; |
created_at : Equinoxe__Equinoxe_intf.Date.t; |
ips : Ip.config list; |
}
This type represents the current configuration for the device. ips
can be empty.
val to_string : config -> string
to_string config
returns a readable string containing the config.
get_from t t ~id
returns a config
that contains information about the device specified by id
.
get_events_from t ~id
retrieves information about the device events.
execute_action_on t ~id ~action
executes an action on the device specified by its id.
delete t ~id ~force ()
deletes a device on Equinix and returns a json
with the result. ?force
defaults to false
, if true
then it forces the deletion of the device by detaching any storage volume still active.
is_available t builder
returns true if the device is available in the datacenter you specify. As it is asynchronous, it gives a hint about the situation but does not prevent from device starvation.
val create : t -> id:Project.id -> builder -> config io
create t ~id builder
creates a machine on the Equinix with the Devices
.builder specification.
val safe_create : t -> id:Project.id -> builder -> config option io
safe_create t ~id builder
creates a machine but uses is_available
to check if the data center can provide the machine. As a result, it calls the API twice. It returns the Some configuration
if it works. Otherwise it returns None
.
update t ~id ~hostname ~tags ()
updates the value of the device.
val get_all_from_project : t -> id:Project.id -> config list io
get_all_from_project t ~id
returns the config
list that contains all the devices related to the project id
.
val pp : config -> unit
pp config
prints a readable string representing the config.