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 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.

Configuring Options

Camel components are configured on two separate levels:

  • component level

  • endpoint level

Configuring Component Options

At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.

For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.

Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.

You can configure components using:

  • the Component DSL.

  • in a configuration file (application.properties, *.yaml files, etc).

  • directly in the Java code.

Configuring Endpoint Options

You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.

Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.

A good practice when configuring options is to use Property Placeholders.

Property placeholders provide a few benefits:

  • They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.

  • They allow externalizing the configuration from the code.

  • They help the code to become more flexible and reusable.

The following two sections list all the options, firstly for the component followed by the endpoint.

Component 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

Endpoint Options

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 (producer)

The operation to perform to the given resource.

Enum values:

  • 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

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.

Enum values:

  • account

  • actions

  • blockStorages

  • droplets

  • mages

  • snapshots

  • keys

  • regions

  • sizes

  • floatingIPs

  • tags

DigitalOceanResources

lazyStartProducer (producer (advanced))

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

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

Message Headers

The DigitalOcean component supports 24 message header(s), which is/are listed below:

Name Description Default Type

CamelDigitalOceanOperation (producer)

Constant: OPERATION

The operation to perform.

Enum values:

  • 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

CamelDigitalOceanId (producer)

Constant: ID

The id.

Integer or String

CamelDigitalOceanType (producer)

Constant: TYPE

The type.

Enum values:

  • distribution

  • application

DigitalOceanImageTypes

CamelDigitalOceanName (producer)

Constant: NAME

The name.

String

CamelDigitalOceanNames (producer)

Constant: NAMES

The names of the droplet.

List

CamelDigitalOceanRegion (producer)

Constant: REGION

The code name of the region aka DigitalOcean data centers.

String

CamelDigitalOceanDescription (producer)

Constant: DESCRIPTION

The description.

String

CamelDigitalOceanDropletSize (producer)

Constant: DROPLET_SIZE

The size of the droplet.

String

CamelDigitalOceanDropletImage (producer)

Constant: DROPLET_IMAGE

The image of the droplet.

String

CamelDigitalOceanDropletSSHKeys (producer)

Constant: DROPLET_KEYS

The keys of the droplet.

List

CamelDigitalOceanDropletEnableBackups (producer)

Constant: DROPLET_ENABLE_BACKUPS

The flag to enable backups.

Boolean

CamelDigitalOceanDropletEnableIpv6 (producer)

Constant: DROPLET_ENABLE_IPV6

The flag to enable ipv6.

Boolean

CamelDigitalOceanDropletEnablePrivateNetworking (producer)

Constant: DROPLET_ENABLE_PRIVATE_NETWORKING

The flag to enable private networking.

Boolean

CamelDigitalOceanDropletUserData (producer)

Constant: DROPLET_USER_DATA

The user data of the droplet.

String

CamelDigitalOceanDropletVolumes (producer)

Constant: DROPLET_VOLUMES

The volumes' identifier of the droplet.

List

CamelDigitalOceanDropletTags (producer)

Constant: DROPLET_TAGS

The tags of the droplet.

List

CamelDigitalOceanDropletId (producer)

Constant: DROPLET_ID

The droplet identifier.

Integer

CamelDigitalOceanImageId (producer)

Constant: IMAGE_ID

The id of the DigitalOcean public image or your private image.

Integer

CamelDigitalOceanKernelId (producer)

Constant: KERNEL_ID

The kernel id to be changed for droplet.

Integer

CamelDigitalOceanVolumeName (producer)

Constant: VOLUME_NAME

The name of the volume.

String

CamelDigitalOceanVolumeSizeGigabytes (producer)

Constant: VOLUME_SIZE_GIGABYTES

The size value in GB.

Integer or Double

CamelDigitalOceanFloatingIPAddress (producer)

Constant: FLOATING_IP_ADDRESS

The floating IP address.

String

CamelDigitalOceanKeyFingerprint (producer)

Constant: KEY_FINGERPRINT

The SSH key fingerprint.

String

CamelDigitalOceanKeyPublicKey (producer)

Constant: KEY_PUBLIC_KEY

The public key.

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. ou can find the per-method limits in the API Rate Limits documentation.

Account endpoint

operation Description Headers Result

get

get account info

com.myjeeva.digitalocean.pojo.Account

BlockStorages endpoint

operation Description Headers Result

list

list all the Block Storage volumes available on your account

List<com.myjeeva.digitalocean.pojo.Volume>

get

show information about a Block Storage volume

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Volume

get

show information about a Block Storage volume by name

CamelDigitalOceanName String,
CamelDigitalOceanRegion String

com.myjeeva.digitalocean.pojo.Volume

listSnapshots

retrieve the snapshots that have been created from a volume

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Snapshot>

create

create a new volume

CamelDigitalOceanVolumeSizeGigabytes Integer,
CamelDigitalOceanName String,
CamelDigitalOceanDescription* String,
CamelDigitalOceanRegion* String

com.myjeeva.digitalocean.pojo.Volume

delete

delete a Block Storage volume, destroying all data and removing it from your account

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Delete

delete

delete a Block Storage volume by name

CamelDigitalOceanName String,
CamelDigitalOceanRegion String

com.myjeeva.digitalocean.pojo.Delete

attach

attach a Block Storage volume to a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanDropletId Integer,
CamelDigitalOceanDropletRegion String

com.myjeeva.digitalocean.pojo.Action

attach

attach a Block Storage volume to a Droplet by name

CamelDigitalOceanName String,
CamelDigitalOceanDropletId Integer,
CamelDigitalOceanDropletRegion String

com.myjeeva.digitalocean.pojo.Action

detach

detach a Block Storage volume from a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanDropletId Integer,
CamelDigitalOceanDropletRegion String

com.myjeeva.digitalocean.pojo.Action

attach

detach a Block Storage volume from a Droplet by name

CamelDigitalOceanName String,
CamelDigitalOceanDropletId Integer,
CamelDigitalOceanDropletRegion String

com.myjeeva.digitalocean.pojo.Action

resize

resize a Block Storage volume

CamelDigitalOceanVolumeSizeGigabytes Integer,
CamelDigitalOceanRegion String

com.myjeeva.digitalocean.pojo.Action

listActions

retrieve all actions that have been executed on a volume

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Action>

Droplets endpoint

operation Description Headers Result

list

list all Droplets in your account

List<com.myjeeva.digitalocean.pojo.Droplet>

get

show an individual droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Droplet

create

create a new Droplet

CamelDigitalOceanName String,
CamelDigitalOceanDropletImage String,
CamelDigitalOceanRegion String,
CamelDigitalOceanDropletSize String,
CamelDigitalOceanDropletSSHKeys* List<String>,
CamelDigitalOceanDropletEnableBackups* Boolean,
CamelDigitalOceanDropletEnableIpv6* Boolean,
CamelDigitalOceanDropletEnablePrivateNetworking* Boolean,
CamelDigitalOceanDropletUserData* String,
CamelDigitalOceanDropletVolumes* List<String>,
CamelDigitalOceanDropletTags List<String>

com.myjeeva.digitalocean.pojo.Droplet

create

create multiple Droplets

CamelDigitalOceanNames List<String>,
CamelDigitalOceanDropletImage String,
CamelDigitalOceanRegion String,
CamelDigitalOceanDropletSize String,
CamelDigitalOceanDropletSSHKeys* List<String>,
CamelDigitalOceanDropletEnableBackups* Boolean,
CamelDigitalOceanDropletEnableIpv6* Boolean,
CamelDigitalOceanDropletEnablePrivateNetworking* Boolean,
CamelDigitalOceanDropletUserData* String,
CamelDigitalOceanDropletVolumes* List<String>,
CamelDigitalOceanDropletTags List<String>

com.myjeeva.digitalocean.pojo.Droplet

delete

delete a Droplet,

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Delete

enableBackups

enable backups on an existing Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

disableBackups

disable backups on an existing Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

enableIpv6

enable IPv6 networking on an existing Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

enablePrivateNetworking

enable private networking on an existing Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

reboot

reboot a Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

powerCycle

power cycle a Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

shutdown

shutdown a Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

powerOff

power off a Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

powerOn

power on a Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

restore

shutdown a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanImageId Integer

com.myjeeva.digitalocean.pojo.Action

passwordReset

reset the password for a Droplet

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

resize

resize a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanDropletSize String

com.myjeeva.digitalocean.pojo.Action

rebuild

rebuild a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanImageId Integer

com.myjeeva.digitalocean.pojo.Action

rename

rename a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Action

changeKernel

change the kernel of a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanKernelId Integer

com.myjeeva.digitalocean.pojo.Action

takeSnapshot

snapshot a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanName* String

com.myjeeva.digitalocean.pojo.Action

tag

tag a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Response

untag

untag a Droplet

CamelDigitalOceanId Integer,
CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Response

listKernels

retrieve a list of all kernels available to a Droplet

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Kernel>

listSnapshots

retrieve the snapshots that have been created from a Droplet

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Snapshot>

listBackups

retrieve any backups associated with a Droplet

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Backup>

listActions

retrieve all actions that have been executed on a Droplet

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Action>

listNeighbors

retrieve a list of droplets that are running on the same physical server

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Droplet>

listAllNeighbors

retrieve a list of any droplets that are running on the same physical hardware

List<com.myjeeva.digitalocean.pojo.Droplet>

Images endpoint

operation Description Headers Result

list

list images available on your account

CamelDigitalOceanType* DigitalOceanImageTypes

List<com.myjeeva.digitalocean.pojo.Image>

ownList

retrieve only the private images of a user

List<com.myjeeva.digitalocean.pojo.Image>

listActions

retrieve all actions that have been executed on an Image

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.Action>

get

retrieve information about an image (public or private) by id

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Image

get

retrieve information about a public image by slug

CamelDigitalOceanDropletImage String

com.myjeeva.digitalocean.pojo.Image

update

update an image

CamelDigitalOceanId Integer,
CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Image

delete

delete an image

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Delete

transfer

transfer an image to another region

CamelDigitalOceanId Integer,
CamelDigitalOceanRegion String

com.myjeeva.digitalocean.pojo.Action

convert

convert an image, for example, a backup to a snapshot

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Action

Snapshots endpoint

operation Description Headers Result

list

list all the snapshots available on your account

CamelDigitalOceanType* DigitalOceanSnapshotTypes

List<com.myjeeva.digitalocean.pojo.Snapshot>

get

retrieve information about a snapshot

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Snapshot

delete

delete an snapshot

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Delete

Keys endpoint

operation Description Headers Result

list

list all the keys in your account

List<com.myjeeva.digitalocean.pojo.Key>

get

retrieve information about a key by id

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Key

get

retrieve information about a key by fingerprint

CamelDigitalOceanKeyFingerprint String

com.myjeeva.digitalocean.pojo.Key

update

update a key by id

CamelDigitalOceanId Integer,
CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Key

update

update a key by fingerprint

CamelDigitalOceanKeyFingerprint String,
CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Key

delete

delete a key by id

CamelDigitalOceanId Integer

com.myjeeva.digitalocean.pojo.Delete

delete

delete a key by fingerprint

CamelDigitalOceanKeyFingerprint String

com.myjeeva.digitalocean.pojo.Delete

Regions endpoint

operation Description Headers Result

list

list all the regions that are available

List<com.myjeeva.digitalocean.pojo.Region>

Sizes endpoint

operation Description Headers Result

list

list all the sizes that are available

List<com.myjeeva.digitalocean.pojo.Size>

Floating IPs endpoint

operation Description Headers Result

list

list all the Floating IPs available on your account

List<com.myjeeva.digitalocean.pojo.FloatingIP>

create

create a new Floating IP assigned to a Droplet

CamelDigitalOceanId Integer

List<com.myjeeva.digitalocean.pojo.FloatingIP>

create

create a new Floating IP assigned to a Region

CamelDigitalOceanRegion String

List<com.myjeeva.digitalocean.pojo.FloatingIP>

get

retrieve information about a Floating IP

CamelDigitalOceanFloatingIPAddress String

com.myjeeva.digitalocean.pojo.Key

delete

delete a Floating IP and remove it from your account

CamelDigitalOceanFloatingIPAddress String

com.myjeeva.digitalocean.pojo.Delete

assign

assign a Floating IP to a Droplet

CamelDigitalOceanFloatingIPAddress String,
CamelDigitalOceanDropletId Integer

com.myjeeva.digitalocean.pojo.Action

unassign

un-assign a Floating IP

CamelDigitalOceanFloatingIPAddress String

com.myjeeva.digitalocean.pojo.Action

listActions

retrieve all actions that have been executed on a Floating IP

CamelDigitalOceanFloatingIPAddress String

List<com.myjeeva.digitalocean.pojo.Action>

Tags endpoint

operation Description Headers Result

list

list all of your tags

List<com.myjeeva.digitalocean.pojo.Tag>

create

create a Tag

CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Tag

get

retrieve an individual tag

CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Tag

delete

delete a tag

CamelDigitalOceanName String

com.myjeeva.digitalocean.pojo.Delete

update

update a tag

CamelDigitalOceanName String,
CamelDigitalOceanNewName String

com.myjeeva.digitalocean.pojo.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

camel.component.digitalocean.autowired-enabled

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

camel.component.digitalocean.enabled

Whether to enable auto configuration of the digitalocean component. This is enabled by default.

Boolean

camel.component.digitalocean.lazy-start-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