Class: Digitalocean

Digitalocean

new Digitalocean(clientID, apiKey)

Digitalocean API Client.
Parameters:
Name Type Description
clientID string Your account's DigitalOcean Client Id
apiKey string Your account's DigitalOcean API Key
Author:
  • Matěj Šimek <email@matejsimek.cz> (www.matejsimek.cz)
Source:

Methods

<static> domainDestroy(id)

Destroy Domain. This method deletes the specified domain.
Parameters:
Name Type Description
id number | string Required, Integer or Domain Name (e.g. domain.com), specifies the domain to display.
Source:

<static> domainGet(id)

Domain Show. This method returns the specified domain.
Parameters:
Name Type Description
id number | string Required, Integer or Domain Name (e.g. domain.com), specifies the domain to display.
Source:

<static> domainGetAll()

All Domains. This method returns all of your current domains.
Source:

<static> domainNew(name, ipAddress)

New Domain. This method creates a new domain name with an A record for the specified [ip_address].
Parameters:
Name Type Description
name string Required, name of the domain.
ipAddress string Required, ip address for the domain's initial a record.
Source:

<static> domainRecordDestroy(id, recordId)

Destroy Domain Record. This method deletes the specified domain record.
Parameters:
Name Type Description
id number | string Required, Integer or Domain Name (e.g. domain.com), specifies the domain for which to destroy a record.
recordId number Required, specifies which record to destroy.
Source:

<static> domainRecordEdit(id, recordId, recordType, data, optionals)

Edit Domain Record. This method edits an existing domain record.
Parameters:
Name Type Description
id number | string Required, Integer or Domain Name (e.g. domain.com), specifies the domain to display.
recordId number Required, specifies the record to update.
recordType string Required, the type of record you would like to create. 'A', 'CNAME', 'NS', 'TXT', 'MX' or 'SRV'
data string Required, this is the value of the record
optionals Object { name, priority, port, weight }
- name is required for 'A', 'CNAME', 'TXT' and 'SRV' records
- priority is required for 'SRV' and 'MX' records
- port is required for 'SRV' records
- weight is required for 'SRV' records
Source:

<static> domainRecordGet(id, recordId)

Show Domain Record. This method returns the specified domain record.
Parameters:
Name Type Description
id number | string Required, Integer or Domain Name (e.g. domain.com), specifies the domain for which to retrieve a record.
recordId number Required, specifies the record_id to retrieve.
Source:

<static> domainRecordGetAll(id)

All Domain Records. This method returns all of your current domain records.
Parameters:
Name Type Description
id number | string Required, Integer or Domain Name (e.g. domain.com), specifies the domain to display.
Source:

<static> domainRecordNew(id, recordType, data, optionals)

New Domain Record. This method creates a new domain name with an A record for the specified [ip_address].
Parameters:
Name Type Description
id number | string Required, Integer or Domain Name (e.g. domain.com), specifies the domain to display.
recordType string Required, the type of record you would like to create. 'A', 'CNAME', 'NS', 'TXT', 'MX' or 'SRV'
data string Required, this is the value of the record
optionals Object { name, priority, port, weight }
- name is required for 'A', 'CNAME', 'TXT' and 'SRV' records
- priority is required for 'SRV' and 'MX' records
- port is required for 'SRV' records
- weight is required for 'SRV' records
Source:

<static> dropletDestroy(id)

Destroy Droplet. This method destroys one of your droplets - this is irreversible.
Parameters:
Name Type Description
id number Required, this is the id of the droplet you want to destroy
Source:

<static> dropletGet(id)

Show Droplet. This method returns full information for a specific droplet ID that is passed in the URL.
Parameters:
Name Type Description
id number Required, this is the id of your droplet
Source:

<static> dropletGetAll()

Show All Active Droplets. This method returns all active droplets that are currently running in your account. All available API information is presented for each droplet.
Source:

<static> dropletNew(name, sizeId, imageId, regionId, optionals)

New Droplet. This method allows you to create a new droplet. See the required parameters section below for an explanation of the variables that are needed to create a new droplet.
Parameters:
Name Type Description
name string Required, this is the name of the droplet - must be formatted by hostname rules
sizeId number Required, this is the id of the size you would like the droplet created at
imageId number Required, this is the id of the image you would like the droplet created with
regionId number Required, this is the id of the region you would like your server in IE: US/Amsterdam
optionals Object { ssh_key_ids: [], private_networking: false, backups_enabled: false }
Source:

<static> dropletPasswordReset(id)

Reset Root Password. This method will reset the root password for a droplet. Please be aware that this will reboot the droplet to allow resetting the password.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to reset password on
Source:

<static> dropletPowerCycle(id)

Power Cycle Droplet. This method allows you to power cycle a droplet. This will turn off the droplet and then turn it back on.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to power cycle
Source:

<static> dropletPowerOff(id)

Power Off. This method allows you to poweroff a running droplet. The droplet will remain in your account.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to power off
Source:

<static> dropletPowerOn(id)

Power On. This method allows you to poweron a powered off droplet.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to power on
Source:

<static> dropletReboot(id)

Reboot Droplet. This method allows you to reboot a droplet. This is the preferred method to use if a server is not responding.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to reboot
Source:

<static> dropletRebuild(id, imageId)

Rebuild Droplet. This method allows you to reinstall a droplet with a default image. This is useful if you want to start again but retain the same IP address for your droplet.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to rebuild
imageId number Required, this is the id of the image you would like to use to rebuild your droplet with
Source:

<static> dropletRename(id, name)

Rename Droplet. This method renames the droplet to the specified name.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to rename
name string Required, new name of the droplet
Source:

<static> dropletResize(id, sizeId)

Resize Droplet. This method allows you to resize a specific droplet to a different size. This will affect the number of processors and memory allocated to the droplet.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to resize
sizeId number Required, this is the id of the size you would like the droplet to be resized to
Source:

<static> dropletRestore(id, imageId)

Restore Droplet. This method allows you to restore a droplet with a previous image or snapshot. This will be a mirror copy of the image or snapshot to your droplet. Be sure you have backed up any necessary information prior to restore.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to restore
imageId number Required, this is the id of the image you would like to use to restore your droplet with
Source:

<static> dropletShutdown(id)

Shut Down Droplet. This method allows you to shutdown a running droplet. The droplet will remain in your account.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to shutdown
Source:

<static> dropletSnapshot(id, optionals)

Take a Snapshot. This method allows you to take a snapshot of the running droplet, which can later be restored or used to create a new droplet from the same image. Please be aware this may cause a reboot.
Parameters:
Name Type Description
id number Required, this is the id of your droplet that you want to resize
optionals Object { name: "date/time" }
Source:

<static> eventGet(id)

Show event. This method is primarily used to report on the progress of an event by providing the percentage of completion.
Parameters:
Name Type Description
id number Required, this is the id of the event you would like more information about.
Source:

<static> imageDestroy(id)

Destroy Image. This method allows you to destroy an image. There is no way to restore a deleted image so be careful and ensure your data is properly backed up.
Parameters:
Name Type Description
id number Required, this is the id of the image you would like to destroy
Source:

<static> imageGet(id)

Show Image. This method displays the attributes of an image.
Parameters:
Name Type Description
id number Required, this is the id of the image you would like to use to rebuild your droplet with
Source:

<static> imageGetAll()

All Images. This method returns all the available images that can be accessed by your client ID. You will have access to all public images by default, and any snapshots or backups that you have created in your own account.
Source:

<static> imageGetGlobal()

Global images. This method returns all public images.
Source:

<static> imageGetMine()

Mine images. This method returns snapshots or backups that you have created in your own account.
Source:

<static> imageTransfer(id, regionId)

Transfer Image. This method allows you to transfer an image to a specified region.
Parameters:
Name Type Description
id number Required, this is the id of the image you would like to transfer.
regionId number Required, this is the id of the region to which you would like to transfer.
Source:

<static> regionGetAll()

All Regions. This method will return all the available regions within the Digital Ocean cloud.
Source:

<static> sizeGetAll()

All Sizes. This method returns all the available sizes that can be used to create a droplet.
Source:

<static> sshKeyAdd(name, pubKey)

Add SSH Key. This method allows you to add a new public SSH key to your account.
Parameters:
Name Type Description
name string Required, the name you want to give this SSH key.
pubKey string Required, the actual public SSH key.
Source:

<static> sshKeyDestroy(id)

Destroy SSH Key. This method will delete the SSH key from your account.
Parameters:
Name Type Description
id number Required, this is the id of the ssh key you would like to destroy.
Source:

<static> sshKeyEdit(id, pubKey)

Edit SSH Key. This method allows you to modify an existing public SSH key in your account.
Parameters:
Name Type Description
id type Required, this is the id of the ssh key you would like to edit.
pubKey string Required, the public SSH key.
Source:

<static> sshKeyGet(id)

Show SSH Key. This method shows a specific public SSH key in your account that can be added to a droplet.
Parameters:
Name Type Description
id number Required, this is the id of the ssh key you would like to get information on.
Source:

<static> sshKeyGetAll()

All SSH Keys. This method lists all the available public SSH keys in your account that can be added to a droplet.
Source: