Module Equinoxe_hlc.Device

This module manages API parts related to devices.

type id

Unique identifier for the Equinix API.

val id_of_string : string -> id

id_of_string str creates a unique identifier from str.

type action =
| Power_on
| Power_off
| Reboot
| Reinstall
| Rescue

Actions executable with a device.

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.

type plan =
| C3_small_x86
| C3_medium_x86

Server type when deploying a new device.

val plan_to_string : plan -> string

plan_to_string plan converts a plan into a string understandable by the API.

type builder

This type represents the configuration wanted for a device.

val build : ?hostname:string -> ?tags:string list -> plan:plan -> os:os -> location:location -> unit -> builder
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.

val get_from : t -> id:id -> config io

get_from t t ~id returns a config that contains information about the device specified by id.

val get_events_from : t -> id:id -> Event.t list io

get_events_from t ~id retrieves information about the device events.

val execute_action_on : t -> id:id -> action:action -> unit io

execute_action_on t ~id ~action executes an action on the device specified by its id.

val delete : t -> id:id -> ?force:bool -> unit -> unit io

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.

val is_available : t -> builder -> bool io

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.

val update : t -> id:id -> ?hostname:string -> ?tags:string list -> unit -> config io

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.