\apex\digitaloceandoapi

Summary

Methods
Properties
Constants
__construct()
add_api_key()
get_sizes()
get_regions()
add_droplet()
add_droplet_to_database()
get_droplets()
delete_droplet()
droplet_action()
resize_droplet()
rebuild_droplet()
rename_droplet()
create_cluster()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
format_droplet()
get_api_key()
send_request()
No private properties found
N/A

Methods

__construct()

__construct(string  $api_key = '')

Construct

Parameters

string $api_key

The API key to use, if one is needed

add_api_key()

add_api_key(): boolean

Add a API key from the POSTed information

Returns

boolean —

Whether or not the operation was successful

get_sizes()

get_sizes()

Get slug sizes available

get_regions()

get_regions()

Get regions

add_droplet()

add_droplet(string  $client_id,string  $cluster_id,string  $server_type,array  $request): string

add a new droplet

Parameters

string $client_id

The 'id' column from the 'digitalocean_api_keys' table of which client the droplet is being added to.

string $cluster_id

The ID# of the cluster to add droplet to.

string $server_type

The type of server being added from the digitalocean:server_types hash.

array $request

The request to send to DigitalOcean API

Returns

string —

The IP address of the new droplet

add_droplet_to_database()

add_droplet_to_database(string  $client_id,string  $cluster_id,string  $server_type,array  $vars)

Add droplet to database

Parameters

string $client_id

The ID# of the client.

string $cluster_id

The ID# of the cluster to add droplet to.

string $server_type

The server type of the droplet.

array $vars

Details on the droplet.

get_droplets()

get_droplets()

Get a list of all droplets

delete_droplet()

delete_droplet(string  $droplet_id)

Delete a droplet

Parameters

string $droplet_id

The ID# of the droplet to delete.

droplet_action()

droplet_action(string  $droplet_id,string  $action)

( {erfpr, am actopm agaomst a drp[;et

Parameters

string $droplet_id

The ID# of the droplet

string $action

The action to perform (reboot, shutdown, power_cycle, etc).

resize_droplet()

resize_droplet(string  $droplet_id,string  $size)

Resize droplet

Parameters

string $droplet_id

The droplet ID to resize.

string $size

The size slug to resize the droplet to.

rebuild_droplet()

rebuild_droplet(string  $droplet_id)

Rebuild droplet

Parameters

string $droplet_id

The droplet ID to rebuild.

rename_droplet()

rename_droplet(string  $droplet_id,string  $name)

Rename a droplet

Parameters

string $droplet_id

The droplet ID to rename

string $name

The new name of the droplet

create_cluster()

create_cluster()

( Create mew c;ister frp, {PSTed data

format_droplet()

format_droplet(array  $row)

Format a droplet array of variables

Parameters

array $row

The array from the /dropets URI given by the DigitalOcean API.

get_api_key()

get_api_key()

Get API key if needed

send_request()

send_request(  $uri,  $method = 'GET',  $request = array()): string

Send request

Parameters

$uri

string The URI of the DigitalOcean API to send the request to.

$method

string The HTTP method to send the request in (GET, POST, DELETE, HEAD, etc.).

$request

array Optional array of data to send to DO

Returns

string —

The response from the DO API.