DigitalOcean
Since Camel 2.19
Only producer is supported
The DigitalOcean component allows you to manage Droplets and resources within the DigitalOcean cloud with Camel by encapsulating digitalocean-api-java. All of the functionality that you are familiar with in the DigitalOcean control panel is also available through this Camel component.
Prerequisites
You must have a valid DigitalOcean account and a valid OAuth token. You can generate an OAuth token by visiting the [Apps & API] section of the DigitalOcean control panel for your account.
URI format
The DigitalOcean Component uses the following URI format:
digitalocean://endpoint?[options]
where endpoint
is a DigitalOcean resource type.
Example : to list your droplets:
digitalocean://droplets?operation=list&oAuthToken=XXXXXX&page=1&perPage=10
The DigitalOcean component only supports producer endpoints so you cannot use this component at the beginning of a route to listen to messages in a channel.
Options
The DigitalOcean component supports 2 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
lazyStartProducer (producer) |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. |
false |
boolean |
autowiredEnabled (advanced) |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. |
true |
boolean |
The DigitalOcean endpoint is configured using URI syntax:
digitalocean:operation
with the following path and query parameters:
Path Parameters (1 parameters):
Name | Description | Default | Type |
---|---|---|---|
operation |
The operation to perform to the given resource. There are 36 enums and the value can be one of: create, update, delete, list, ownList, get, listBackups, listActions, listNeighbors, listSnapshots, listKernels, listAllNeighbors, enableBackups, disableBackups, reboot, powerCycle, shutdown, powerOn, powerOff, restore, resetPassword, resize, rebuild, rename, changeKernel, enableIpv6, enablePrivateNetworking, takeSnapshot, transfer, convert, attach, detach, assign, unassign, tag, untag |
DigitalOceanOperations |
Query Parameters (10 parameters):
Name | Description | Default | Type |
---|---|---|---|
lazyStartProducer (producer) |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. |
false |
boolean |
page (producer) |
Use for pagination. Force the page number. |
1 |
Integer |
perPage (producer) |
Use for pagination. Set the number of item per request. The maximum number of results per page is 200. |
25 |
Integer |
resource (producer) |
Required The DigitalOcean resource type on which perform the operation. There are 11 enums and the value can be one of: account, actions, blockStorages, droplets, mages, snapshots, keys, regions, sizes, floatingIPs, tags |
DigitalOceanResources |
|
digitalOceanClient (advanced) |
To use a existing configured DigitalOceanClient as client |
DigitalOceanClient |
|
httpProxyHost (proxy) |
Set a proxy host if needed |
String |
|
httpProxyPassword (proxy) |
Set a proxy password if needed |
String |
|
httpProxyPort (proxy) |
Set a proxy port if needed |
Integer |
|
httpProxyUser (proxy) |
Set a proxy host if needed |
String |
|
oAuthToken (security) |
DigitalOcean OAuth Token |
String |
You have to provide an operation value for each endpoint, with the operation
URI option or the CamelDigitalOceanOperation
message header.
All operation values are defined in DigitalOceanOperations
enumeration.
All header names used by the component are defined in DigitalOceanHeaders
enumeration.
Message body result
All message bodies returned are using objects provided by the digitalocean-api-java library.
API Rate Limits
DigitalOcean REST API encapsulated by camel-digitalocean component is subjected to API Rate Limiting. You can find the per method limits in the API Rate Limits documentation.
Account endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
get account info |
|
BlockStorages endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all of the Block Storage volumes available on your account |
|
|
|
show information about a Block Storage volume |
|
|
|
show information about a Block Storage volume by name |
|
|
|
retrieve the snapshots that have been created from a volume |
|
|
|
create a new volume |
|
|
|
delete a Block Storage volume, destroying all data and removing it from your account |
|
|
|
delete a Block Storage volume by name |
|
|
|
attach a Block Storage volume to a Droplet |
|
|
|
attach a Block Storage volume to a Droplet by name |
|
|
|
detach a Block Storage volume from a Droplet |
|
|
|
detach a Block Storage volume from a Droplet by name |
|
|
|
resize a Block Storage volume |
|
|
|
retrieve all actions that have been executed on a volume |
|
|
Droplets endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all Droplets in your account |
|
|
|
show an individual droplet |
|
|
|
create a new Droplet |
|
|
|
create multiple Droplets |
|
|
|
delete a Droplet, |
|
|
|
enable backups on an existing Droplet |
|
|
|
disable backups on an existing Droplet |
|
|
|
enable IPv6 networking on an existing Droplet |
|
|
|
enable private networking on an existing Droplet |
|
|
|
reboot a Droplet |
|
|
|
power cycle a Droplet |
|
|
|
shutdown a Droplet |
|
|
|
power off a Droplet |
|
|
|
power on a Droplet |
|
|
|
shutdown a Droplet |
|
|
|
reset the password for a Droplet |
|
|
|
resize a Droplet |
|
|
|
rebuild a Droplet |
|
|
|
rename a Droplet |
|
|
|
change the kernel of a Droplet |
|
|
|
snapshot a Droplet |
|
|
|
tag a Droplet |
|
|
|
untag a Droplet |
|
|
|
retrieve a list of all kernels available to a Droplet |
|
|
|
retrieve the snapshots that have been created from a Droplet |
|
|
|
retrieve any backups associated with a Droplet |
|
|
|
retrieve all actions that have been executed on a Droplet |
|
|
|
retrieve a list of droplets that are running on the same physical server |
|
|
|
retrieve a list of any droplets that are running on the same physical hardware |
|
Images endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list images available on your account |
|
|
|
retrieve only the private images of a user |
|
|
|
retrieve all actions that have been executed on a Image |
|
|
|
retrieve information about an image (public or private) by id |
|
|
|
retrieve information about an public image by slug |
|
|
|
update an image |
|
|
|
delete an image |
|
|
|
transfer an image to another region |
|
|
|
convert an image, for example, a backup to a snapshot |
|
|
Snapshots endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all of the snapshots available on your account |
|
|
|
retrieve information about a snapshot |
|
|
|
delete an snapshot |
|
|
Keys endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all of the keys in your account |
|
|
|
retrieve information about a key by id |
|
|
|
retrieve information about a key by fingerprint |
|
|
|
update a key by id |
|
|
|
update a key by fingerprint |
|
|
|
delete a key by id |
|
|
|
delete a key by fingerprint |
|
|
Regions endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all of the regions that are available |
|
Sizes endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all of the sizes that are available |
|
Floating IPs endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all of the Floating IPs available on your account |
|
|
|
create a new Floating IP assigned to a Droplet |
|
|
|
create a new Floating IP assigned to a Region |
|
|
|
retrieve information about a Floating IP |
|
|
|
delete a Floating IP and remove it from your account |
|
|
|
assign a Floating IP to a Droplet |
|
|
|
unassign a Floating IP |
|
|
|
retrieve all actions that have been executed on a Floating IP |
|
|
Tags endpoint
operation | Description | Headers | Result |
---|---|---|---|
|
list all of your tags |
|
|
|
create a Tag |
|
|
|
retrieve an individual tag |
|
|
|
delete a tag |
|
|
|
update a tag |
|
|
Examples
Get your account info
from("direct:getAccountInfo")
.setHeader(DigitalOceanConstants.OPERATION, constant(DigitalOceanOperations.get))
.to("digitalocean:account?oAuthToken=XXXXXX")
Create a droplet
from("direct:createDroplet")
.setHeader(DigitalOceanConstants.OPERATION, constant("create"))
.setHeader(DigitalOceanHeaders.NAME, constant("myDroplet"))
.setHeader(DigitalOceanHeaders.REGION, constant("fra1"))
.setHeader(DigitalOceanHeaders.DROPLET_IMAGE, constant("ubuntu-14-04-x64"))
.setHeader(DigitalOceanHeaders.DROPLET_SIZE, constant("512mb"))
.to("digitalocean:droplet?oAuthToken=XXXXXX")
List all your droplets
from("direct:getDroplets")
.setHeader(DigitalOceanConstants.OPERATION, constant("list"))
.to("digitalocean:droplets?oAuthToken=XXXXXX")
Retrieve information for the Droplet (dropletId = 34772987)
from("direct:getDroplet")
.setHeader(DigitalOceanConstants.OPERATION, constant("get"))
.setHeader(DigitalOceanConstants.ID, 34772987)
.to("digitalocean:droplet?oAuthToken=XXXXXX")
Shutdown information for the Droplet (dropletId = 34772987)
from("direct:shutdown")
.setHeader(DigitalOceanConstants.ID, 34772987)
.to("digitalocean:droplet?operation=shutdown&oAuthToken=XXXXXX")
Spring Boot Auto-Configuration
When using digitalocean with Spring Boot make sure to use the following Maven dependency to have support for auto configuration:
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-digitalocean-starter</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
The component supports 3 options, which are listed below.
Name | Description | Default | Type |
---|---|---|---|
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. |
true |
Boolean |
|
Whether to enable auto configuration of the digitalocean component. This is enabled by default. |
Boolean |
||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. |
false |
Boolean |