|
DigitalOcean API Client in Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DigitalOcean
DigitalOcean API client written in Java
A simple and meaningful wrapper methods for DigitalOcean's API. All of the RESTful that you find in DigitalOcean API's will be made available via simple java methods.
Sample Code:
// Create a DigitalOcean client DigitalOcean apiClient = new DigitalOceanClient(clientId, apiKey); // Let's invoke the appropriate method as per need // Fetching all the available droplets from control panel List<Droplet> droplets = apiClient.getAvailableDroplets(); // Create a new droplet Droplet newDroplet = new Droplet(); newDroplet.setName("api-cliet-test-host"); newDroplet.setSizeId(66); // 66 => 512MB plan newDroplet.setRegionId(3); // 3 => San Francisco 1 Data center newDroplet.setImageId(473123); // 473123 => Ubuntu 12.10 x64 Image Droplet droplet = apiClient.createDroplet(newDroplet); // Fetch droplet information Droplet droplet = apiClient.getDropletInfo(dropletId); // Fetch Available Plans/Sizes supported by DigitalOcean List<DropletSize> sizes = apiClient.getAvailableSizes(); and so on... simple to use and effective!
Method Summary | |
---|---|
SshKey |
addSshKey(String sshKeyName,
String sshPublicKey)
Method allows you to add a new public SSH key to your account |
Domain |
createDomain(String domainName,
String ipAddress)
Method creates a new domain name with an A record for the specified [ip_address]. |
DomainRecord |
createDomainRecord(DomainRecord domainRecord)
Method creates a new domain record name with an given domain record values |
Droplet |
createDroplet(Droplet droplet)
Method allows you to create a new droplet. |
Droplet |
createDroplet(Droplet droplet,
String sshKeyIds)
Method allows you to create a new droplet. |
Response |
deleteDomain(Integer domainId)
Method deletes the specified domain from DNS control panel |
Response |
deleteDomainRecord(Integer domainId,
Integer recordId)
Method deletes the specified domain record from domain. |
Response |
deleteDroplet(Integer dropletId)
Method destroys one of your droplets this is irreversible. |
Response |
deleteImage(Integer imageId)
Method allows you to deletes an image. |
Response |
deleteSshKey(Integer sshKeyId)
Method will delete the SSH key from your account. |
Response |
disableDropletBackups(Integer dropletId)
Method disables automatic backups from running to backup your droplet's data. |
DomainRecord |
editDomainRecord(DomainRecord domainRecord)
method edits an existing domain record of the given domain. |
SshKey |
editSshKey(Integer sshKeyId,
String newSshPublicKey)
Method allows you to modify an existing public SSH key in your account. |
Response |
enableDropletBackups(Integer dropletId)
Method enables automatic backups which run in the background daily to backup your droplet's data. |
List<Domain> |
getAvailableDomains()
Method returns all of your available domains from DNS control panel |
List<Droplet> |
getAvailableDroplets()
Method returns all active droplets that are currently running in your account. |
List<DropletImage> |
getAvailableImages()
Method returns all the available images that can be accessed by your client ID. |
List<Region> |
getAvailableRegions()
Method will return all the available regions within the DigitalOcean cloud. |
List<DropletSize> |
getAvailableSizes()
Method returns all the available sizes that can be used to create a droplet. |
List<SshKey> |
getAvailableSshKeys()
Method lists all the available public SSH keys in your account that can be added to a droplet. |
Domain |
getDomainInfo(Integer domainId)
Method returns the specified domain attributes and zone file info. |
DomainRecord |
getDomainRecordInfo(Integer domainId,
Integer recordId)
Method returns the specified domain record. |
List<DomainRecord> |
getDomainRecords(Integer domainId)
Method returns all of your current domain records from DNS control panel for given domain. |
Droplet |
getDropletInfo(Integer dropletId)
Method returns full information for a specific droplet ID that is passed in the URL. |
Response |
getEventProgress(Integer eventId)
Method is primarily used to collect progress of an event and determined by percentage of completion. |
DropletImage |
getImageInfo(Integer imageId)
Method retrieves the attributes of an image. |
SshKey |
getSshKeyInfo(Integer sshKeyId)
Method shows a specific public SSH key in your account that can be added to a droplet. |
Response |
powerCyleDroplet(Integer dropletId)
Method allows you to power cycle a droplet. |
Response |
powerOffDroplet(Integer dropletId)
Method allows you to poweroff a running droplet. |
Response |
powerOnDroplet(Integer dropletId)
Method allows you to poweron a powered off droplet. |
Response |
rebootDroplet(Integer dropletId)
Method allows you to reboot a droplet. |
Response |
rebuildDroplet(Integer dropletId,
Integer imageId)
Method allows you to reinstall a droplet with a default image. |
Response |
renameDroplet(Integer dropletId,
String name)
Method renames the droplet to the specified name. |
Response |
resetDropletPassword(Integer dropletId)
Method will reset the root password for a droplet. |
Response |
resizeDroplet(Integer dropletId,
Integer sizeId)
Method allows you to resize a specific droplet to a different size. |
Response |
restoreDroplet(Integer dropletId,
Integer imageId)
Method allows you to restore a droplet with a previous image or snapshot. |
Response |
shutdownDroplet(Integer dropletId)
Method allows you to shutdown a running droplet. |
Response |
takeDropletSnapshot(Integer dropletId)
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. |
Response |
takeDropletSnapshot(Integer dropletId,
String snapshotName)
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. |
Response |
transferImage(Integer imageId,
Integer regionId)
Method allows you to transfer an image to a specified region. |
Method Detail |
---|
List<Droplet> getAvailableDroplets() throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Droplet createDroplet(Droplet droplet) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
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.
Create a instance of Droplet
object and populate following values
droplet
- the id of the droplet
Droplet
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Droplet createDroplet(Droplet droplet, String sshKeyIds) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
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.
Create a instance of Droplet
object and populate following values
droplet
- the id of the dropletsshKeyIds
- Numeric CSV, comma separated list of ssh_key_ids that you would like to be
added to the server
Droplet
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Droplet getDropletInfo(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Droplet
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response rebootDroplet(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response powerCyleDroplet(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response shutdownDroplet(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response powerOffDroplet(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response powerOnDroplet(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response resetDropletPassword(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response resizeDroplet(Integer dropletId, Integer sizeId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response takeDropletSnapshot(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response takeDropletSnapshot(Integer dropletId, String snapshotName) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the dropletsnapshotName
- the name the snapshot to be created
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response restoreDroplet(Integer dropletId, Integer imageId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response rebuildDroplet(Integer dropletId, Integer imageId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response enableDropletBackups(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response disableDropletBackups(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response renameDroplet(Integer dropletId, String name) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response deleteDroplet(Integer dropletId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
dropletId
- the id of the droplet
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
List<Region> getAvailableRegions() throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
List<DropletImage> getAvailableImages() throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
DropletImage getImageInfo(Integer imageId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
imageId
- the image Id of the droplet/snapshot/backup images
DropletImage
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response deleteImage(Integer imageId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
imageId
- the image Id of the droplet/snapshot/backup images
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response transferImage(Integer imageId, Integer regionId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
imageId
- the image Id of the droplet/snapshot/backup imagesregionId
- the region Id of the digitalocean data centers
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
List<SshKey> getAvailableSshKeys() throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
List<SshKey>
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
SshKey getSshKeyInfo(Integer sshKeyId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
sshKeyId
- the SSH key Id
SshKey
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
SshKey addSshKey(String sshKeyName, String sshPublicKey) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
sshKeyName
- the name you want to give this SSH keysshPublicKey
- the actual public SSH key
SshKey
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
SshKey editSshKey(Integer sshKeyId, String newSshPublicKey) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
sshKeyId
- the SSH key Id, you would like to editnewSshPublicKey
- the new public SSH key
SshKey
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response deleteSshKey(Integer sshKeyId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
sshKeyId
- the SSH key Id, you would like to delete
Response
RequestUnsuccessfulException
ResourceNotFoundException
AccessDeniedException
List<DropletSize> getAvailableSizes() throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
List<Domain> getAvailableDomains() throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
List<Domain>
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Domain createDomain(String domainName, String ipAddress) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
domainName
- the name of the domainipAddress
- the IP Address for the domain
Domain
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Domain getDomainInfo(Integer domainId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
domainId
- the Id of the domain
Domain
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response deleteDomain(Integer domainId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
domainId
- the Id of the domain
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
List<DomainRecord> getDomainRecords(Integer domainId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
domainId
- the Id of the domain
List<DomainRecord>
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
DomainRecord createDomainRecord(DomainRecord domainRecord) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
domainRecord
- the domain record values domain Id, record type, data, name, priority,
port, weight
DomainRecord
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
DomainRecord getDomainRecordInfo(Integer domainId, Integer recordId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
domainId
- the Id of the domainrecordId
- the record Id of the domain
DomainRecord
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
DomainRecord editDomainRecord(DomainRecord domainRecord) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
domainRecord
- the domain record values domain Id, record type, data, name, priority,
port, weight
DomainRecord
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
Response deleteDomainRecord(Integer domainId, Integer recordId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
RequestUnsuccessfulException
ResourceNotFoundException
AccessDeniedException
Response getEventProgress(Integer eventId) throws AccessDeniedException, ResourceNotFoundException, RequestUnsuccessfulException
eventId
- this is event id of the event you would like to get more information
Response
AccessDeniedException
ResourceNotFoundException
RequestUnsuccessfulException
|
DigitalOcean API Client in Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |